synchronize seeks
This commit is contained in:
parent
5725ace006
commit
51640f1672
1 changed files with 20 additions and 0 deletions
|
@ -30,6 +30,14 @@
|
|||
}
|
||||
}
|
||||
|
||||
function synchronize(what) {
|
||||
if (what == "audio") {
|
||||
audioPlayer.seekTo(videoPlayer.getCurrentTime(), true);
|
||||
} else {
|
||||
videoPlayer.seekTo(audioPlayer.getCurrentTime(), true);
|
||||
}
|
||||
}
|
||||
|
||||
async function init() {
|
||||
const currentResult = await fetch("grid.php");
|
||||
if (!currentResult.ok) {
|
||||
|
@ -51,6 +59,12 @@
|
|||
onReady: () => {
|
||||
videoReady = true;
|
||||
},
|
||||
onStateChange: (ev) => {
|
||||
// Paused
|
||||
if (ev.data == 2) {
|
||||
synchronize("audio");
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -65,6 +79,12 @@
|
|||
onReady: () => {
|
||||
audioReady = true;
|
||||
},
|
||||
onStateChange: (ev) => {
|
||||
// Paused
|
||||
if (ev.data == 2) {
|
||||
synchronize("video");
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue