fix various syncing issues
This commit is contained in:
parent
3fd24a16f8
commit
53a29d27ea
1 changed files with 5 additions and 7 deletions
12
src/main.ts
12
src/main.ts
|
@ -168,13 +168,10 @@ function syncAllVideos(
|
|||
relativeTime + videos[Number(videoElement.dataset.index)].syncPoint;
|
||||
|
||||
if (syncedTime < 0) {
|
||||
videoElement.currentTime = 0;
|
||||
videoElement.pause();
|
||||
} else if (
|
||||
syncedTime >
|
||||
videoElement.duration -
|
||||
videos[Number(videoElement.dataset.index)].syncPoint
|
||||
) {
|
||||
videoElement.currentTime = 0;
|
||||
} else if (syncedTime > videoElement.duration) {
|
||||
videoElement.pause();
|
||||
videoElement.currentTime = videoElement.duration;
|
||||
} else {
|
||||
videoElement.currentTime = syncedTime;
|
||||
|
@ -194,7 +191,8 @@ function onTimeUpdate(event: Event) {
|
|||
for (const videoElement of videoElements) {
|
||||
if (
|
||||
videoElement.paused &&
|
||||
relativeTime + videos[Number(videoElement.dataset.index)].syncPoint > 0
|
||||
relativeTime + videos[Number(videoElement.dataset.index)].syncPoint > 0 &&
|
||||
videoElement.currentTime < videoElement.duration - 1
|
||||
) {
|
||||
console.log(
|
||||
"Reached sync point for",
|
||||
|
|
Loading…
Add table
Reference in a new issue