Skip to content

Commit

Permalink
fix(entry): added timeout for video check
Browse files Browse the repository at this point in the history
  • Loading branch information
ThornWalli committed Dec 16, 2024
1 parent 962bf07 commit 8ae386a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/runtime/utils/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8ae386a

Please sign in to comment.