let videoSource = self.peerConnectionFactory.videoSource()
self.videoCapturer = RTCCameraVideoCapturer(delegate: videoSource)
let videoTrack = self.peerConnectionFactory.videoTrack(with: videoSource, trackId: "video0")
if let capturer = self.videoCapturer as? RTCCameraVideoCapturer { var targetDevice: AVCaptureDevice? var targetFormat: AVCaptureDevice.Format?
// find target device
let devicies = RTCCameraVideoCapturer.captureDevices()
print("devices count is :\(devicies.count)")
devicies.forEach { (device) in
if device.position == cameraPositon{
targetDevice = device
}
else {
print("camera position is:\(cameraPositon.rawValue)::\(device.position.rawValue):\(targetDevice)")
}
}
// find target format
let formats = RTCCameraVideoCapturer.supportedFormats(for: targetDevice!)
print("supported formats are:\(formats)")
formats.forEach { (format) in
for _ in format.videoSupportedFrameRateRanges {
let description = format.formatDescription as CMFormatDescription
let dimensions = CMVideoFormatDescriptionGetDimensions(description)
if dimensions.width == videoWidth && dimensions.height == videoHeight ?? 0{
targetFormat = format
} else if dimensions.width == videoWidth {
targetFormat = format
}
}
}
print("target format is :\(targetDevice):\(targetFormat)")
capturer.startCapture(with: targetDevice!,
format: targetFormat!,
fps: videoFps)
}
//
RTCCameraVideoCapturer *rtcCapturer
from the setup of ARDCaptureController, then after a short wait (like a second)
[rtcCapturer.captureSession startRunning]
--
---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/079051a6-2152-410c-a166-d2e29711fb69n%40googlegroups.com.