@@ -13,6 +13,7 @@ use cap_recording::{
13
13
} ;
14
14
use cap_rendering:: ProjectRecordingsMeta ;
15
15
use cap_utils:: { ensure_dir, spawn_actor} ;
16
+ use futures:: stream;
16
17
use serde:: Deserialize ;
17
18
use specta:: Type ;
18
19
use std:: { path:: PathBuf , str:: FromStr , sync:: Arc , time:: Duration } ;
@@ -24,16 +25,15 @@ use tracing::{debug, error, info};
24
25
use crate :: {
25
26
App , CurrentRecordingChanged , MutableState , NewStudioRecordingAdded , RecordingState ,
26
27
RecordingStopped , VideoUploadInfo ,
27
- api:: { PresignedS3PutRequest , PresignedS3PutRequestMethod } ,
28
+ api:: PresignedS3PutRequestMethod ,
28
29
audio:: AppSounds ,
29
30
auth:: AuthStore ,
30
31
create_screenshot,
31
32
general_settings:: { GeneralSettingsStore , PostDeletionBehaviour , PostStudioRecordingBehaviour } ,
32
33
open_external_link,
33
34
presets:: PresetsStore ,
34
35
upload:: {
35
- InstantMultipartUpload , build_video_meta, bytes_into_stream, compress_image,
36
- create_or_get_video, do_presigned_upload, upload_video,
36
+ InstantMultipartUpload , build_video_meta, compress_image, create_or_get_video, upload_video,
37
37
} ,
38
38
web_api:: ManagerExt ,
39
39
windows:: { CapWindowId , ShowCapWindow } ,
@@ -263,11 +263,11 @@ pub async fn start_recording(
263
263
)
264
264
. await
265
265
{
266
- let link = app. make_app_url ( format ! ( "/s/{}" , s3_config. id( ) ) ) . await ;
266
+ let link = app. make_app_url ( format ! ( "/s/{}" , s3_config. id) ) . await ;
267
267
info ! ( "Pre-created shareable link: {}" , link) ;
268
268
269
269
Some ( VideoUploadInfo {
270
- id : s3_config. id ( ) . to_string ( ) ,
270
+ id : s3_config. id . to_string ( ) ,
271
271
link : link. clone ( ) ,
272
272
config : s3_config,
273
273
} )
@@ -807,23 +807,22 @@ async fn handle_recording_finish(
807
807
let _ = screenshot_task. await ;
808
808
809
809
if video_upload_succeeded {
810
- if let Ok ( result ) =
810
+ if let Ok ( bytes ) =
811
811
compress_image ( display_screenshot) . await
812
812
. map_err ( |err|
813
813
error ! ( "Error compressing thumbnail for instant mode progressive upload: {err}" )
814
814
) {
815
- let ( stream, total_size) = bytes_into_stream ( result) ;
816
- do_presigned_upload (
817
- & app,
818
- stream,
819
- total_size,
815
+ crate :: upload:: singlepart_uploader (
816
+ app. clone ( ) ,
820
817
crate :: api:: PresignedS3PutRequest {
821
818
video_id : video_upload_info. id . clone ( ) ,
822
819
subpath : "screenshot/screen-capture.jpg" . to_string ( ) ,
823
820
method : PresignedS3PutRequestMethod :: Put ,
824
821
meta : None ,
825
822
} ,
826
- |p| { } // TODO: Progress reporting
823
+ bytes. len ( ) as u64 ,
824
+ stream:: once ( async move { Ok :: < _ , std:: io:: Error > ( bytes:: Bytes :: from ( bytes) ) } ) ,
825
+
827
826
)
828
827
. await
829
828
. map_err ( |err| {
@@ -843,7 +842,6 @@ async fn handle_recording_finish(
843
842
display_screenshot. clone ( ) ,
844
843
video_upload_info. config . clone ( ) ,
845
844
meta,
846
- None ,
847
845
)
848
846
. await
849
847
{
0 commit comments