feat: Separate usecases (decouple microphone, video, photo) (#168)
* Add props
* add props (iOS)
* Add use-cases conditionally
* Update CameraView+RecordVideo.swift
* Update RecordingSession.swift
* reconfigure on change
* Throw correct errors
* Check for audio permission
* Move `#if` outward
* Throw appropriate errors
* Update CameraView+RecordVideo.swift
* fix Splashscreen
* Dynamic filePath
* Fix video extension
* add `avci` and `m4v` file types
* Fix RecordVideo errors
* Fix audio setup
* Enable `photo`, `video` and `audio`
* Check for `video={true}` in frameProcessor
* format
* Remove unused DispatchQueue
* Update docs
* Add `supportsPhotoAndVideoCapture`
* Fix view manager
* Fix error not being propagated
* Catch normal errors too
* Update DEVICES.mdx
* Update CAPTURING.mdx
* Update classdocs
This commit is contained in:
@@ -10,11 +10,33 @@ import AVFoundation
|
||||
import Foundation
|
||||
|
||||
extension AVFileType {
|
||||
init(withString string: String) {
|
||||
self.init(rawValue: string)
|
||||
init(withString string: String) throws {
|
||||
switch string {
|
||||
case "mov":
|
||||
self = .mov
|
||||
case "mp4":
|
||||
self = .mp4
|
||||
case "avci":
|
||||
self = .avci
|
||||
case "m4v":
|
||||
self = .m4v
|
||||
default:
|
||||
throw EnumParserError.invalidValue
|
||||
}
|
||||
}
|
||||
|
||||
var descriptor: String {
|
||||
return rawValue
|
||||
var descriptor: String? {
|
||||
switch self {
|
||||
case .mov:
|
||||
return "mov"
|
||||
case .mp4:
|
||||
return "mp4"
|
||||
case .avci:
|
||||
return "avci"
|
||||
case .m4v:
|
||||
return "m4v"
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,8 +20,4 @@ enum EnumParserError: Error {
|
||||
Raised when the descriptor does not match any of the possible values.
|
||||
*/
|
||||
case invalidValue
|
||||
/**
|
||||
Raised when no descriptor for the given enum is available.
|
||||
*/
|
||||
case noDescriptorAvailable
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user