Work around bug waiting for Twitch playback start

This commit is contained in:
Max Goodhart
2020-11-09 17:00:36 -08:00
parent f49e52f09d
commit 4f493c6906

View File

@@ -209,15 +209,16 @@ async function findVideo(kind) {
document.body.appendChild(video)
}
video.play()
if (!video.videoWidth) {
// TODO: figure out why 'playing' event doesn't fire on Twitch when video offscreen
const videoReady = new Promise((resolve) =>
video.addEventListener('canplay', resolve, { once: true }),
video.addEventListener('play', resolve, { once: true }),
)
await videoReady
}
video.play()
const info = {
title: document.title,
}