Use markers to implement timestamps

This commit is contained in:
broquemonsieur
2023-08-05 02:53:36 -07:00
parent d7a53d0159
commit 472a2d7e76
5 changed files with 72 additions and 40 deletions

View File

@@ -200,13 +200,20 @@ if (!video_data.params.listen && video_data.vr && video_data.params.vr_mode) {
// Add markers
if (video_data.params.video_start > 0 || video_data.params.video_end > 0) {
var markers = [{ time: video_data.params.video_start, text: 'Start' }];
if (video_data.params.video_end < 0) {
markers.push({ time: video_data.length_seconds - 0.5, text: 'End' });
} else {
markers.push({ time: video_data.params.video_end, text: 'End' });
if (video_data.starting_timestamp_seconds) {
markers = [{ time: video_data.starting_timestamp_seconds, text: 'Start' }];
}
if (!video_data.ending_timestamp_seconds) {
if (video_data.params.video_end < 0) {
markers.push({ time: video_data.length_seconds - 0.5, text: 'End' });
} else {
markers.push({ time: video_data.params.video_end, text: 'End' });
}
} else {
markers.push({ time: video_data.ending_timestamp_seconds, text: 'End' });
}
player.markers({
onMarkerReached: function (marker) {
if (marker.text === 'End')