@@ -9,7 +9,10 @@ use cap_recording::{
99 RecordingError , RecordingMode ,
1010 feeds:: { camera, microphone} ,
1111 instant_recording,
12- sources:: { CaptureDisplay , CaptureWindow , ScreenCaptureTarget , screen_capture} ,
12+ sources:: {
13+ screen_capture,
14+ screen_capture:: { CaptureDisplay , CaptureWindow , ScreenCaptureTarget } ,
15+ } ,
1316 studio_recording,
1417} ;
1518use cap_rendering:: ProjectRecordingsMeta ;
@@ -79,17 +82,19 @@ impl InProgressRecording {
7982 }
8083
8184 pub async fn pause ( & self ) -> Result < ( ) , RecordingError > {
82- match self {
83- Self :: Instant { handle, .. } => handle. pause ( ) . await ,
84- Self :: Studio { handle, .. } => handle. pause ( ) . await ,
85- }
85+ todo ! ( )
86+ // match self {
87+ // Self::Instant { handle, .. } => handle.pause().await,
88+ // Self::Studio { handle, .. } => handle.pause().await,
89+ // }
8690 }
8791
8892 pub async fn resume ( & self ) -> Result < ( ) , String > {
89- match self {
90- Self :: Instant { handle, .. } => handle. resume ( ) . await . map_err ( |e| e. to_string ( ) ) ,
91- Self :: Studio { handle, .. } => handle. resume ( ) . await . map_err ( |e| e. to_string ( ) ) ,
92- }
93+ todo ! ( )
94+ // match self {
95+ // Self::Instant { handle, .. } => handle.resume().await.map_err(|e| e.to_string()),
96+ // Self::Studio { handle, .. } => handle.resume().await.map_err(|e| e.to_string()),
97+ // }
9398 }
9499
95100 pub fn recording_dir ( & self ) -> & PathBuf {
@@ -99,7 +104,7 @@ impl InProgressRecording {
99104 }
100105 }
101106
102- pub async fn stop ( self ) -> Result < CompletedRecording , RecordingError > {
107+ pub async fn stop ( self ) -> anyhow :: Result < CompletedRecording > {
103108 Ok ( match self {
104109 Self :: Instant {
105110 handle,
@@ -124,13 +129,21 @@ impl InProgressRecording {
124129 } )
125130 }
126131
127- pub async fn cancel ( self ) -> Result < ( ) , RecordingError > {
132+ pub fn done_fut ( & self ) -> cap_recording :: DoneFut {
128133 match self {
129- Self :: Instant { handle, .. } => handle. cancel ( ) . await ,
130- Self :: Studio { handle, .. } => handle. cancel ( ) . await ,
134+ Self :: Instant { handle, .. } => handle. done_fut ( ) ,
135+ Self :: Studio { handle, .. } => handle. done_fut ( ) ,
131136 }
132137 }
133138
139+ pub async fn cancel ( self ) -> Result < ( ) , RecordingError > {
140+ todo ! ( )
141+ // match self {
142+ // Self::Instant { handle, .. } => handle.cancel().await,
143+ // Self::Studio { handle, .. } => handle.cancel().await,
144+ // }
145+ }
146+
134147 pub fn mode ( & self ) -> RecordingMode {
135148 match self {
136149 Self :: Instant { .. } => RecordingMode :: Instant ,
@@ -147,7 +160,7 @@ pub enum CompletedRecording {
147160 video_upload_info : VideoUploadInfo ,
148161 } ,
149162 Studio {
150- recording : studio_recording:: CompletedStudioRecording ,
163+ recording : studio_recording:: CompletedRecording ,
151164 target_name : String ,
152165 } ,
153166}
@@ -406,14 +419,13 @@ pub async fn start_recording(
406419 Err ( SendError :: HandlerError ( camera:: LockFeedError :: NoInput ) ) => None ,
407420 Err ( e) => return Err ( e. to_string ( ) ) ,
408421 } ;
409-
410422 #[ cfg( target_os = "macos" ) ]
411423 let shareable_content = crate :: platform:: get_shareable_content ( )
412424 . await
413425 . map_err ( |e| format ! ( "GetShareableContent: {e}" ) ) ?
414426 . ok_or_else ( || format ! ( "GetShareableContent/NotAvailable" ) ) ?;
415427
416- let ( actor, actor_done_rx ) = match inputs. mode {
428+ let actor = match inputs. mode {
417429 RecordingMode :: Studio => {
418430 let mut builder = studio_recording:: Actor :: builder (
419431 recording_dir. clone ( ) ,
@@ -434,7 +446,7 @@ pub async fn start_recording(
434446 builder = builder. with_mic_feed ( mic_feed) ;
435447 }
436448
437- let ( handle, actor_done_rx ) = builder
449+ let handle = builder
438450 . build (
439451 #[ cfg( target_os = "macos" ) ]
440452 shareable_content,
@@ -445,15 +457,12 @@ pub async fn start_recording(
445457 e. to_string ( )
446458 } ) ?;
447459
448- (
449- InProgressRecording :: Studio {
450- handle,
451- target_name,
452- inputs,
453- recording_dir : recording_dir. clone ( ) ,
454- } ,
455- actor_done_rx,
456- )
460+ InProgressRecording :: Studio {
461+ handle,
462+ target_name,
463+ inputs,
464+ recording_dir : recording_dir. clone ( ) ,
465+ }
457466 }
458467 RecordingMode :: Instant => {
459468 let Some ( video_upload_info) = video_upload_info. clone ( ) else {
@@ -470,7 +479,7 @@ pub async fn start_recording(
470479 builder = builder. with_mic_feed ( mic_feed) ;
471480 }
472481
473- let ( handle, actor_done_rx ) = builder
482+ let handle = builder
474483 . build (
475484 #[ cfg( target_os = "macos" ) ]
476485 shareable_content,
@@ -481,32 +490,31 @@ pub async fn start_recording(
481490 e. to_string ( )
482491 } ) ?;
483492
484- (
485- InProgressRecording :: Instant {
486- handle,
487- progressive_upload,
488- video_upload_info,
489- target_name,
490- inputs,
491- recording_dir : recording_dir. clone ( ) ,
492- } ,
493- actor_done_rx,
494- )
493+ InProgressRecording :: Instant {
494+ handle,
495+ progressive_upload,
496+ video_upload_info,
497+ target_name,
498+ inputs,
499+ recording_dir : recording_dir. clone ( ) ,
500+ }
495501 }
496502 } ;
497503
504+ let done_fut = actor. done_fut ( ) ;
505+
498506 state. set_current_recording ( actor) ;
499507
500- Ok :: < _ , String > ( actor_done_rx )
508+ Ok :: < _ , String > ( done_fut )
501509 }
502510 } )
503511 . await
504512 . map_err ( |e| format ! ( "Failed to spawn recording actor: {e}" ) ) ?
505513 }
506514 . await ;
507515
508- let actor_done_rx = match spawn_actor_res {
509- Ok ( rx ) => rx ,
516+ let actor_done_fut = match spawn_actor_res {
517+ Ok ( fut ) => fut ,
510518 Err ( e) => {
511519 let _ = RecordingEvent :: Failed { error : e. clone ( ) } . emit ( & app) ;
512520
@@ -537,22 +545,25 @@ pub async fn start_recording(
537545 let state_mtx = Arc :: clone ( & state_mtx) ;
538546 async move {
539547 fail ! ( "recording::wait_actor_done" ) ;
540- let res = actor_done_rx . await ;
548+ let res = actor_done_fut . await ;
541549 info ! ( "recording wait actor done: {:?}" , & res) ;
542550 match res {
543- Ok ( Ok ( _ ) ) => {
551+ Ok ( ( ) ) => {
544552 let _ = finish_upload_tx. send ( ( ) ) ;
545553 let _ = RecordingEvent :: Stopped . emit ( & app) ;
546554 }
547- Ok ( Err ( e) ) => {
555+ Err ( e) => {
548556 let mut state = state_mtx. write ( ) . await ;
549557
550- let _ = RecordingEvent :: Failed { error : e. clone ( ) } . emit ( & app) ;
558+ let _ = RecordingEvent :: Failed {
559+ error : e. to_string ( ) ,
560+ }
561+ . emit ( & app) ;
551562
552563 let mut dialog = MessageDialogBuilder :: new (
553564 app. dialog ( ) . clone ( ) ,
554565 "An error occurred" . to_string ( ) ,
555- e,
566+ e. to_string ( ) ,
556567 )
557568 . kind ( tauri_plugin_dialog:: MessageDialogKind :: Error ) ;
558569
@@ -565,10 +576,6 @@ pub async fn start_recording(
565576 // this clears the current recording for us
566577 handle_recording_end ( app, None , & mut state) . await . ok ( ) ;
567578 }
568- // Actor hasn't errored, it's just finished
569- v => {
570- info ! ( "recording actor ended: {v:?}" ) ;
571- }
572579 }
573580 }
574581 } ) ;
@@ -628,7 +635,7 @@ pub async fn restart_recording(app: AppHandle, state: MutableState<'_, App>) ->
628635
629636 let inputs = recording. inputs ( ) . clone ( ) ;
630637
631- let _ = recording. cancel ( ) . await ;
638+ // let _ = recording.cancel().await;
632639
633640 tokio:: time:: sleep ( Duration :: from_millis ( 1000 ) ) . await ;
634641
@@ -658,7 +665,7 @@ pub async fn delete_recording(app: AppHandle, state: MutableState<'_, App>) -> R
658665 CurrentRecordingChanged . emit ( & app) . ok ( ) ;
659666 RecordingStopped { } . emit ( & app) . ok ( ) ;
660667
661- let _ = recording. cancel ( ) . await ;
668+ // let _ = recording.cancel().await;
662669
663670 std:: fs:: remove_dir_all ( & recording_dir) . ok ( ) ;
664671
@@ -1105,7 +1112,7 @@ fn generate_zoom_segments_from_clicks_impl(
11051112/// Generates zoom segments based on mouse click events during recording.
11061113/// Used during the recording completion process.
11071114pub fn generate_zoom_segments_from_clicks (
1108- recording : & studio_recording:: CompletedStudioRecording ,
1115+ recording : & studio_recording:: CompletedRecording ,
11091116 recordings : & ProjectRecordingsMeta ,
11101117) -> Vec < ZoomSegment > {
11111118 // Build a temporary RecordingMeta so we can use the common implementation
@@ -1162,7 +1169,7 @@ pub fn generate_zoom_segments_for_project(
11621169
11631170fn project_config_from_recording (
11641171 app : & AppHandle ,
1165- completed_recording : & studio_recording:: CompletedStudioRecording ,
1172+ completed_recording : & studio_recording:: CompletedRecording ,
11661173 recordings : & ProjectRecordingsMeta ,
11671174 default_config : Option < ProjectConfiguration > ,
11681175) -> ProjectConfiguration {
0 commit comments