Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only display CC button for Video instances #438

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/MediaPlayer/MediaPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ const MediaPlayer = ({ enableFileDownload = false, enablePIP = false }) => {
'timeDivider',
'durationDisplay',
(hasStructure || playlist.isPlaylist) ? 'videoJSTrackScrubber' : '',
playerConfig.tracks.length > 0 ? 'subsCapsButton' : '',
(playerConfig.tracks.length > 0 && isVideo) ? 'subsCapsButton' : '',
IS_MOBILE ? 'muteToggle' : 'volumePanel',
'qualitySelector',
enablePIP ? 'pictureInPictureToggle' : '',
Expand Down
5 changes: 5 additions & 0 deletions src/components/MediaPlayer/VideoJS/VideoJSPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,11 @@ function VideoJSPlayer({
* @param {Boolean} subsOn flag to indicate captions are on/off
*/
const handleCaptionChange = (subsOn) => {
/* For audio instances Video.js is setup to not to build the CC button in Ramp's player
control bar. But when captions are specified in the HLS manifest Video.js' streaming handlers
setup captions, causing this to crash since the CC button is not present in the control bar.
*/
if (!player.controlBar.subsCapsButton) return;
if (subsOn) {
player.controlBar.subsCapsButton.addClass('captions-on');
} else {
Expand Down