diff --git a/frontend/src/components/Playback/PlayerElement.vue b/frontend/src/components/Playback/PlayerElement.vue index 017b3f0d5dd..3cbf9e83422 100644 --- a/frontend/src/components/Playback/PlayerElement.vue +++ b/frontend/src/components/Playback/PlayerElement.vue @@ -11,7 +11,7 @@ playsinline :loop="playbackManager.isRepeatingOnce" :class="{ stretched: playerElement.isStretched }" - @canplay="onCanPlay"> + @loadeddata="onLoadedData"> diff --git a/frontend/src/store/playbackManager.ts b/frontend/src/store/playbackManager.ts index 288bfd7645e..81cfc4a3f12 100644 --- a/frontend/src/store/playbackManager.ts +++ b/frontend/src/store/playbackManager.ts @@ -1,4 +1,4 @@ -import { reactive, Ref, ref, watch } from 'vue'; +import { reactive, ref, watch } from 'vue'; import { shuffle, isNil, cloneDeep } from 'lodash-es'; import { BaseItemDto, @@ -23,20 +23,6 @@ import { getImageInfo } from '@/utils/images'; import { msToTicks } from '@/utils/time'; import playbackProfile from '@/utils/playback-profiles'; -export let mediaElementRef = ref(); -export let mediaControls = useMediaControls(mediaElementRef); - -/** - * Temporary function to set new media element ref until https://github.com/vuejs/core/pull/7593 is fixed - */ -export function setNewMediaElementRef( - newMediaElementRef: Ref -): void { - // eslint-disable-next-line vue/no-ref-as-operand - mediaElementRef = newMediaElementRef; - mediaControls = useMediaControls(mediaElementRef); -} - /** * == INTERFACES == */ @@ -133,6 +119,8 @@ const defaultState: PlaybackManagerState = { const state = reactive(cloneDeep(defaultState)); const reactiveDate = useNow(); +export const mediaElementRef = ref(); +export const mediaControls = useMediaControls(mediaElementRef); /** * Previously, we created a new MediaMetadata every time the item changed. However, * that made the MediaSession controls disappear for a second. Keeping the metadata diff --git a/frontend/src/store/playerElement.ts b/frontend/src/store/playerElement.ts index 358310753ac..858e4a0bd48 100644 --- a/frontend/src/store/playerElement.ts +++ b/frontend/src/store/playerElement.ts @@ -87,8 +87,6 @@ class PlayerElementStore { }; private _setSsaTrack = async (trackSrc: string): Promise => { - this.freeSsaTrack(); - if (!subtitlesOctopus) { subtitlesOctopus = new SubtitlesOctopus({ video: mediaElementRef.value, @@ -104,7 +102,10 @@ class PlayerElementStore { public freeSsaTrack = (): void => { if (subtitlesOctopus) { - subtitlesOctopus.dispose(); + try { + subtitlesOctopus.dispose(); + } catch {} + subtitlesOctopus = undefined; } };