ios - Both iPhone cameras on the same view? -
i've had around online, , had play around myself have been unable find literally on topic, assume it's never been played around before.
let devices = avcapturedevice.devices().filter{ $0.hasmediatype(avmediatypevideo) && $0.position == avcapturedeviceposition.back } if let capturedevice = devices.first as? avcapturedevice { { try sessioncap.addinput(avcapturedeviceinput(device: capturedevice)) } catch { } sessioncap.sessionpreset = avcapturesessionpresetphoto sessioncap.startrunning() stillimageoutput.outputsettings = [avvideocodeckey:avvideocodecjpeg] if sessioncap.canaddoutput(stillimageoutput) { sessioncap.addoutput(stillimageoutput) } if let previewlayer = avcapturevideopreviewlayer(session: sessioncap) { previewlayer.bounds = view.bounds previewlayer.position = cgpointmake(view.bounds.midx, view.bounds.midy) previewlayer.videogravity = avlayervideogravityresizeaspectfill let camerapreview = uiview(frame: cgrectmake(0.0, 0.0, view.bounds.size.width, view.bounds.size.height)) camerapreview.layer.addsublayer(previewlayer) camerapreview.addgesturerecognizer(uitapgesturerecognizer(target: self, action:#selector(viewcontroller.savetocamera(_:)))) view.addsubview(camerapreview) } }
so code have @ moment, it shows iphone facing camera on viewcontroller, , have other code takes allows user take picture - great. however, wondering how possible add both cameras on same view?
the black area front facing camera ("selfie camera"), , cyan area facing camera. i'm going continue looking while posted here, feel it's lost cause.
it seems me impossible.
you cannot use both cameras @ same time, not allowed simultaneously. 1 avcapturesession
begins, other avcapturesession
stop because requires device hardware.
Comments
Post a Comment