Skip to content

Commit

Permalink
Merge pull request #569 from samvera-labs/inaccesible-autoplay
Browse files Browse the repository at this point in the history
Ensure autoplay of next section when selecting inaccesible item
  • Loading branch information
masaball authored Jul 15, 2024
2 parents 5c7faea + 8c07bf0 commit 88cbad2
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/components/StructuredNavigation/StructuredNavigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const StructuredNavigation = () => {
const playerDispatch = usePlayerDispatch();

const { clickedUrl, isClicked, isPlaying, player } = usePlayerState();
const { canvasDuration, canvasIndex, hasMultiItems, targets, manifest, playlist, canvasIsEmpty, canvasSegments } =
const { canvasDuration, canvasIndex, hasMultiItems, targets, manifest, playlist, canvasIsEmpty, canvasSegments, autoAdvance } =
useManifestState();

const { showBoundary } = useErrorBoundary();
Expand Down Expand Up @@ -128,7 +128,16 @@ const StructuredNavigation = () => {
} else if (canvasIsEmptyRef.current) {
// Reset isClicked in state for
// inaccessible items (empty canvases)
playerDispatch({ type: 'resetClick' });
playerDispatch({
type: 'resetClick',
});
// Ensure autoplay from inaccessible items in playlists
if (playlist) {
playerDispatch({
isPlaying: autoAdvance,
type: 'setPlayingStatus',
})
}
}
}
}, [isClicked, player]);
Expand Down

0 comments on commit 88cbad2

Please sign in to comment.