RTC SDK provides methods to allow you to manage camera settings. You can manage camera settings before you perform audio and video calls to ensure that the camera works as expected. This topic describes how to manage camera settings.
Overview
Alibaba Cloud RTC SDK provides various methods to allow you to manage camera settings. You can switch between the front and rear cameras, zoom the lens, and configure exposure settings and the focus mode. You can configure camera settings before you join a channel. This way, a clearer image is displayed, and image size and brightness during an audio or video call are more appropriate.
Methods
The following are the common camera management methods. For more information, see AliRtcEngine API reference.
- switchCamera: Switches between the front and rear cameras. The front camera is used by default. (iOS only)
Return value- (int)switchCamera;A return value of 0 indicates that the method call is successful. Other values indicate that the method call failed.
- setCameraZoom: Sets the camera zoom ratio. (iOS only)
Parameters- (int)setCameraZoom:(float)zoom;
Return valueName Type Description zoom float The zoom level. The default value is 1.0. A return value of 0 indicates that the method call is successful. Other values indicate that the method call failed.
- setCameraFlash: Turns the camera flash on or off. (iOS only)
Parameters- (int)setCameraFlash:(BOOL)flash;
Return valueName Type Description flash BOOL YES: Enables the flash. NO: Disables the flash. The default value is NO. A return value of 0 indicates that the method call is successful. Other values indicate that the method call failed.
- setCameraAutoFocusFaceModeEnabled: Enables face-based auto focus for the camera. (iOS only)
Parameters- (BOOL)setCameraAutoFocusFaceModeEnabled:(BOOL)enable;
Return valueName Type Description enable BOOL YES: Enables face-based auto focus. NO: Disables face-based auto focus. The default value is NO. A return value of YES indicates that the method call is successful. A return value of NO indicates that the method call failed.
- isCameraOn: Checks whether the camera is on.
Return value- (BOOL)isCameraOn;A return value of YES indicates that the camera is on. A return value of NO indicates that the camera is off.
- isCameraFocusPointSupported: Checks whether the camera supports manual focus. (iOS only)
Return value- (BOOL)isCameraFocusPointSupported;YES indicates that the feature is supported, while NO indicates that it is unsupported.
- isCameraExposurePointSupported: Checks whether the camera supports setting an exposure area. (iOS only)
Return value- (BOOL)isCameraExposurePointSupported;YES indicates that the feature is supported, and NO indicates that the feature is not supported.
- setCameraFocusPoint: Sets the manual focus point for the camera. (iOS only)
Parameters- (int)setCameraFocusPoint:(CGPoint)point;
Return valueName Type Description point CGPoint The coordinates of the focus point. A return value of 0 indicates that the method call is successful. Other values indicate that the method call failed.
- setCameraExposurePoint: Sets the exposure point for the camera. (iOS only)
Parameters- (int)setCameraExposurePoint:(CGPoint)point;
Return valueName Type Description point CGPoint The coordinates of the exposure point. A return value of 0 indicates that the method call is successful. Other values indicate that the method call failed.