Skip to content

Commit

Permalink
feat: add subtitle toggle like yt
Browse files Browse the repository at this point in the history
  • Loading branch information
asharma991 committed Mar 30, 2024
1 parent 76a0a4b commit 3fdc5c6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/components/VideoPlayer2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,15 @@ export const VideoPlayer: FunctionComponent<VideoPlayerProps> = ({
player.currentTime(player.currentTime() + (10 * player.playbackRate()));
event.stopPropagation();
break;
case 'KeyC':
if (subtitles && player.textTracks().length) {
if (player.textTracks()[0].mode === 'showing') {
player.textTracks()[0].mode = 'hidden';
} else {
player.textTracks()[0].mode = 'showing';
}
}
break;
}
}
};
Expand Down

0 comments on commit 3fdc5c6

Please sign in to comment.