show subtitles in ios fullscreen

This commit is contained in:
mrjvs 2023-10-18 15:17:46 +02:00
parent 596e97e1ba
commit 0ca585f70a
3 changed files with 11 additions and 1 deletions

View File

@ -178,6 +178,7 @@ export function makeVideoElementDisplayInterface(): DisplayInterface {
if (isFullscreen) { if (isFullscreen) {
isFullscreen = false; isFullscreen = false;
emit("fullscreen", isFullscreen); emit("fullscreen", isFullscreen);
emit("needstrack", false);
if (!fscreen.fullscreenElement) return; if (!fscreen.fullscreenElement) return;
fscreen.exitFullscreen(); fscreen.exitFullscreen();
return; return;
@ -192,7 +193,10 @@ export function makeVideoElementDisplayInterface(): DisplayInterface {
return; return;
} }
if (canWebkitFullscreen()) { if (canWebkitFullscreen()) {
if (videoElement) (videoElement as any).webkitEnterFullscreen(); if (videoElement) {
emit("needstrack", true);
(videoElement as any).webkitEnterFullscreen();
}
} }
}, },
}; };

View File

@ -12,6 +12,7 @@ export type DisplayInterfaceEvents = {
loading: boolean; loading: boolean;
qualities: SourceQuality[]; qualities: SourceQuality[];
changedquality: SourceQuality | null; changedquality: SourceQuality | null;
needstrack: boolean;
}; };
export interface DisplayInterface extends Listener<DisplayInterfaceEvents> { export interface DisplayInterface extends Listener<DisplayInterfaceEvents> {

View File

@ -75,6 +75,11 @@ export const createDisplaySlice: MakeSlice<DisplaySlice> = (set, get) => ({
s.currentQuality = quality; s.currentQuality = quality;
}); });
}); });
newDisplay.on("needstrack", (needsTrack) => {
set((s) => {
s.caption.asTrack = needsTrack;
});
});
set((s) => { set((s) => {
s.display = newDisplay; s.display = newDisplay;