Skip to content

Commit

Permalink
Fix double-selection issue when auto-generated & native tracks exist,…
Browse files Browse the repository at this point in the history
… & fix similar pre-existing bug

Also fixes pre-existing bug with pressing 'c' having the effect of multiple tracks (inaccurately) showing as selected.
  • Loading branch information
kommunarr committed Dec 16, 2023
1 parent 897d789 commit 6b058f8
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/renderer/components/ft-video-player/ft-video-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -1410,6 +1410,14 @@ export default defineComponent({
const trackIndex = this.useDash ? 1 : 0

const tracks = this.player.textTracks()

// visually and semantically disable any other enabled tracks
for (let i = 0; i < tracks.length; ++i) {
if (i !== trackIndex) {
tracks[i].mode = 'disabled'
}
}

if (tracks.length > trackIndex) {
if (tracks[trackIndex].mode === 'showing') {
tracks[trackIndex].mode = 'disabled'
Expand Down Expand Up @@ -1868,19 +1876,16 @@ export default defineComponent({
captionList = this.captionHybridList
}

for (const caption of this.sortCaptions(captionList)) {
this.sortCaptions(captionList).forEach((caption, i) =>
this.player.addRemoteTextTrack({
kind: 'subtitles',
src: caption.url,
srclang: caption.language_code,
label: caption.label,
type: caption.type
type: caption.type,
default: i === 0 && this.enableSubtitlesByDefault
}, true)
}

if (this.enableSubtitlesByDefault) {
this.toggleCaptions()
}
)
},

toggleFullWindow: function () {
Expand Down

0 comments on commit 6b058f8

Please sign in to comment.