mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-10 09:58:26 +01:00
remove broken code
This commit is contained in:
parent
97bb31f304
commit
913ccef4a7
1 changed files with 17 additions and 37 deletions
|
@ -743,11 +743,9 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||||
localStorage.setItem(`progress-${new URLSearchParams(window.location.search).get('v')}`, 0);
|
localStorage.setItem(`progress-${new URLSearchParams(window.location.search).get('v')}`, 0);
|
||||||
// Controls and high-res playback
|
// Controls and high-res playback
|
||||||
//TODO - a
|
//TODO - a
|
||||||
let setTime = false;
|
let setTime = false
|
||||||
const seekbar = document.getElementById("duration-slider");
|
const seekbar = document.getElementById("duration-slider")
|
||||||
const video = document.getElementById("video");
|
const video = document.getElementById("video");
|
||||||
const aud = document.getElementById("aud");
|
|
||||||
|
|
||||||
video.addEventListener("timeupdate", (event) => {
|
video.addEventListener("timeupdate", (event) => {
|
||||||
seekbar.value = event.target.currentTime;
|
seekbar.value = event.target.currentTime;
|
||||||
const timestamps = document.getElementById("timestamps");
|
const timestamps = document.getElementById("timestamps");
|
||||||
|
@ -766,7 +764,6 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||||
// Play/Pause
|
// Play/Pause
|
||||||
const playPauseButton = document.getElementById("play-pause");
|
const playPauseButton = document.getElementById("play-pause");
|
||||||
playPauseButton.innerHTML = pauseSVG;
|
playPauseButton.innerHTML = pauseSVG;
|
||||||
|
|
||||||
function toggleVideo() {
|
function toggleVideo() {
|
||||||
if (document.getElementById("popupMenu").style.display == "none") {
|
if (document.getElementById("popupMenu").style.display == "none") {
|
||||||
if (!document.fullscreen) {
|
if (!document.fullscreen) {
|
||||||
|
@ -788,17 +785,13 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||||
document.getElementById("popupMenu").style.display = "none";
|
document.getElementById("popupMenu").style.display = "none";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
playPauseButton.addEventListener("click", () => {
|
playPauseButton.addEventListener("click", () => {
|
||||||
toggleVideo();
|
toggleVideo();
|
||||||
});
|
});
|
||||||
|
|
||||||
video.addEventListener("click", toggleVideo);
|
video.addEventListener("click", toggleVideo);
|
||||||
|
|
||||||
video.addEventListener("dblclick", () => {
|
video.addEventListener("dblclick", () => {
|
||||||
document.documentElement.requestFullscreen();
|
document.documentElement.requestFullscreen();
|
||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById("muteOption").addEventListener("click", () => {
|
document.getElementById("muteOption").addEventListener("click", () => {
|
||||||
if (qua != "medium") {
|
if (qua != "medium") {
|
||||||
aud.volume == 0 ? aud.volume = 1 : aud.volume = 0;
|
aud.volume == 0 ? aud.volume = 1 : aud.volume = 0;
|
||||||
|
@ -806,14 +799,12 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||||
video.volume == 0 ? video.volume = 1 : video.volume = 0;
|
video.volume == 0 ? video.volume = 1 : video.volume = 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById("syncOption").addEventListener("click", () => {
|
document.getElementById("syncOption").addEventListener("click", () => {
|
||||||
video.pause();
|
video.pause();
|
||||||
aud.pause();
|
aud.pause();
|
||||||
playPauseButton.innerHTML = playSVG;
|
playPauseButton.innerHTML = playSVG;
|
||||||
video.currentTime > aud.currentTime ? aud.currentTime = video.currentTime : video.currentTime = aud.currentTime;
|
video.currentTime > aud.currentTime ? aud.currentTime = video.currentTime : video.currentTime = aud.currentTime;
|
||||||
});
|
});
|
||||||
|
|
||||||
document.addEventListener("fullscreenchange", function() {
|
document.addEventListener("fullscreenchange", function() {
|
||||||
if (document.fullscreen) {
|
if (document.fullscreen) {
|
||||||
video.controlsList = "noplaybackrate nodownload";
|
video.controlsList = "noplaybackrate nodownload";
|
||||||
|
@ -828,12 +819,10 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||||
video.controls = false;
|
video.controls = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
video.addEventListener("fullscreenchange", () => {
|
video.addEventListener("fullscreenchange", () => {
|
||||||
video.fullscreen = false;
|
video.fullscreen = false;
|
||||||
document.exitFullscreen();
|
document.exitFullscreen();
|
||||||
});
|
});
|
||||||
|
|
||||||
video.addEventListener("contextmenu", (event) => {
|
video.addEventListener("contextmenu", (event) => {
|
||||||
if (document.fullscreen) {
|
if (document.fullscreen) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
@ -848,18 +837,6 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
video.addEventListener("waiting", () => {
|
|
||||||
if (qua != "medium") {
|
|
||||||
aud.pause();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
video.addEventListener("playing", () => {
|
|
||||||
if (qua != "medium" && !video.paused) {
|
|
||||||
aud.play();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function startPlayback() {
|
function startPlayback() {
|
||||||
// Final prepare
|
// Final prepare
|
||||||
seekbar.max = video.duration;
|
seekbar.max = video.duration;
|
||||||
|
@ -903,29 +880,32 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
let shouldPlay = 0;
|
let shouldPlay = 0;
|
||||||
|
const aud = document.getElementById("aud");
|
||||||
|
const vid = document.getElementById("video");
|
||||||
|
|
||||||
function checkReadyState() {
|
function checkReadyState() {
|
||||||
if (video.readyState >= 3) { // HAVE_FUTURE_DATA or higher
|
if (vid.readyState >= 3) { // HAVE_FUTURE_DATA or higher
|
||||||
if (aud.readyState < 3) {
|
if (aud.readyState < 3) {
|
||||||
aud.load(); // load the audio if not ready
|
aud.load(); // load the audio if not ready
|
||||||
}
|
}
|
||||||
|
if (vid.readyState >= 3 && aud.readyState >= 3) {
|
||||||
|
startPlayback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vid.addEventListener("canplay", () => {
|
||||||
|
shouldPlay++;
|
||||||
|
if (shouldPlay >= 2) {
|
||||||
|
checkReadyState();
|
||||||
|
shouldPlay = 0;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
aud.addEventListener("canplay", () => {
|
aud.addEventListener("canplay", () => {
|
||||||
shouldPlay++;
|
shouldPlay++;
|
||||||
if (shouldPlay >= 2) {
|
if (shouldPlay >= 2) {
|
||||||
checkReadyState();
|
checkReadyState();
|
||||||
startPlayback();
|
|
||||||
shouldPlay = 0;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
video.addEventListener("canplay", () => {
|
|
||||||
shouldPlay++;
|
|
||||||
if (shouldPlay >= 2) {
|
|
||||||
checkReadyState();
|
|
||||||
startPlayback();
|
|
||||||
shouldPlay = 0;
|
shouldPlay = 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue