FCameraCapturerConfiguration
The camera capturer preference.
USTRUCT(BlueprintType)
struct FCameraCapturerConfiguration
{
GENERATED_BODY()
public:
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|CameraCapturerConfiguration")
ECAMERA_DIRECTION cameraDirection = ECAMERA_DIRECTION::CAMERA_FRONT;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|CameraCapturerConfiguration")
ECAMERA_FOCAL_LENGTH_TYPE cameraFocalLengthType = ECAMERA_FOCAL_LENGTH_TYPE::CAMERA_FOCAL_LENGTH_DEFAULT;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|CameraCapturerConfiguration")
bool deviceId_SetValue = false;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|CameraCapturerConfiguration")
FString deviceId = "";
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|CameraCapturerConfiguration")
bool cameraId_SetValue = false;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|CameraCapturerConfiguration")
FString cameraId = "";
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|CameraCapturerConfiguration")
FVideoFormat format = FVideoFormat();
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions")
EAgoraOptional followEncodeDimensionRatio = EAgoraOptional::AGORA_NULL_VALUE;
FCameraCapturerConfiguration(){}
FCameraCapturerConfiguration(const agora::rtc::CameraCapturerConfiguration & AgoraData){
#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS)
cameraDirection = static_cast<ECAMERA_DIRECTION>(AgoraData.cameraDirection.value());
cameraFocalLengthType = static_cast<ECAMERA_FOCAL_LENGTH_TYPE>(AgoraData.cameraFocalLengthType.value());
#else
SET_UEBP_OPTIONAL_VAL_FString(this->deviceId, AgoraData.deviceId);
#endif
#if defined(__ANDROID__)
cameraId = UTF8_TO_TCHAR(AgoraData.cameraId.value());
#endif
format = FVideoFormat(AgoraData.format);
SET_UEBP_OPTIONAL_VAL_BOOL( followEncodeDimensionRatio ,AgoraData.followEncodeDimensionRatio)
}
agora::rtc::CameraCapturerConfiguration CreateAgoraData() const {
agora::rtc::CameraCapturerConfiguration AgoraData;
#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS)
AgoraData.cameraDirection = static_cast<agora::rtc::CAMERA_DIRECTION>(cameraDirection);
AgoraData.cameraFocalLengthType = static_cast<agora::rtc::CAMERA_FOCAL_LENGTH_TYPE>(cameraFocalLengthType);
#else
SET_AGORA_OPTIONAL_VAL_CHARPTR______MEMOALLOC(AgoraData.deviceId, this->deviceId)
#endif
#if defined(__ANDROID__)
SET_AGORA_OPTIONAL_VAL_CHARPTR______MEMOALLOC(
AgoraData.cameraId,this->cameraId)
#endif
AgoraData.format = format.CreateAgoraData();
SET_AGORA_OPTIONAL_VAL_BOOL(AgoraData.followEncodeDimensionRatio, this->followEncodeDimensionRatio)
return AgoraData;
}
void FreeAgoraData(agora::rtc::CameraCapturerConfiguration& AgoraData) const {
format.FreeAgoraData(AgoraData.format);
#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS)
#else
SET_AGORA_OPTIONAL_VAL_CHARPTR______MEMOFREE(AgoraData.deviceId)
#endif
#if defined(__ANDROID__)
SET_AGORA_OPTIONAL_VAL_CHARPTR______MEMOFREE(AgoraData.cameraId)
#endif
}
};
Attributes
- cameraDirection
- (Optional) The camera direction. See ECAMERA_DIRECTION.Attention: This parameter is for Android and iOS only.
- cameraId
- (Optional) The camera ID. The default value is the camera ID of the front camera. You can get the camera ID through the Android native system API, see and for details.Attention:
- This parameter is for Android only.
- This parameter and cameraDirection are mutually exclusive in specifying the camera; you can choose one based on your needs. The differences are as follows:
- Specifying the camera via cameraDirection is more straightforward. You only need to indicate the camera direction (front or rear), without specifying a specific camera ID; the SDK will retrieve and confirm the actual camera ID through Android native system APIs.
- Specifying via cameraId allows for more precise identification of a particular camera. For devices with multiple cameras, where cameraDirection cannot recognize or access all available cameras, it is recommended to use cameraId to specify the desired camera ID directly.
- cameraFocalLengthType
- (Optional) The camera focal length type. See ECAMERA_FOCAL_LENGTH_TYPE.Attention:
- This parameter is for Android and iOS only.
- To set the focal length type of the camera, it is only supported to specify the camera through cameraDirection, and not supported to specify it through cameraId.
- For iOS devices equipped with multi-lens rear cameras, such as those featuring dual-camera (wide-angle and ultra-wide-angle) or triple-camera (wide-angle, ultra-wide-angle, and telephoto), you can use one of the following methods to capture video with an ultra-wide-angle perspective:
- Method one: Set this parameter to CAMERA_FOCAL_LENGTH_ULTRA_WIDE (2) (ultra-wide lens).
- Method two: Set this parameter to CAMERA_FOCAL_LENGTH_DEFAULT (0) (standard lens), then call SetCameraZoomFactor to set the camera's zoom factor to a value less than 1.0, with the minimum setting being 0.5.
- format
- (Optional) The format of the video frame. See FVideoFormat.
- deviceId
- The camera ID. Attention: This parameter is for Windows and macOS only.
- followEncodeDimensionRatio
- (Optional) Whether to follow the video aspect ratio set in SetVideoEncoderConfiguration:
true: (Default) Follow the set video aspect ratio. The SDK crops the captured video according to the set video aspect ratio.false: Do not follow the system default audio playback device. The SDK does not change the aspect ratio of the captured video frame.