Skip to content

Commit

Permalink
Merge pull request #716 from samvera-labs/marker-click
Browse files Browse the repository at this point in the history
Restrict setting player time when markers are outside of playable range
  • Loading branch information
Dananji authored Nov 5, 2024
2 parents 0cb1d18 + fb57caa commit 25ddbce
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/components/MarkersDisplay/MarkerUtils/MarkerRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,20 @@ const MarkerRow = ({
e.preventDefault();
const currentTime = parseFloat(e.target.dataset['offset']);
if (player) {
player.currentTime(currentTime);
const { start, end } = player.targets[0];
switch (true) {
case currentTime >= start && currentTime <= end:
player.currentTime(currentTime);
break;
case currentTime < start:
player.currentTime(start);
break;
case currentTime > end:
player.currentTime(end);
break;
default:
break;
}
}
}, [player]);

Expand Down

0 comments on commit 25ddbce

Please sign in to comment.