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) {
isFullscreen = false;
emit("fullscreen", isFullscreen);
emit("needstrack", false);
if (!fscreen.fullscreenElement) return;
fscreen.exitFullscreen();
return;
@ -192,7 +193,10 @@ export function makeVideoElementDisplayInterface(): DisplayInterface {
return;
}
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;
qualities: SourceQuality[];
changedquality: SourceQuality | null;
needstrack: boolean;
};
export interface DisplayInterface extends Listener<DisplayInterfaceEvents> {

View File

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