Time out videos taking too long to start

This commit is contained in:
Max Goodhart
2020-11-12 00:13:33 -08:00
parent 6312081477
commit 17f2d80282

View File

@@ -234,7 +234,10 @@ async function findVideo(kind) {
const videoReady = new Promise((resolve) =>
video.addEventListener('playing', resolve, { once: true }),
)
await videoReady
await Promise.race([videoReady, sleep(10 * 1000)])
if (!video.videoWidth) {
throw new Error('timeout waiting for video to start')
}
console.log('video started')
}