use oncanplay instead of timeout

pull/54/head
Bettina Steger 2021-05-27 14:21:09 +02:00
parent b12488feaf
commit 6db3b813a8
1 changed files with 1 additions and 3 deletions

View File

@ -5,9 +5,7 @@ export function bufferToVideo(buf: Blob): Promise<HTMLVideoElement> {
if (!(buf instanceof Blob)) reject(new Error('bufferToVideo - expected buf to be of type: Blob')); if (!(buf instanceof Blob)) reject(new Error('bufferToVideo - expected buf to be of type: Blob'));
const video = env.getEnv().createVideoElement(); const video = env.getEnv().createVideoElement();
video.onloadstart = () => { video.oncanplay = () => resolve(video);
setTimeout(() => resolve(video), 100);
};
video.onerror = reject; video.onerror = reject;
video.type = buf.type; video.type = buf.type;
video.playsInline = true; video.playsInline = true;