Skip to content

Commit

Permalink
Fix keyboard shortcut to toggle the captions (#3580)
Browse files Browse the repository at this point in the history
  • Loading branch information
absidue committed May 23, 2023
1 parent 6f95673 commit a11533a
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/renderer/components/ft-video-player/ft-video-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -1307,13 +1307,16 @@ export default defineComponent({
},

toggleCaptions: function () {
const tracks = this.player.textTracks().tracks_

if (tracks.length > 1) {
if (tracks[1].mode === 'showing') {
tracks[1].mode = 'disabled'
// skip videojs-http-streaming's segment-metadata track
// https://github.com/videojs/http-streaming#segment-metadata
const trackIndex = this.useDash ? 1 : 0

const tracks = this.player.textTracks()
if (tracks.length > trackIndex) {
if (tracks[trackIndex].mode === 'showing') {
tracks[trackIndex].mode = 'disabled'
} else {
tracks[1].mode = 'showing'
tracks[trackIndex].mode = 'showing'
}
}
},
Expand Down

0 comments on commit a11533a

Please sign in to comment.