Skip to content

Commit

Permalink
Merge pull request #742 from samvera-labs/avannotate-fixes
Browse files Browse the repository at this point in the history
Fix error message display and general parsing error for AVAnnotate manifests
  • Loading branch information
Dananji authored Dec 6, 2024
2 parents 68cdacf + 2deb5e1 commit e903c49
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 10 deletions.
5 changes: 5 additions & 0 deletions src/components/MediaPlayer/MediaPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ const MediaPlayer = ({
sources: isMultiSourced
? [sources[srcIndex]]
: sources,
errorDisplay: {
// If only one source is available and it is not playable remove
// close button for the error modal dialog
uncloseable: sources?.length > 1 ? false : true,
},
} : { ...defaultOptions, sources: [] };
}, [isVideo, playerConfig, srcIndex]);

Expand Down
26 changes: 17 additions & 9 deletions src/components/MediaPlayer/VideoJS/VideoJSPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,25 @@ function VideoJSPlayer({
player.controlBar.addClass('vjs-mobile-visible');
}

player.muted(startMuted);
player.volume(startVolume);
player.canvasIndex = cIndexRef.current;
player.duration(canvasDuration);
player.srcIndex = srcIndex;
player.targets = targets;
/**
* When source is not supported in VideoJS handle re-direct the error to the
* custom function in the 'error' event handler in this code.
*/
if (player.error()) {
player.trigger('error');
} else {
player.muted(startMuted);
player.volume(startVolume);
player.canvasIndex = cIndexRef.current;
player.duration(canvasDuration);
player.srcIndex = srcIndex;
player.targets = targets;

if (enableTitleLink) player.canvasLink = canvasLink;
if (enableTitleLink) player.canvasLink = canvasLink;

// Need to set this once experimentalSvgIcons option in Video.js options was enabled
player.getChild('controlBar').qualitySelector.setIcon('cog');
// Need to set this once experimentalSvgIcons option in Video.js options was enabled
player.getChild('controlBar').qualitySelector.setIcon('cog');
}
});

player.on('emptied', () => {
Expand Down
5 changes: 5 additions & 0 deletions src/components/MediaPlayer/VideoJS/videojs-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,8 @@
.vjs-theme-ramp .vjs-file-download .vjs-menu {
left: -3.5em;
}

// Center error message horizontally in the error modal dialog
.vjs-error-display.vjs-modal-dialog .vjs-modal-dialog-content {
padding: 20px 25%;
}
3 changes: 2 additions & 1 deletion src/context/manifest-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ function manifestReducer(state = defaultState, action) {
const manifestBehavior = parseAutoAdvance(manifest.behavior);
const isPlaylist = getIsPlaylist(manifest.label);
const annotationService = getAnnotationService(manifest.service);
const playlistMarkers = parsePlaylistAnnotations(manifest);
// Parse playlist markers only for playlist manifests
const playlistMarkers = isPlaylist ? parsePlaylistAnnotations(manifest) : [];

return {
...state,
Expand Down

0 comments on commit e903c49

Please sign in to comment.