mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-22 21:17:58 +01:00
lemme test this
This commit is contained in:
parent
ad0c20300b
commit
e143dcb450
1 changed files with 12 additions and 10 deletions
|
@ -1790,12 +1790,13 @@ const AMvideo = document.getElementById("video")
|
||||||
const canvas = document.getElementById("ambient-canvas")
|
const canvas = document.getElementById("ambient-canvas")
|
||||||
const ctx = canvas.getContext("2d")
|
const ctx = canvas.getContext("2d")
|
||||||
|
|
||||||
let step
|
let step;
|
||||||
|
|
||||||
const draw = () => {
|
const draw = () => {
|
||||||
ctx.drawImage(video, 0, 0, canvas.width, canvas.height)
|
if (AMvideo.readyState >= 2) { // Check if video is playable (HAVE_CURRENT_DATA or greater)
|
||||||
}
|
ctx.drawImage(AMvideo, 0, 0, canvas.width, canvas.height);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const drawLoop = () => {
|
const drawLoop = () => {
|
||||||
draw()
|
draw()
|
||||||
|
@ -1808,12 +1809,13 @@ const drawPause = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const init = () => {
|
const init = () => {
|
||||||
AMvideo.addEventListener("loadeddata", draw, false)
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
AMvideo.addEventListener("seeked", draw, false)
|
AMvideo.addEventListener("canplaythrough", draw, false);
|
||||||
AMvideo.addEventListener("play", drawLoop, false)
|
AMvideo.addEventListener("play", drawLoop, false);
|
||||||
AMvideo.addEventListener("pause", drawPause, false)
|
AMvideo.addEventListener("pause", drawPause, false);
|
||||||
AMvideo.addEventListener("ended", drawPause, false)
|
AMvideo.addEventListener("ended", drawPause, false);
|
||||||
}
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const cleanup = () => {
|
const cleanup = () => {
|
||||||
AMvideo.removeEventListener("loadeddata", draw)
|
AMvideo.removeEventListener("loadeddata", draw)
|
||||||
|
|
Loading…
Reference in a new issue