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

Namespaces

 liteav
 

Data Structures

struct  TXCameraCaptureParam
 
class  ITXDeviceInfo
 
class  ITXDeviceCollection
 
class  ITXDeviceObserver
 
class  ITXDeviceManager
 

Macros

#define __ITXDEVICEMANAGER_H__
 

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

◆ liteav::TXCameraCaptureParam

struct liteav::TXCameraCaptureParam

Camera acquisition parameters

This setting determines the quality of the local preview image.

◆ liteav::ITXDeviceInfo

class liteav::ITXDeviceInfo

Audio/Video device information (for desktop OS)

This structure describes key information (such as device ID and device name) of an audio/video device, so that users can choose on the UI the device to use.

Public Member Functions

virtual const char * getDeviceName ()=0
 
virtual const char * getDevicePID ()=0
 
virtual void release ()=0
 

Protected Member Functions

virtual ~ITXDeviceInfo ()
 

Constructor & Destructor Documentation

◆ ~ITXDeviceInfo()

virtual ~ITXDeviceInfo ( )
inlineprotectedvirtual

Member Function Documentation

◆ getDeviceName()

virtual const char* getDeviceName ( )
pure virtual

device name (UTF-8)

◆ getDevicePID()

virtual const char* getDevicePID ( )
pure virtual

device PID (UTF-8)

◆ release()

virtual void release ( )
pure virtual

release function, don't use delete!!!

◆ liteav::ITXDeviceCollection

class liteav::ITXDeviceCollection

Device information list (for desktop OS)

This structure functions as std::vector<ITXDeviceInfo> does. It solves the binary compatibility issue between different versions of STL containers.

Public Member Functions

virtual uint32_t getCount ()=0
 
virtual const char * getDeviceName (uint32_t index)=0
 
virtual const char * getDevicePID (uint32_t index)=0
 
virtual const char * getDeviceProperties (uint32_t index)=0
 
virtual void release ()=0
 

Protected Member Functions

virtual ~ITXDeviceCollection ()
 

Constructor & Destructor Documentation

◆ ~ITXDeviceCollection()

virtual ~ITXDeviceCollection ( )
inlineprotectedvirtual

Member Function Documentation

◆ getCount()

virtual uint32_t getCount ( )
pure virtual

Size of this list.

Returns
Size of this list.

◆ getDeviceName()

virtual const char* getDeviceName ( uint32_t  index)
pure virtual

device name (UTF-8)

Parameters
indexvalue in [0,getCount)
Returns
device name (UTF-8)

◆ getDevicePID()

virtual const char* getDevicePID ( uint32_t  index)
pure virtual

device PID (UTF-8)

Parameters
indexvalue in [0,getCount)
Returns
device PID (UTF-8)

◆ getDeviceProperties()

virtual const char* getDeviceProperties ( uint32_t  index)
pure virtual

device properties (json format)

Attention
  • examples: {"SupportedResolution":[{"width":640,"height":480},{"width":320,"height":240}]}
Parameters
indexvalue in [0,getCount)
Returns
device properties formatted by json

◆ release()

virtual void release ( )
pure virtual

release function, don't use delete!!!

◆ liteav::ITXDeviceObserver

class liteav::ITXDeviceObserver

Public Member Functions

virtual ~ITXDeviceObserver ()
 
virtual void onDeviceChanged (const char *deviceId, TXMediaDeviceType type, TXMediaDeviceState state)
 

Constructor & Destructor Documentation

◆ ~ITXDeviceObserver()

virtual ~ITXDeviceObserver ( )
inlinevirtual

Member Function Documentation

◆ onDeviceChanged()

virtual void onDeviceChanged ( const char *  deviceId,
TXMediaDeviceType  type,
TXMediaDeviceState  state 
)
inlinevirtual

The status of a local device changed (for desktop OS only)

The SDK returns this callback when a local device (camera, mic, or speaker) is connected or disconnected.

Parameters
deviceIdDevice ID
typeDevice type
stateDevice status. 0: connected; 1: disconnected; 2: started

◆ liteav::ITXDeviceManager

class liteav::ITXDeviceManager

Protected Member Functions

 ITXDeviceManager ()
 
virtual ~ITXDeviceManager ()
 

Device APIs for mobile OS

virtual bool isFrontCamera ()=0
 
virtual int switchCamera (bool frontCamera)=0
 
virtual float getCameraZoomMaxRatio ()=0
 
virtual int setCameraZoomRatio (float zoomRatio)=0
 
virtual bool isAutoFocusEnabled ()=0
 
virtual int enableCameraAutoFocus (bool enabled)=0
 
virtual int setCameraFocusPosition (float x, float y)=0
 
virtual int enableCameraTorch (bool enabled)=0
 
virtual int setAudioRoute (TXAudioRoute route)=0
 

Device APIs for desktop OS

virtual ITXDeviceCollectiongetDevicesList (TXMediaDeviceType type)=0
 
virtual int setCurrentDevice (TXMediaDeviceType type, const char *deviceId)=0
 
virtual ITXDeviceInfogetCurrentDevice (TXMediaDeviceType type)=0
 
virtual int setCurrentDeviceVolume (TXMediaDeviceType type, uint32_t volume)=0
 
virtual uint32_t getCurrentDeviceVolume (TXMediaDeviceType type)=0
 
virtual int setCurrentDeviceMute (TXMediaDeviceType type, bool mute)=0
 
virtual bool getCurrentDeviceMute (TXMediaDeviceType type)=0
 
virtual int startCameraDeviceTest (void *view)=0
 
virtual int stopCameraDeviceTest ()=0
 
virtual int startMicDeviceTest (uint32_t interval)=0
 
virtual int stopMicDeviceTest ()=0
 
virtual int startSpeakerDeviceTest (const char *filePath)=0
 
virtual int stopSpeakerDeviceTest ()=0
 
virtual int startCameraDeviceTest (ITRTCVideoRenderCallback *callback)=0
 
virtual int setApplicationPlayVolume (int volume)=0
 
virtual int getApplicationPlayVolume ()=0
 
virtual int setApplicationMuteState (bool bMute)=0
 
virtual bool getApplicationMuteState ()=0
 
virtual void setCameraCapturerParam (const TXCameraCaptureParam &params)=0
 
virtual void setDeviceObserver (ITXDeviceObserver *observer)=0
 

Disused APIs (the corresponding new APIs are recommended)

virtual int setSystemVolumeType (TXSystemVolumeType type)=0
 

Constructor & Destructor Documentation

◆ ITXDeviceManager()

ITXDeviceManager ( )
inlineprotected

◆ ~ITXDeviceManager()

virtual ~ITXDeviceManager ( )
inlineprotectedvirtual

Member Function Documentation

◆ enableCameraAutoFocus()

virtual int enableCameraAutoFocus ( bool  enabled)
pure virtual

Enabling auto focus (for mobile OS)

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

◆ enableCameraTorch()

virtual int enableCameraTorch ( bool  enabled)
pure virtual

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

◆ getApplicationMuteState()

virtual bool getApplicationMuteState ( )
pure virtual

Querying whether the current process is muted in the volume mixer (for Windows)

◆ getApplicationPlayVolume()

virtual int getApplicationPlayVolume ( )
pure virtual

Getting the volume of the current process in the volume mixer (for Windows)

◆ getCameraZoomMaxRatio()

virtual float getCameraZoomMaxRatio ( )
pure virtual

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

◆ getCurrentDevice()

virtual ITXDeviceInfo* getCurrentDevice ( TXMediaDeviceType  type)
pure virtual

Getting the device currently in use (for desktop OS)

◆ getCurrentDeviceMute()

virtual bool getCurrentDeviceMute ( TXMediaDeviceType  type)
pure virtual

Querying whether the current device is muted (for desktop OS)

This API is used to query whether the mic or speaker is muted. Camera muting is not supported.

◆ getCurrentDeviceVolume()

virtual uint32_t getCurrentDeviceVolume ( TXMediaDeviceType  type)
pure virtual

Getting the volume of the current device (for desktop OS)

This API is used to get the capturing volume of the mic or playback volume of the speaker, but not the volume of the camera.

◆ getDevicesList()

virtual ITXDeviceCollection* getDevicesList ( TXMediaDeviceType  type)
pure virtual

Getting the device list (for desktop OS)

Parameters
typeDevice type. Set it to the type of device you want to get. For details, please see the definition of TXMediaDeviceType.
Attention
  • To ensure that the SDK can manage the lifecycle of the ITXDeviceCollection object, after using this API, please call the release method to release the resources.
  • Do not use delete to release the Collection object returned as deleting the ITXDeviceCollection* pointer will cause crash.
  • The valid values of type are TXMediaDeviceTypeMic, TXMediaDeviceTypeSpeaker, and TXMediaDeviceTypeCamera.
  • This API can be used only on macOS and Windows.

◆ isAutoFocusEnabled()

virtual bool isAutoFocusEnabled ( )
pure virtual

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

◆ isFrontCamera()

virtual bool isFrontCamera ( )
pure virtual

Querying whether the front camera is being used

◆ setApplicationMuteState()

virtual int setApplicationMuteState ( bool  bMute)
pure virtual

Muting the current process in the volume mixer (for Windows)

◆ setApplicationPlayVolume()

virtual int setApplicationPlayVolume ( int  volume)
pure virtual

Setting the volume of the current process in the volume mixer (for Windows)

◆ setAudioRoute()

virtual int setAudioRoute ( TXAudioRoute  route)
pure virtual

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()

virtual void setCameraCapturerParam ( const TXCameraCaptureParam params)
pure virtual

Set camera acquisition preferences

◆ setCameraFocusPosition()

virtual int setCameraFocusPosition ( float  x,
float  y 
)
pure virtual

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()

virtual int setCameraZoomRatio ( float  zoomRatio)
pure virtual

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).

◆ setCurrentDevice()

virtual int setCurrentDevice ( TXMediaDeviceType  type,
const char *  deviceId 
)
pure virtual

Setting the device to use (for desktop OS)

Parameters
typeDevice type. For details, please see the definition of TXMediaDeviceType.
deviceIdDevice ID. You can get the ID of a device using the getDevicesList API.
Returns
0: operation successful; negative number: operation failed.

◆ setCurrentDeviceMute()

virtual int setCurrentDeviceMute ( TXMediaDeviceType  type,
bool  mute 
)
pure virtual

Muting the current device (for desktop OS)

This API is used to mute the mic or speaker, but not the camera.

◆ setCurrentDeviceVolume()

virtual int setCurrentDeviceVolume ( TXMediaDeviceType  type,
uint32_t  volume 
)
pure virtual

Setting the volume of the current device (for desktop OS)

This API is used to set the capturing volume of the mic or playback volume of the speaker, but not the volume of the camera.

Parameters
volumeVolume. Value range: 0-100; default: 100
Attention
If 100 is still not loud enough for you, you can set the volume to up to 150, but there may be side effects.

◆ setDeviceObserver()

virtual void setDeviceObserver ( ITXDeviceObserver observer)
pure virtual

set onDeviceChanged callback

◆ setSystemVolumeType()

virtual int setSystemVolumeType ( TXSystemVolumeType  type)
pure virtual

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.

◆ startCameraDeviceTest() [1/2]

virtual int startCameraDeviceTest ( ITRTCVideoRenderCallback callback)
pure virtual

Starting camera testing (for Windows)

This API supports custom rendering, meaning that you can use the callback API ITRTCVideoRenderCallback to get the images captured by the camera for custom rendering.

◆ startCameraDeviceTest() [2/2]

virtual int startCameraDeviceTest ( void *  view)
pure virtual

Starting camera testing (for desktop OS)

Attention
You can use the setCurrentDevice API to switch between cameras during testing.

◆ startMicDeviceTest()

virtual int startMicDeviceTest ( uint32_t  interval)
pure virtual

Starting mic testing (for desktop OS)

This API is used to test whether the mic functions properly. The mic volume detected (value range: 0-100) is returned via a callback.

Parameters
intervalInterval of volume callbacks

◆ startSpeakerDeviceTest()

virtual int startSpeakerDeviceTest ( const char *  filePath)
pure virtual

Starting speaker testing (for desktop OS)

This API is used to test whether the audio playback device functions properly by playing a specified audio file. If users can hear audio during testing, the device functions properly.

Parameters
filePathPath of the audio file

◆ stopCameraDeviceTest()

virtual int stopCameraDeviceTest ( )
pure virtual

Ending camera testing (for desktop OS)

◆ stopMicDeviceTest()

virtual int stopMicDeviceTest ( )
pure virtual

Ending mic testing (for desktop OS)

◆ stopSpeakerDeviceTest()

virtual int stopSpeakerDeviceTest ( )
pure virtual

Ending speaker testing (for desktop OS)

◆ switchCamera()

virtual int switchCamera ( bool  frontCamera)
pure virtual

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

Macro Definition Documentation

◆ __ITXDEVICEMANAGER_H__

#define __ITXDEVICEMANAGER_H__