Skip to content

Commit

Permalink
refactor: fix displaying subtitle tracks
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmcbroom authored and ferferga committed Sep 12, 2024
1 parent 75cea0d commit d87cf56
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 2 additions & 3 deletions frontend/src/components/Playback/PlayerElement.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,16 @@
:loop="playbackManager.isRepeatingOnce"
:class="{ 'uno-object-fill': playerElement.isStretched.value }"
@loadeddata="onLoadedData">
<SubtitleTrack
v-if="subtitleSettings.state.enabled && playerElement.currentExternalSubtitleTrack?.parsed !== undefined" />
<track
v-for="sub in playbackManager.currentItemVttParsedSubtitleTracks"
v-else
:key="`${playbackManager.currentSourceUrl}-${sub.srcIndex}`"
kind="subtitles"
:label="sub.label"
:srclang="sub.srcLang"
:src="sub.src">
</Component>
<SubtitleTrack
v-if="subtitleSettings.state.enabled && playerElement.currentExternalSubtitleTrack?.parsed !== undefined" />
</Teleport>
</template>
</template>
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/store/player-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { router } from '@/plugins/router';
import { remote } from '@/plugins/remote';
import type { ParsedSubtitleTrack } from '@/plugins/workers/generic/subtitles';
import { genericWorker } from '@/plugins/workers';
import { subtitleSettings } from '@/store/client-settings/subtitle-settings';

interface SubtitleExternalTrack extends PlaybackExternalTrack {
parsed?: ParsedSubtitleTrack;
Expand Down Expand Up @@ -96,6 +97,7 @@ class PlayerElementStore extends CommonStore<PlayerElementState> {
*/
private get _useCustomSubtitleTrack(): boolean {
return !isNil(playbackManager.currentSubtitleTrack)
&& subtitleSettings.state.enabled
&& playbackManager.currentSubtitleTrack.DeliveryMethod === SubtitleDeliveryMethod.External
/**
* If useFullscreen isn't supported we can assume the media player is Safari iOS
Expand Down

0 comments on commit d87cf56

Please sign in to comment.