Skip to content

Create polished demo videos without editing skills. Mac/Windows/Linux

fix(editor): wait for drawable webcam crop frames

wiiiii1238baae57d8ce4
diff --git a/src/components/video-editor/VideoPlayback.tsx b/src/components/video-editor/VideoPlayback.tsx
index 2c7499d0..ae373b16 100644
--- a/src/components/video-editor/VideoPlayback.tsx
+++ b/src/components/video-editor/VideoPlayback.tsx
@@ -1440,7 +1440,7 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
const handleWebcamMediaReady = useCallback(
(event: React.SyntheticEvent<HTMLVideoElement>) => {
const video = event.currentTarget;
- if (video.videoWidth > 0 && video.videoHeight > 0) {
+ if (video.videoWidth > 0 && video.videoHeight > 0 && video.readyState >= 2) {
setWebcamVideoDimensions({
width: video.videoWidth,
height: video.videoHeight,
diff --git a/src/components/video-editor/WebcamCropControl.tsx b/src/components/video-editor/WebcamCropControl.tsx
index 0d727172..6cbb3ca9 100644
--- a/src/components/video-editor/WebcamCropControl.tsx
+++ b/src/components/video-editor/WebcamCropControl.tsx
@@ -264,7 +264,7 @@ export function WebcamCropControl({
const handlePreviewFrameReady = useCallback(() => {
const video = previewVideoRef.current;
- if (video && video.videoWidth > 0 && video.videoHeight > 0) {
+ if (video && video.videoWidth > 0 && video.videoHeight > 0 && video.readyState >= 2) {
setPreviewFrame({
src: previewSrc,
width: video.videoWidth,
diff --git a/src/components/video-editor/projectPersistence.ts b/src/components/video-editor/projectPersistence.ts
index ced2440c..9f95706b 100644
--- a/src/components/video-editor/projectPersistence.ts
+++ b/src/components/video-editor/projectPersistence.ts
@@ -57,8 +57,8 @@ import {
DEFAULT_ZOOM_IN_EASING,
DEFAULT_ZOOM_IN_OVERLAP_MS,
DEFAULT_ZOOM_MOTION_BLUR,
- DEFAULT_ZOOM_SMOOTHNESS,
DEFAULT_ZOOM_OUT_EASING,
+ DEFAULT_ZOOM_SMOOTHNESS,
getDefaultCaptionFontFamily,
type Padding,
type SpeedRegion,