Skip to content

Create professional demos and 3D mockups in seconds, directly in your browser

feat: integrate clearVideoTrack function to manage video uploads and cleanup

CristianOlivera1887aaa79b99d
diff --git a/app/[locale]/(editor)/editor/page.tsx b/app/[locale]/(editor)/editor/page.tsx
index 80cc549..58d13a8 100644
--- a/app/[locale]/(editor)/editor/page.tsx
+++ b/app/[locale]/(editor)/editor/page.tsx
@@ -3187,6 +3187,7 @@ export default function Editor() {
onImageUpload={handleImageUploadToCanvas}
onScreenCapture={handleScreenCapture}
isCapturing={isCapturing}
+ hasCamera={!!effectiveCameraUrl}
/>
</div>
diff --git a/app/components/ui/home/Hero.tsx b/app/components/ui/home/Hero.tsx
index 141f6db..e48dbdd 100644
--- a/app/components/ui/home/Hero.tsx
+++ b/app/components/ui/home/Hero.tsx
@@ -2,7 +2,7 @@
import { Icon } from "@iconify/react";
import { useRef, useState, useCallback } from "react";
import { useRouter } from "next/navigation";
-import { saveUploadedVideo } from "@/lib/video-upload-cache";
+import { saveUploadedVideo, clearVideoTrack } from "@/lib/video-upload-cache";
import { saveUploadedImage } from "@/lib/image-upload-cache";
import { useTranslations } from "next-intl";
import Link from "next/link";
@@ -27,6 +27,7 @@ export default function Hero({ onVideoUpload, onPhotoUpload }: HeroProps) {
setIsUploadingVideo(true);
try {
await saveUploadedVideo(file);
+ await clearVideoTrack();
if (onVideoUpload) {
onVideoUpload(file);
}
diff --git a/hooks/useScreenRecording.ts b/hooks/useScreenRecording.ts
index 84facd9..686cbbc 100644
--- a/hooks/useScreenRecording.ts
+++ b/hooks/useScreenRecording.ts
@@ -7,6 +7,7 @@ import type { CameraConfig, RecordingSetupConfig } from "@/types/camera.types";
import { DEFAULT_RECORDING_SETUP, requestCameraStream, requestMicrophoneStream } from "@/types/camera.types";
import { clearAllThumbnailCache } from "@/lib/thumbnail-cache";
import { convertToMp4 } from "@/lib/video-conversion";
+import { clearVideoTrack } from "@/lib/video-upload-cache";
export type { RecordingState, RecordingResult, VideoData, RecordingContextType };
@@ -387,10 +388,7 @@ export function useScreenRecording() {
cameraBlob,
cameraConfig: cameraConfigRef.current,
});
- await saveVideoToIndexedDB(finalMp4Blob, duration, {
- cameraBlob,
- cameraConfig: cameraConfigRef.current,
- });
+ await clearVideoTrack();
if (pathname === "/editor") {
window.location.reload();
} else {