fix: Make recorder less error-prone (#189)
* Abort recording if failed to start or empty frames * Activate Audio Session on `cameraQueue` * Double-check stop recording in callback * Only call callback once * Format * Add description to `.aborted` error * Update RecordingSession.swift * Update AVAudioSession+updateCategory.swift * Rename serial dispatch queues
This commit is contained in:
@@ -188,6 +188,7 @@ enum CaptureError {
|
||||
case invalidPhotoCodec
|
||||
case videoNotEnabled
|
||||
case photoNotEnabled
|
||||
case aborted
|
||||
case unknown(message: String? = nil)
|
||||
|
||||
var code: String {
|
||||
@@ -210,6 +211,8 @@ enum CaptureError {
|
||||
return "video-not-enabled"
|
||||
case .photoNotEnabled:
|
||||
return "photo-not-enabled"
|
||||
case .aborted:
|
||||
return "aborted"
|
||||
case .unknown:
|
||||
return "unknown"
|
||||
}
|
||||
@@ -235,6 +238,8 @@ enum CaptureError {
|
||||
return "Video capture is disabled! Pass `video={true}` to enable video recordings."
|
||||
case .photoNotEnabled:
|
||||
return "Photo capture is disabled! Pass `photo={true}` to enable photo capture."
|
||||
case .aborted:
|
||||
return "The capture has been stopped before any input data arrived."
|
||||
case let .unknown(message: message):
|
||||
return message ?? "An unknown error occured while capturing a video/photo."
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user