AgoraCameraCapturerConfiguration
设置摄像头采集偏好。
Objective-C
__attribute__((visibility("default"))) @interface AgoraCameraCapturerConfiguration: NSObject
#if TARGET_OS_IOS
@property (assign, nonatomic) AgoraCameraDirection cameraDirection;
@property(assign, nonatomic) AgoraFocalLength cameraFocalLengthType;
#elif TARGET_OS_MAC
@property (copy, nonatomic) NSString * _Nullable deviceId;
#endif
@property(assign, nonatomic) CGSize dimensions;
@property(assign, nonatomic) int frameRate;
@property(assign, nonatomic) BOOL followEncodeDimensionRatio;
@end
cameraDirection
摄像头方向,仅适用于 iOS。详见 AgoraCameraDirection。
cameraFocalLengthType
摄像头焦距类型,仅适用于 iOS。详见 AgoraFocalLength。
信息
对于配备多镜头后置摄像头的 iOS 设备(如双摄像头:广角和超广角,或三摄像头:广角、超广角和长焦),你可以使用以下任一方式以超广角视角采集视频:
- 方法一:将该参数设置为
AgoraFocalLengthUltraWide(2)(超广角镜头)。 - 方法二:将该参数设置为
AgoraFocalLengthDefault(0)(标准镜头),然后调用 setCameraZoomFactor: 将摄像头的缩放因子设置为小于 1.0 的值,最小值为 0.5。
deviceId
摄像头设备 ID,仅适用于 macOS。
dimensions
视频帧的尺寸(单位:像素)。默认值为 960 × 540。
frameRate
视频帧的帧率(单位:fps)。默认值为 15。
followEncodeDimensionRatio
是否遵循通过
setVideoEncoderConfiguration 设置的视频宽高比。 - YES:(默认)遵循设置的视频宽高比。SDK 会根据设置的视频宽高比裁剪采集的视频,并同步更新本地预览画面以及
onCaptureVideoFrame和onPreEncodeVideoFrame中的视频帧。 - NO:不遵循设置的视频宽高比。SDK 不会更改采集视频帧的宽高比。