add filePath to define recording directory

- add CaptureError.createRecordingDirectoryError
- stub RCTViewManager to be able to compile CameraViewManager
This commit is contained in:
Rui Rodrigues
2024-07-16 09:50:21 +01:00
parent 621bfe333c
commit 9f2c7906e5
10 changed files with 61 additions and 22 deletions

View File

@@ -49,8 +49,7 @@ class RecordingSession {
/**
Gets the file URL of the recorded video.
*/
var url: URL {
// FIXME:
var outputDiretory: URL {
return recorder.outputURL
}
@@ -72,14 +71,15 @@ class RecordingSession {
return (lastWrittenTimestamp - startTimestamp).seconds
}
init(url: URL,
init(outputDiretory: String,
fileType: AVFileType,
onChunkReady: @escaping ((ChunkedRecorder.Chunk) -> Void),
completion: @escaping (RecordingSession, AVAssetWriter.Status, Error?) -> Void) throws {
completionHandler = completion
do {
recorder = try ChunkedRecorder(url: url.deletingLastPathComponent(), onChunkReady: onChunkReady)
let outputURL = URL(fileURLWithPath: outputDiretory)
recorder = try ChunkedRecorder(outputURL: outputURL, onChunkReady: onChunkReady)
assetWriter = AVAssetWriter(contentType: UTType(fileType.rawValue)!)
assetWriter.shouldOptimizeForNetworkUse = false
assetWriter.outputFileTypeProfile = .mpeg4AppleHLS