strip file prefix
This commit is contained in:
@@ -20,6 +20,9 @@ extension CameraSession {
|
||||
onError: @escaping (_ error: CameraError) -> Void) {
|
||||
// Run on Camera Queue
|
||||
CameraQueues.cameraQueue.async {
|
||||
// Normalize path - expo-file-system passes file:// URIs but FileManager expects raw paths
|
||||
let normalizedPath = filePath.hasPrefix("file://") ? String(filePath.dropFirst(7)) : filePath
|
||||
|
||||
let start = DispatchTime.now()
|
||||
ReactLogger.log(level: .info, message: "Starting Video recording...")
|
||||
|
||||
@@ -98,20 +101,20 @@ extension CameraSession {
|
||||
}
|
||||
}
|
||||
|
||||
if !FileManager.default.fileExists(atPath: filePath) {
|
||||
if !FileManager.default.fileExists(atPath: normalizedPath) {
|
||||
do {
|
||||
try FileManager.default.createDirectory(atPath: filePath, withIntermediateDirectories: true)
|
||||
try FileManager.default.createDirectory(atPath: normalizedPath, withIntermediateDirectories: true)
|
||||
} catch {
|
||||
onError(.capture(.createRecordingDirectoryError(message: error.localizedDescription)))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
ReactLogger.log(level: .info, message: "Will record to temporary file: \(filePath)")
|
||||
ReactLogger.log(level: .info, message: "Will record to temporary file: \(normalizedPath)")
|
||||
|
||||
do {
|
||||
// Create RecordingSession for the temp file
|
||||
let recordingSession = try RecordingSession(outputDiretory: filePath,
|
||||
let recordingSession = try RecordingSession(outputDiretory: normalizedPath,
|
||||
fileType: options.fileType,
|
||||
onChunkReady: onChunkReady,
|
||||
onChunkError: onChunkError,
|
||||
|
||||
Reference in New Issue
Block a user