@@ -525,6 +525,15 @@ export const useIO = create<IOStore>((set, get) => ({
525
525
const { saveAnyFile } = get ( )
526
526
console . log ( `rendering project using the embedded FFmpeg..` )
527
527
528
+ const task = useTasks . getState ( ) . add ( {
529
+ category : TaskCategory . EXPORT ,
530
+ visibility : TaskVisibility . BLOCKER ,
531
+ initialMessage : `Rendering the project to MP4..` ,
532
+ successMessage : `Successfully exported the MP4 video!` ,
533
+ value : 0 ,
534
+ } )
535
+
536
+ try {
528
537
const timeline : TimelineStore = useTimeline . getState ( )
529
538
530
539
const {
@@ -540,14 +549,6 @@ export const useIO = create<IOStore>((set, get) => ({
540
549
throw new Error ( `cannot save a clap.. if there is no clap` )
541
550
}
542
551
543
- const task = useTasks . getState ( ) . add ( {
544
- category : TaskCategory . EXPORT ,
545
- visibility : TaskVisibility . BLOCKER ,
546
- initialMessage : `Rendering the project to MP4..` ,
547
- successMessage : `Successfully exported the MP4 video!` ,
548
- value : 0 ,
549
- } )
550
-
551
552
const ignoreThisVideoSegmentId = ( await getFinalVideo ( clap ) ) ?. id || ''
552
553
553
554
const segments : ExportableSegment [ ] = timelineSegments
@@ -633,6 +634,10 @@ export const useIO = create<IOStore>((set, get) => ({
633
634
const videoBlob = new Blob ( [ fullVideo ] , { type : 'video/mp4' } )
634
635
saveAnyFile ( videoBlob , 'my_project.mp4' )
635
636
task . success ( )
637
+ } catch ( err ) {
638
+ console . error ( err )
639
+ task . fail ( `${ err || 'unknown error' } ` )
640
+ }
636
641
} ,
637
642
638
643
saveZipFile : async ( ) => {
0 commit comments