diff --git a/src/controllers/playback/video/index.js b/src/controllers/playback/video/index.js index aadadf130f9..32aed2ef7fc 100644 --- a/src/controllers/playback/video/index.js +++ b/src/controllers/playback/video/index.js @@ -1184,6 +1184,20 @@ export default function (view) { } } + function autoSelectSubtitleTrack() { + const player = currentPlayer; + const streams = playbackManager.subtitleTracks(player); + const currentIndex = playbackManager.getSubtitleStreamIndex(player) ?? -1; + const defaultIndex = player?.streamInfo?.mediaSource?.DefaultSubtitleStreamIndex ?? -1; + + if (currentIndex === -1 && streams.length > 0) { + const subtitleIndex = defaultIndex != -1 ? defaultIndex : streams[0].Index; + playbackManager.setSubtitleStreamIndex(subtitleIndex, player); + } else { + playbackManager.setSubtitleStreamIndex(-1, player); + } + } + /** * Clicked element. * To skip 'click' handling on Firefox/Edge. @@ -1395,6 +1409,13 @@ export default function (view) { playbackManager.previousChapter(currentPlayer); } break; + case 'c': + case 'C': + if (!e.shiftKey) { + e.preventDefault(); + autoSelectSubtitleTrack(); + } + break; case 'g': case 'G': if (!e.shiftKey) {