mirror of
https://github.com/samsonjs/SwiftyCam.git
synced 2026-03-25 09:05:52 +00:00
Merge pull request #200 from lm2s/master
Adds support to set AVVideoCodecType, fixes uninitialized property
This commit is contained in:
commit
9e9dbd370e
1 changed files with 14 additions and 1 deletions
|
|
@ -125,7 +125,7 @@ open class SwiftyCamViewController: UIViewController {
|
|||
|
||||
/// Sets whether flash is enabled for photo and video capture
|
||||
@available(*, deprecated, message: "use flashMode .on or .off") //use flashMode
|
||||
public var flashEnabled: Bool {
|
||||
public var flashEnabled: Bool = false {
|
||||
didSet{
|
||||
self.flashMode = self.flashEnabled ? .on : .off
|
||||
}
|
||||
|
|
@ -293,6 +293,10 @@ open class SwiftyCamViewController: UIViewController {
|
|||
return allowAutoRotate
|
||||
}
|
||||
|
||||
/// Sets output video codec
|
||||
|
||||
public var videoCodecType: AVVideoCodecType? = nil
|
||||
|
||||
// MARK: ViewDidLoad
|
||||
|
||||
/// ViewDidLoad Implementation
|
||||
|
|
@ -781,6 +785,15 @@ open class SwiftyCamViewController: UIViewController {
|
|||
if connection.isVideoStabilizationSupported {
|
||||
connection.preferredVideoStabilizationMode = .auto
|
||||
}
|
||||
|
||||
if #available(iOS 11.0, *) {
|
||||
if let videoCodecType = videoCodecType {
|
||||
if movieFileOutput.availableVideoCodecTypes.contains(videoCodecType) == true {
|
||||
// Use the H.264 codec to encode the video.
|
||||
movieFileOutput.setOutputSettings([AVVideoCodecKey: videoCodecType], for: connection)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self.movieFileOutput = movieFileOutput
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue