I am currently able to record video to an AVCaptureMovieFileOutput
instance , yet I can't find any sources to learn from that have show how video playback is possible like snapchat/facebook/instagram are capable of producing.
Am I supposed to use the AVCaptureVideoPreviewLayer
, and if so how would I do so as I am able to successfully record to an AVCaptureMovieFileOutput
instance. A Solution or guidance to what is used would be very helpful!
Or Is it a specific controller, player etc? I have found the only play to be AVPlayerViewController
however it isn't a player that is free of buttons and progress bars.
func captureMovie(withDelegate delegate: AVCaptureFileOutputRecordingDelegate) {
if movieOutput.isRecording == false {
let connection = movieOutput.connection(withMediaType: AVMediaTypeVideo)
if (connection?.isVideoStabilizationSupported)! {
connection?.preferredVideoStabilizationMode = AVCaptureVideoStabilizationMode.auto
}
let device = activeInput.device
if (device?.isSmoothAutoFocusEnabled)! {
do {
try device?.lockForConfiguration()
device?.isSmoothAutoFocusEnabled = false
device?.unlockForConfiguration()
}
catch {
print("Error smooth auto focus")
}
}
let outputURL = tempURL()
movieOutput.startRecording(toOutputFileURL: outputURL, recordingDelegate: delegate)
} else {
stopRecording()
}
}