From b1bdb3405fbb7945bf5931210899bc81dd969ecb Mon Sep 17 00:00:00 2001 From: Mauro Teixeira Date: Mon, 14 Nov 2022 16:41:45 +0100 Subject: [PATCH] waited for canplay event before playing after seek --- src/VideoPlayer/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/VideoPlayer/index.js b/src/VideoPlayer/index.js index ee6a807..c6a56e4 100644 --- a/src/VideoPlayer/index.js +++ b/src/VideoPlayer/index.js @@ -69,7 +69,8 @@ const hooks = { state.playing = false }, seeked() { - state.playAfterSeek === true && videoPlayerPlugin.play() + state.playAfterSeek && + videoEl.addEventListener('canplay', () => videoPlayerPlugin.play(), { once: true }) state.playAfterSeek = null }, abort() { @@ -442,7 +443,10 @@ const videoPlayerPlugin = { export default autoSetupMixin(videoPlayerPlugin, () => { precision = - (ApplicationInstance && ApplicationInstance.stage && ApplicationInstance.stage.getRenderPrecision()) || precision + (ApplicationInstance && + ApplicationInstance.stage && + ApplicationInstance.stage.getRenderPrecision()) || + precision videoEl = setupVideoTag()