Swift 3中的翻译
var capturer = RTCVideoCapturer(deviceName: cameraID)
var mediaConstraints: RTCMediaConstraints? = defaultMediaStreamConstraints()
var videoSource: RTCVideoSource? = factory.videoSource(with: capturer, constraints: mediaConstraints)
localVideoTrack = factory.videoTrack(withID: "ARDAMSv0", source: videoSource)
RTCAVFoundationVideoSource类中有一个名为“useBackCamera”的“bool”属性(
RTCAVFoundationVideoSource。h类
). 可以使用此属性在前/后摄像头之间切换。
//In RTCAVFoundationVideoSource.h
/** Returns whether rear-facing camera is available for use. */
@property(nonatomic, readonly) BOOL canUseBackCamera;
/** Switches the camera being used (either front or back). */
@property(nonatomic, assign) BOOL useBackCamera;
/** Returns the active capture session. */
@property(nonatomic, readonly) AVCaptureSession *captureSession;