LiteAVSDK
Tencent Cloud TRTC SDK, is a high availability components serving tens of thousands of enterprise customers, which is committed to helping you to minimize your research and development costs.
TXDeviceManager

Packages

package  com.tencent.liteav.device
 

Data Structures

interface  TXDeviceManager.TXSystemVolumeType
 
interface  TXDeviceManager.TXAudioRoute
 
interface  TXDeviceManager.TXCameraCaptureMode
 
class  TXDeviceManager.TXCameraCaptureParam
 
interface  TXDeviceManager
 

Detailed Description

Tencent Cloud Device Management Module.

Module: audio/video device management module Description: manages audio/video devices such as camera, mic, and speaker.


Data Structure Documentation

◆ com::tencent::liteav::device::TXDeviceManager::TXSystemVolumeType

interface com::tencent::liteav::device::TXDeviceManager::TXSystemVolumeType

System volume type (for mobile devices only)

Deprecated:
This API is not recommended after v9.5.

Smartphones usually have two types of system volume: call volume and media volume.

  • Call volume is designed for call scenarios. It comes with acoustic echo cancellation (AEC) and supports audio capturing by Bluetooth earphones, but its sound quality is average. If you cannot turn the volume down to 0 (i.e., mute the phone) using the volume buttons, then your phone is using call volume.
  • Media volume is designed for media scenarios such as music playback. AEC does not work when media volume is used, and Bluetooth earphones cannot be used for audio capturing. However, media volume delivers better music listening experience. If you are able to mute your phone using the volume buttons, then your phone is using media volume.

The SDK offers three system volume control modes: auto, call volume, and media volume.

Data Fields
TXSystemVolumeTypeAuto Auto.
TXSystemVolumeTypeMedia Media volume.
TXSystemVolumeTypeVOIP Call volume.

◆ com::tencent::liteav::device::TXDeviceManager::TXAudioRoute

interface com::tencent::liteav::device::TXDeviceManager::TXAudioRoute

Audio route (the route via which audio is played)

Audio route is the route (speaker or receiver) via which audio is played. It applies only to mobile devices such as mobile phones. A mobile phone has two speakers: one at the top (receiver) and the other the bottom.

  • If the audio route is set to the receiver, the volume is relatively low, and audio can be heard only when the phone is put near the ear. This mode has a high level of privacy and is suitable for answering calls.
  • If the audio route is set to the speaker, the volume is relatively high, and there is no need to put the phone near the ear. This mode enables the "hands-free" feature.
Data Fields
TXAudioRouteEarpiece Earpiece: the receiver at the top is used for playback. With relatively low volume, it is suitable for call scenarios that require privacy.
TXAudioRouteSpeakerphone Speakerphone: the speaker at the bottom is used for playback (hands-free). With relatively high volume, it is used to play music out loud.

◆ com::tencent::liteav::device::TXDeviceManager::TXCameraCaptureMode

interface com::tencent::liteav::device::TXDeviceManager::TXCameraCaptureMode

Camera acquisition preferences

This interface is used to set camera acquisition parameters.

Data Fields
TXCameraCaptureManual Allows the user to set the width and height of the video captured by the local camera.
TXCameraResolutionStrategyAuto

Auto adjustment of camera capture parameters. SDK selects the appropriate camera output parameters according to the actual acquisition device performance and network situation, and maintains a balance between device performance and video preview quality.

TXCameraResolutionStrategyHighQuality

Give priority to the quality of video preview. SDK selects higher camera output parameters to improve the quality of preview video. In this case, it will consume more CPU and memory to do video preprocessing.

TXCameraResolutionStrategyPerformance

Give priority to equipment performance. SDK selects the closest camera output parameters according to the user's encoder resolution and frame rate, so as to ensure the performance of the device.

◆ com::tencent::liteav::device::TXDeviceManager::TXCameraCaptureParam

class com::tencent::liteav::device::TXDeviceManager::TXCameraCaptureParam

Camera acquisition parameters

This setting determines the quality of the local preview image.

◆ com::tencent::liteav::device::TXDeviceManager

interface com::tencent::liteav::device::TXDeviceManager

Device APIs for mobile OS

boolean isFrontCamera ()
 
int switchCamera (boolean frontCamera)
 
float getCameraZoomMaxRatio ()
 
int setCameraZoomRatio (float zoomRatio)
 
boolean isAutoFocusEnabled ()
 
int enableCameraAutoFocus (boolean enabled)
 
int setCameraFocusPosition (int x, int y)
 
boolean enableCameraTorch (boolean enable)
 
int setAudioRoute (TXAudioRoute route)
 

Device APIs for desktop OS

void setCameraCapturerParam (TXCameraCaptureParam params)
 

Disused APIs (the corresponding new APIs are recommended)

int setSystemVolumeType (TXSystemVolumeType type)
 

Member Function Documentation

◆ enableCameraAutoFocus()

int enableCameraAutoFocus ( boolean  enabled)

Enabling auto focus (for mobile OS)

After auto focus is enabled, the camera will automatically detect and always focus on faces.

◆ enableCameraTorch()

boolean enableCameraTorch ( boolean  enable)

Enabling/Disabling flash, i.e., the torch mode (for mobile OS)

◆ getCameraZoomMaxRatio()

float getCameraZoomMaxRatio ( )

Getting the maximum zoom ratio of the camera (for mobile OS)

◆ isAutoFocusEnabled()

boolean isAutoFocusEnabled ( )

Querying whether automatic face detection is supported (for mobile OS)

◆ isFrontCamera()

boolean isFrontCamera ( )

Querying whether the front camera is being used

◆ setAudioRoute()

int setAudioRoute ( TXAudioRoute  route)

Setting the audio route (for mobile OS)

A mobile phone has two audio playback devices: the receiver at the top and the speaker at the bottom. If the audio route is set to the receiver, the volume is relatively low, and audio can be heard only when the phone is put near the ear. This mode has a high level of privacy and is suitable for answering calls. If the audio route is set to the speaker, the volume is relatively high, and there is no need to put the phone near the ear. This mode enables the "hands-free" feature.

◆ setCameraCapturerParam()

void setCameraCapturerParam ( TXCameraCaptureParam  params)

Set camera acquisition preferences

◆ setCameraFocusPosition()

int setCameraFocusPosition ( int  x,
int  y 
)

Adjusting the focus (for mobile OS)

This API can be used to achieve the following:

  1. A user can tap on the camera preview.
  2. A rectangle will appear where the user taps, indicating the spot the camera will focus on.
  3. The user passes the coordinates of the spot to the SDK using this API, and the SDK will instruct the camera to focus as required.
    Attention
    Before using this API, you must first disable auto focus using enableCameraAutoFocus.
    Parameters
    positionThe spot to focus on. Pass in the coordinates of the spot you want to focus on.
    Returns
    0: operation successful; negative number: operation failed.

◆ setCameraZoomRatio()

int setCameraZoomRatio ( float  zoomRatio)

Setting the camera zoom ratio (for mobile OS)

Parameters
zoomRatioValue range: 1-5. 1 indicates the widest angle of view (original), and 5 the narrowest angle of view (zoomed in).

◆ setSystemVolumeType()

int setSystemVolumeType ( TXSystemVolumeType  type)

Setting the system volume type (for mobile OS)

Deprecated:
This API is not recommended after v9.5. Please use the startLocalAudio(quality) API in TRTCCloud instead, which param quality is used to decide audio quality.

◆ switchCamera()

int switchCamera ( boolean  frontCamera)

Switching to the front/rear camera (for mobile OS)