@@ -24,7 +24,7 @@ class ChunkedFileUploader {
2424 private var delegates : [ String : ChunkedFileUploaderDelegate ] = [ : ]
2525
2626 private let file : ChunkedFile
27- private var currentWorkTask : Task < ( ) , Never > ? = nil
27+ private var currentWorkTask : Task < ( ) , Error > ? = nil
2828 private var _currentState : InternalUploadState = . ready
2929 private var overallProgress : Progress = Progress ( )
3030 private var lastReadCount : UInt64 = 0
@@ -94,7 +94,7 @@ class ChunkedFileUploader {
9494 do {
9595 // It's fine if it's already open, that's handled by ignoring the call
9696 let fileSize = try FileManager . default. fileSizeOfItem (
97- atPath: uploadInfo . videoFile . path
97+ atPath: inputFileURL . path
9898 )
9999 let result = try await makeWorker ( ) . performUpload ( )
100100 file. close ( )
@@ -137,21 +137,26 @@ class ChunkedFileUploader {
137137 } else {
138138 MuxUploadSDK . logger? . debug ( " Task finished due to error in state \( String ( describing: self . currentState) ) " )
139139 let uploadError = InternalUploaderError ( reason: error, lastByte: lastReadCount)
140+ notifyStateFromWorker ( . failure( uploadError) )
140141
141142 if shouldReport {
143+ let fileSize = try FileManager . default. fileSizeOfItem (
144+ atPath: inputFileURL. path
145+ )
146+
142147 #warning("Start and end time need to be fixed")
143148 reporter. reportUploadFailure (
144149 transportStartTime: 0 ,
145150 transportEndTime: 0 ,
146151 errorDescription: uploadError. localizedDescription,
147- inputSize: file . fileSize,
152+ inputSize: fileSize,
148153 inputStandardizationEnabled: uploadInfo. options. inputStandardization. isEnabled,
149154 inputDuration: 0.0 ,
150155 uploadURL: uploadInfo. uploadURL
151156 )
152157 }
153158
154- notifyStateFromWorker ( . failure ( uploadError ) )
159+
155160 }
156161 }
157162 }
@@ -289,9 +294,8 @@ fileprivate actor Worker {
289294
290295 let startTime = Date ( ) . timeIntervalSince1970
291296 let fileSize = try FileManager . default. fileSizeOfItem (
292- atPath: uploadInfo . videoFile . path
297+ atPath: inputFileURL . path
293298 )
294-
295299 let wideFileSize : Int64
296300
297301 // Prevent overflow if UInt64 exceeds Int64.max
0 commit comments