mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-26 18:38:18 +01:00
fix stuff :3
This commit is contained in:
parent
fc08e94049
commit
f124efc8e3
1 changed files with 24 additions and 12 deletions
|
@ -741,6 +741,7 @@ background-color: #0000;
|
||||||
document.getElementById("buffer-failed-warning").style.display = "block";
|
document.getElementById("buffer-failed-warning").style.display = "block";
|
||||||
}
|
}
|
||||||
let canPlayPause = true;
|
let canPlayPause = true;
|
||||||
|
let didFirstTimePlay = false;
|
||||||
document.addEventListener("DOMContentLoaded", () => {
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
//FIXME: saved playback intentionally overwritten
|
//FIXME: saved playback intentionally overwritten
|
||||||
localStorage.setItem(`progress-${new URLSearchParams(window.location.search).get('v')}`, 0);
|
localStorage.setItem(`progress-${new URLSearchParams(window.location.search).get('v')}`, 0);
|
||||||
|
@ -804,6 +805,24 @@ background-color: #0000;
|
||||||
video.currentTime > aud.currentTime ? aud.currentTime = video.currentTime : video.currentTime = aud.currentTime;
|
video.currentTime > aud.currentTime ? aud.currentTime = video.currentTime : video.currentTime = aud.currentTime;
|
||||||
playPauseButton.innerHTML = pauseSVG;
|
playPauseButton.innerHTML = pauseSVG;
|
||||||
});
|
});
|
||||||
|
setTimeout(()=>{
|
||||||
|
if(!didFirstTimePlay) {
|
||||||
|
video.addEventListener("seeked", (event) => {
|
||||||
|
setTimeout(()=>{
|
||||||
|
canPlayPause = true;
|
||||||
|
if(video.currentTime==0||aud.currentTime==0) return;
|
||||||
|
video.pause(); aud.pause(); playPauseButton.innerHTML = playSVG;
|
||||||
|
},1)
|
||||||
|
});
|
||||||
|
aud.addEventListener("seeked", (event) => {
|
||||||
|
setTimeout(()=>{
|
||||||
|
if(video.currentTime==0||aud.currentTime==0) return;
|
||||||
|
video.pause(); aud.pause(); playPauseButton.innerHTML = playSVG;
|
||||||
|
},1)
|
||||||
|
});
|
||||||
|
didFirstTimePlay = true;
|
||||||
|
}
|
||||||
|
},100)
|
||||||
document.addEventListener("fullscreenchange", function() {
|
document.addEventListener("fullscreenchange", function() {
|
||||||
if(document.fullscreen) {
|
if(document.fullscreen) {
|
||||||
video.controlsList = "noplaybackrate nodownload"
|
video.controlsList = "noplaybackrate nodownload"
|
||||||
|
@ -840,21 +859,14 @@ background-color: #0000;
|
||||||
seekbar.max = video.duration
|
seekbar.max = video.duration
|
||||||
const timestamps = document.getElementById("timestamps");
|
const timestamps = document.getElementById("timestamps");
|
||||||
timestamps.innerText = `${csts(video.currentTime)}/${csts(video.duration)}`;
|
timestamps.innerText = `${csts(video.currentTime)}/${csts(video.duration)}`;
|
||||||
video.addEventListener("seeked", (event) => {
|
|
||||||
setTimeout(()=>{
|
|
||||||
canPlayPause = true;
|
|
||||||
video.pause(); aud.pause(); playPauseButton.innerHTML = playSVG;
|
|
||||||
},1)
|
|
||||||
});
|
|
||||||
aud.addEventListener("seeked", (event) => {
|
|
||||||
setTimeout(()=>{
|
|
||||||
video.pause(); aud.pause(); playPauseButton.innerHTML = playSVG;
|
|
||||||
},1)
|
|
||||||
});
|
|
||||||
// Show controls
|
// Show controls
|
||||||
try {
|
try {
|
||||||
|
playPauseButton.innerHTML = pauseSVG;
|
||||||
vid.play();
|
vid.play();
|
||||||
aud.play();
|
aud.play();
|
||||||
|
didFirstTimePlay = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
catch {}
|
catch {}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue