From 8ae386a2992ab94f3dd2a840ae6b9223ea70bd4a Mon Sep 17 00:00:00 2001 From: Thorn Walli Date: Mon, 16 Dec 2024 12:21:09 +0100 Subject: [PATCH] fix(entry): added timeout for video check --- src/runtime/utils/entry.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/runtime/utils/entry.js b/src/runtime/utils/entry.js index 4f311c0053..1bf5ac1ebc 100644 --- a/src/runtime/utils/entry.js +++ b/src/runtime/utils/entry.js @@ -111,7 +111,13 @@ export const canVideoPlay = async blob => { video.muted = true; video.playsinline = true; video.src = objectUrl; - await video.play(); + + const { resolve, promise } = Promise.withResolvers(); + const timeout = window.setTimeout(resolve, 500); + + await Promise.race([video.play(), promise]); + window.clearTimeout(timeout); + URL.revokeObjectURL(objectUrl); } catch (error) { URL.revokeObjectURL(objectUrl);