@@ -39,7 +39,7 @@ pub enum InProgressRecording {
39
39
Instant {
40
40
target_name : String ,
41
41
handle : instant_recording:: ActorHandle ,
42
- progressive_upload : Option < InstantMultipartUpload > ,
42
+ progressive_upload : InstantMultipartUpload ,
43
43
video_upload_info : VideoUploadInfo ,
44
44
inputs : StartRecordingInputs ,
45
45
recording_dir : PathBuf ,
@@ -132,7 +132,7 @@ pub enum CompletedRecording {
132
132
Instant {
133
133
recording : instant_recording:: CompletedRecording ,
134
134
target_name : String ,
135
- progressive_upload : Option < InstantMultipartUpload > ,
135
+ progressive_upload : InstantMultipartUpload ,
136
136
video_upload_info : VideoUploadInfo ,
137
137
} ,
138
138
Studio {
@@ -339,22 +339,11 @@ pub async fn start_recording(
339
339
}
340
340
341
341
let ( finish_upload_tx, finish_upload_rx) = flume:: bounded ( 1 ) ;
342
- let progressive_upload = video_upload_info
343
- . as_ref ( )
344
- . filter ( |_| matches ! ( inputs. mode, RecordingMode :: Instant ) )
345
- . map ( |video_upload_info| {
346
- InstantMultipartUpload :: spawn (
347
- app. clone ( ) ,
348
- id. clone ( ) ,
349
- recording_dir. join ( "content/output.mp4" ) ,
350
- video_upload_info. clone ( ) ,
351
- Some ( finish_upload_rx) ,
352
- )
353
- } ) ;
354
342
355
343
debug ! ( "spawning start_recording actor" ) ;
356
344
357
345
// done in spawn to catch panics just in case
346
+ let app_handle = app. clone ( ) ;
358
347
let spawn_actor_res = async {
359
348
spawn_actor ( {
360
349
let state_mtx = Arc :: clone ( & state_mtx) ;
@@ -417,6 +406,14 @@ pub async fn start_recording(
417
406
return Err ( "Video upload info not found" . to_string ( ) ) ;
418
407
} ;
419
408
409
+ let progressive_upload = InstantMultipartUpload :: spawn (
410
+ app_handle,
411
+ id. clone ( ) ,
412
+ recording_dir. join ( "content/output.mp4" ) ,
413
+ video_upload_info. clone ( ) ,
414
+ Some ( finish_upload_rx) ,
415
+ ) ;
416
+
420
417
let mut builder = instant_recording:: Actor :: builder (
421
418
recording_dir. clone ( ) ,
422
419
inputs. capture_target . clone ( ) ,
@@ -757,77 +754,77 @@ async fn handle_recording_finish(
757
754
let video_upload_info = video_upload_info. clone ( ) ;
758
755
759
756
async move {
760
- if let Some ( progressive_upload) = progressive_upload {
761
- let video_upload_succeeded = match progressive_upload
762
- . handle
763
- . await
764
- . map_err ( |e| e. to_string ( ) )
765
- . and_then ( |r| r)
757
+ // if let Some(progressive_upload) = progressive_upload {
758
+ let video_upload_succeeded = match progressive_upload
759
+ . handle
760
+ . await
761
+ . map_err ( |e| e. to_string ( ) )
762
+ . and_then ( |r| r)
763
+ {
764
+ Ok ( ( ) ) => {
765
+ info ! (
766
+ "Not attempting instant recording upload as progressive upload succeeded"
767
+ ) ;
768
+ true
769
+ }
770
+ Err ( e) => {
771
+ error ! ( "Progressive upload failed: {}" , e) ;
772
+ false
773
+ }
774
+ } ;
775
+
776
+ let _ = screenshot_task. await ;
777
+
778
+ if video_upload_succeeded {
779
+ // let resp = prepare_screenshot_upload(
780
+ // &app,
781
+ // &video_upload_info.config.clone(),
782
+ // display_screenshot,
783
+ // )
784
+ // .await;
785
+
786
+ // match resp {
787
+ // Ok(r)
788
+ // if r.status().as_u16() >= 200 && r.status().as_u16() < 300 =>
789
+ // {
790
+ // info!("Screenshot uploaded successfully");
791
+ // }
792
+ // Ok(r) => {
793
+ // error!("Failed to upload screenshot: {}", r.status());
794
+ // }
795
+ // Err(e) => {
796
+ // error!("Failed to upload screenshot: {e}");
797
+ // }
798
+ // }
799
+ todo ! ( ) ;
800
+ } else {
801
+ if let Ok ( meta) = build_video_meta ( & output_path)
802
+ . map_err ( |err| error ! ( "Error getting video metdata: {}" , err) )
766
803
{
767
- Ok ( ( ) ) => {
768
- info ! (
769
- "Not attempting instant recording upload as progressive upload succeeded"
770
- ) ;
771
- true
772
- }
773
- Err ( e) => {
774
- error ! ( "Progressive upload failed: {}" , e) ;
775
- false
776
- }
777
- } ;
778
-
779
- let _ = screenshot_task. await ;
780
-
781
- if video_upload_succeeded {
782
- // let resp = prepare_screenshot_upload(
783
- // &app,
784
- // &video_upload_info.config.clone(),
785
- // display_screenshot,
786
- // )
787
- // .await;
788
-
789
- // match resp {
790
- // Ok(r)
791
- // if r.status().as_u16() >= 200 && r.status().as_u16() < 300 =>
792
- // {
793
- // info!("Screenshot uploaded successfully");
794
- // }
795
- // Ok(r) => {
796
- // error!("Failed to upload screenshot: {}", r.status());
797
- // }
798
- // Err(e) => {
799
- // error!("Failed to upload screenshot: {e}");
800
- // }
801
- // }
802
- todo ! ( ) ;
803
- } else {
804
- if let Ok ( meta) = build_video_meta ( & output_path)
805
- . map_err ( |err| error ! ( "Error getting video metdata: {}" , err) )
804
+ // The upload_video function handles screenshot upload, so we can pass it along
805
+ match upload_video (
806
+ & app,
807
+ video_upload_info. id . clone ( ) ,
808
+ output_path,
809
+ display_screenshot. clone ( ) ,
810
+ video_upload_info. config . clone ( ) ,
811
+ meta,
812
+ None ,
813
+ )
814
+ . await
806
815
{
807
- // The upload_video function handles screenshot upload, so we can pass it along
808
- match upload_video (
809
- & app,
810
- video_upload_info. id . clone ( ) ,
811
- output_path,
812
- display_screenshot. clone ( ) ,
813
- video_upload_info. config . clone ( ) ,
814
- meta,
815
- None ,
816
- )
817
- . await
818
- {
819
- Ok ( _) => {
820
- info ! (
821
- "Final video upload with screenshot completed successfully"
822
- )
823
- }
824
- Err ( e) => {
825
- error ! ( "Error in final upload with screenshot: {}" , e)
826
- }
816
+ Ok ( _) => {
817
+ info ! (
818
+ "Final video upload with screenshot completed successfully"
819
+ )
820
+ }
821
+ Err ( e) => {
822
+ error ! ( "Error in final upload with screenshot: {}" , e)
827
823
}
828
824
}
829
825
}
830
826
}
827
+ // }
831
828
}
832
829
} ) ;
833
830
0 commit comments