mirror of
https://github.com/samsonjs/SwiftyCam.git
synced 2026-04-27 15:07:43 +00:00
Refactored switching camera to not remove outputs
This commit is contained in:
parent
2f1ab204a6
commit
4c3a2c8f47
1 changed files with 12 additions and 4 deletions
|
|
@ -453,11 +453,8 @@ open class SwiftyCamViewController: UIViewController {
|
||||||
for input in self.session.inputs {
|
for input in self.session.inputs {
|
||||||
self.session.removeInput(input as! AVCaptureInput)
|
self.session.removeInput(input as! AVCaptureInput)
|
||||||
}
|
}
|
||||||
for output in self.session.outputs {
|
|
||||||
self.session.removeOutput(output as! AVCaptureOutput)
|
|
||||||
}
|
|
||||||
|
|
||||||
self.configureSession()
|
self.addInputs()
|
||||||
self.cameraDelegate?.SwiftyCamDidSwitchCameras(camera: self.currentCamera)
|
self.cameraDelegate?.SwiftyCamDidSwitchCameras(camera: self.currentCamera)
|
||||||
self.session.startRunning()
|
self.session.startRunning()
|
||||||
}
|
}
|
||||||
|
|
@ -518,6 +515,17 @@ open class SwiftyCamViewController: UIViewController {
|
||||||
session.commitConfiguration()
|
session.commitConfiguration()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Add inputs after changing camera()
|
||||||
|
|
||||||
|
fileprivate func addInputs() {
|
||||||
|
session.beginConfiguration()
|
||||||
|
configureVideoPreset()
|
||||||
|
addVideoInput()
|
||||||
|
addAudioInput()
|
||||||
|
session.commitConfiguration()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Front facing camera will always be set to VideoQuality.high
|
// Front facing camera will always be set to VideoQuality.high
|
||||||
// If set video quality is not supported, videoQuality variable will be set to VideoQuality.high
|
// If set video quality is not supported, videoQuality variable will be set to VideoQuality.high
|
||||||
/// Configure image quality preset
|
/// Configure image quality preset
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue