diff --git a/src/components/player/display/base.ts b/src/components/player/display/base.ts index a2f23e2b..5a34f64c 100644 --- a/src/components/player/display/base.ts +++ b/src/components/player/display/base.ts @@ -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(); + } } }, }; diff --git a/src/components/player/display/displayInterface.ts b/src/components/player/display/displayInterface.ts index 6ebdddb3..ed8c10de 100644 --- a/src/components/player/display/displayInterface.ts +++ b/src/components/player/display/displayInterface.ts @@ -12,6 +12,7 @@ export type DisplayInterfaceEvents = { loading: boolean; qualities: SourceQuality[]; changedquality: SourceQuality | null; + needstrack: boolean; }; export interface DisplayInterface extends Listener { diff --git a/src/stores/player/slices/display.ts b/src/stores/player/slices/display.ts index 09778aba..76597086 100644 --- a/src/stores/player/slices/display.ts +++ b/src/stores/player/slices/display.ts @@ -75,6 +75,11 @@ export const createDisplaySlice: MakeSlice = (set, get) => ({ s.currentQuality = quality; }); }); + newDisplay.on("needstrack", (needsTrack) => { + set((s) => { + s.caption.asTrack = needsTrack; + }); + }); set((s) => { s.display = newDisplay;