iOS

更新时间:
复制 MD 格式

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)
    - (int)switchCamera;
    Return value

    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)
    - (int)setCameraZoom:(float)zoom;
    Parameters
    NameTypeDescription
    zoomfloatThe zoom level. The default value is 1.0.
    Return value

    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)
    - (int)setCameraFlash:(BOOL)flash;
    Parameters
    NameTypeDescription
    flashBOOLYES: Enables the flash. NO: Disables the flash. The default value is NO.
    Return value

    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)
    - (BOOL)setCameraAutoFocusFaceModeEnabled:(BOOL)enable;
    Parameters
    NameTypeDescription
    enableBOOLYES: Enables face-based auto focus. NO: Disables face-based auto focus. The default value is NO.
    Return value

    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.
    - (BOOL)isCameraOn;
    Return value

    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)
    - (BOOL)isCameraFocusPointSupported;
    Return value

    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)
    - (BOOL)isCameraExposurePointSupported;
    Return value

    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)
    - (int)setCameraFocusPoint:(CGPoint)point;
    Parameters
    NameTypeDescription
    pointCGPointThe coordinates of the focus point.
    Return value

    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)
    - (int)setCameraExposurePoint:(CGPoint)point;
    Parameters
    NameTypeDescription
    pointCGPointThe coordinates of the exposure point.
    Return value

    A return value of 0 indicates that the method call is successful. Other values indicate that the method call failed.