From 81278fee8bd164f5194ba279eb2f6ba0de10e5dc Mon Sep 17 00:00:00 2001 From: Morten Barklund Date: Mon, 25 Jul 2022 17:19:14 +0200 Subject: [PATCH 1/2] Editor: Fixed delay before trimming a new recording --- packages/story-editor/src/components/videoTrim/useVideoNode.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/story-editor/src/components/videoTrim/useVideoNode.js b/packages/story-editor/src/components/videoTrim/useVideoNode.js index ff5f04dd0620..f308a4019075 100644 --- a/packages/story-editor/src/components/videoTrim/useVideoNode.js +++ b/packages/story-editor/src/components/videoTrim/useVideoNode.js @@ -122,7 +122,8 @@ function useVideoNode(videoData) { if (isFinite(videoNode.duration) && startOffset === null) { onLoadedMetadata({ target: videoNode }); } else if (!isFinite(videoNode.duration)) { - // Video is a blob of unknown length, wait until it finishes + // Video is a blob of unknown length, seek to infinity and wait until it's ready + videoNode.currentTime = Number.MAX_SAFE_INTEGER; videoNode.addEventListener('timeupdate', onLoadedMetadata); } else { // Video hasn't loaded yet, wait for that From 616905e27fc11173bae513f19160217f352db987 Mon Sep 17 00:00:00 2001 From: Morten Barklund Date: Mon, 25 Jul 2022 18:09:06 +0200 Subject: [PATCH 2/2] Added comment to chromium bug --- packages/story-editor/src/components/videoTrim/useVideoNode.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/story-editor/src/components/videoTrim/useVideoNode.js b/packages/story-editor/src/components/videoTrim/useVideoNode.js index f308a4019075..0e93322515a3 100644 --- a/packages/story-editor/src/components/videoTrim/useVideoNode.js +++ b/packages/story-editor/src/components/videoTrim/useVideoNode.js @@ -123,6 +123,7 @@ function useVideoNode(videoData) { onLoadedMetadata({ target: videoNode }); } else if (!isFinite(videoNode.duration)) { // Video is a blob of unknown length, seek to infinity and wait until it's ready + // @see https://crbug.com/642012 videoNode.currentTime = Number.MAX_SAFE_INTEGER; videoNode.addEventListener('timeupdate', onLoadedMetadata); } else {