mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
feat: add C key shortcut to toggle subtitles on/off
This commit is contained in:
parent
cf73c7942d
commit
b72617c541
1 changed files with 22 additions and 0 deletions
|
|
@ -635,6 +635,28 @@ const Player = ({ urlParams, queryParams }) => {
|
|||
|
||||
break;
|
||||
}
|
||||
case 'KeyC': {
|
||||
if (!menusOpen && !nextVideoPopupOpen) {
|
||||
const internalTracks = video.state.subtitlesTracks;
|
||||
const externalTracks = video.state.extraSubtitlesTracks;
|
||||
const hasInternal = Array.isArray(internalTracks) && internalTracks.length > 0;
|
||||
const hasExternal = Array.isArray(externalTracks) && externalTracks.length > 0;
|
||||
const hasInternalActive = video.state.selectedSubtitlesTrackId !== null;
|
||||
const hasExternalActive = video.state.selectedExtraSubtitlesTrackId !== null;
|
||||
|
||||
if (hasInternalActive || hasExternalActive) {
|
||||
onSubtitlesTrackSelected(null);
|
||||
onExtraSubtitlesTrackSelected(null);
|
||||
} else if (hasInternal || hasExternal) {
|
||||
if (hasInternal) {
|
||||
onSubtitlesTrackSelected(internalTracks[0].id);
|
||||
} else {
|
||||
onExtraSubtitlesTrackSelected(externalTracks[0].id);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'KeyA': {
|
||||
closeMenus();
|
||||
if (Array.isArray(video.state.audioTracks) && video.state.audioTracks.length > 0) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue