diff --git a/packages/react-native-audio-api/ios/audioapi/ios/core/utils/IOSFileWriter.mm b/packages/react-native-audio-api/ios/audioapi/ios/core/utils/IOSFileWriter.mm index 6aa5149e9..b73ad4801 100644 --- a/packages/react-native-audio-api/ios/audioapi/ios/core/utils/IOSFileWriter.mm +++ b/packages/react-native-audio-api/ios/audioapi/ios/core/utils/IOSFileWriter.mm @@ -180,7 +180,6 @@ } /// @brief Closes the currently open audio file and finalizes writing. -/// This method retrieves the final file duration and size before closing. /// This method should be called from the JS thread only. /// @returns A CloseFileResult indicating success with file duration and size or an error message. CloseFileResult IOSFileWriter::closeFile() @@ -203,8 +202,7 @@ // AVAudioFile automatically finalizes the file when deallocated audioFile_ = nil; - double fileDuration = CMTimeGetSeconds([[AVURLAsset URLAssetWithURL:fileURL_ - options:nil] duration]); + double fileDuration = getCurrentDuration(); double fileSizeBytesMb = static_cast([[[NSFileManager defaultManager] attributesOfItemAtPath:fileURL_.path error:&error] fileSize]) /