TUIRoomDeviceManager

Copyright (c) 2024 Tencent. All rights reserved.
Module: TUIRoomDeviceManager @ TUIKitEngine.
Function: Device testing and management APIs.



TUIRoomDeviceManager

TUIRoomDeviceManagerObserver

FuncList
DESC
The status of the local device changed (only availiable for desktop OS).
Test camera video rendered success callback.
Test microphone volume callback.
Test speakerphone volume callback.

TUIRoomDeviceManager

FuncList
DESC
Query whether the front camera is being used (only availiable for mobile OS).
Switch to the front/rear camera (only availiable for mobile OS).
Query whether automatic face detection is supported (only availiable for mobile OS).
Enable auto focus (only availiable for mobile OS).
Enable/Disable flash, i.e., the torch mode (only availiable for mobile OS).
Set the audio route (only availiable for mobile OS).
Set event observer.
Start camera testing (only availiable for desktop OS).
End camera testing (only availiable for desktop OS).
Start microphone testing (only availiable for desktop OS).
End microphone testing (only availiable for desktop OS)
Start speaker testing (only availiable for desktop OS).
End speaker testing (only availiable for desktop OS).
Get the device list (only availiable for desktop OS).
Set the device to use (only availiable for desktop OS).
Get the device currently in use (only availiable for desktop OS).

StructType

FuncList
DESC
Device information.

EnumType

EnumType
DESC
Device type.
Device operation.
Audio routing (the route via which audio is played).

onDeviceChanged:type:state:

onDeviceChanged:type:state:
- (void)onDeviceChanged:
(NSString *)deviceId
type:
(TUIMediaDeviceType)type
state:
(TUIMediaDeviceState)state

The status of the local device changed (only availiable for desktop OS).

Param
DESC
deviceId
Device ID.
state
0: Device has been added; 1: Device has been removed; 2: Device has been enabled.
type
Device type.
Note
When the status of local device changed, the SDK will trigger this event callback.

onTestCameraVideoFrameRendered:height:

onTestCameraVideoFrameRendered:height:
- (void)onTestCameraVideoFrameRendered:
(NSInteger)width
height:
(NSInteger)height

Test camera video rendered success callback.

Param
DESC
height
Height of the video.
width
Width of the video.
Note
When the local test camera video rendered successfully, the SDK will trigger the callback.

onTestMicVolume:

onTestMicVolume:
- (void)onTestMicVolume:
(NSInteger)volume

Test microphone volume callback.

Param
DESC
volume
The volume value captured by the microphone, with a range of 0 - 100.
Note
When testing the local microphone, the SDK will trigger the callback.

onTestSpeakerVolume:

onTestSpeakerVolume:
- (void)onTestSpeakerVolume:
(NSInteger)volume

Test speakerphone volume callback.

Param
DESC
volume
The volume value set by the SDK, with a range of 0 - 100.
Note
When testing the local speakerphone, the SDK will trigger the callback.

isFrontCamera

isFrontCamera

Query whether the front camera is being used (only availiable for mobile OS).

switchCamera:

switchCamera:
- (void)switchCamera:
(BOOL)frontCamera

Switch to the front/rear camera (only availiable for mobile OS).

isAutoFocusEnabled

isAutoFocusEnabled

Query whether automatic face detection is supported (only availiable for mobile OS).

enableCameraAutoFocus:

enableCameraAutoFocus:
- (void)enableCameraAutoFocus:
(BOOL)enabled

Enable auto focus (only availiable for mobile OS).

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

enableCameraTorch:

enableCameraTorch:
- (void)enableCameraTorch:
(BOOL)enabled

Enable/Disable flash, i.e., the torch mode (only availiable for mobile OS).

setAudioRoute:

setAudioRoute:
- (void)setAudioRoute:
(TUIAudioRoute)route

Set the audio route (only availiable 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.

setObserver:

setObserver:
- (void)setObserver:
(id<TUIRoomDeviceManagerObserver>)observer

Set event observer.

You can use TUIRoomDeviceManagerObserver to receive events.
Param
DESC
observer
Listening instance.

startCameraDeviceTest:

startCameraDeviceTest:
- (void)startCameraDeviceTest:
(TUIVideoView *__nullable)view

Start camera testing (only availiable for desktop OS).

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

stopCameraDeviceTest

stopCameraDeviceTest

End camera testing (only availiable for desktop OS).

startMicDeviceTest:playback:

startMicDeviceTest:playback:
- (void)startMicDeviceTest:
(NSInteger)interval
playback:
(BOOL)playback

Start microphone testing (only availiable 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.
Param
DESC
interval
Interval of volume callbacks.
playback
true: The user can hear his own sound during testing. false: The user can not hear his own sound during testing.

stopMicDeviceTest

stopMicDeviceTest

End microphone testing (only availiable for desktop OS)

startSpeakerDeviceTest:

startSpeakerDeviceTest:
- (void)startSpeakerDeviceTest:
(NSString *) filePath

Start speaker testing (only availiable 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.
Param
DESC
filePath
Path of the audio file.

stopSpeakerDeviceTest

stopSpeakerDeviceTest

End speaker testing (only availiable for desktop OS).

getDevicesList:callback:

getDevicesList:callback:
- (void)getDevicesList:
(TUIMediaDeviceType)type
callback:
(TUIDeviceListBlock)callback

Get the device list (only availiable for desktop OS).

Param
DESC
type
Device type. More details, see $TUIMediaDeviceType$.

setCurrentDevice:deviceId:

setCurrentDevice:deviceId:
- (void)setCurrentDevice:
(TUIMediaDeviceType) type
deviceId:
(NSString *) deviceId

Set the device to use (only availiable for desktop OS).

Param
DESC
deviceId
Device ID, which you can use getDevicesList to get.
type
Device type. More details, see $TUIMediaDeviceType$.

getCurrentDevice:callback:

getCurrentDevice:callback:
- (void)getCurrentDevice:
(TUIMediaDeviceType) type
callback:
(TUIDeviceInfoBlock) callback

Get the device currently in use (only availiable for desktop OS).

Param
DESC
type
Device type. More details, see $TUIMediaDeviceType$.

TUIMediaDeviceType

TUIMediaDeviceType

Device type.

Enum
Value
DESC
TUIMediaDeviceTypeUnknown
-1
Undefined device type.
TUIMediaDeviceTypeAudioInput
0
Microphone.
TUIMediaDeviceTypeAudioOutput
1
Speaker or earpiece.
TUIMediaDeviceTypeVideoCamera
2
Camera.

TUIMediaDeviceState

TUIMediaDeviceState

Device operation.

Enum
Value
DESC
TUIMediaDeviceStateAdd
0
Device has been added.
TUIMediaDeviceStateRemove
1
Device has been removed.
TUIMediaDeviceStateActive
2
Device has been enabled.

TUIAudioRoute

TUIAudioRoute

Audio routing (the route via which audio is played).

Enum
Value
DESC
TUIAudioRouteSpeakerphone
0
Speakerphone: The speaker at the bottom is used for playback. With relatively high volume, it is used to play music out loud.
TUIAudioRouteEarpiece
1
Earpiece: The speaker at the top is used for playback. With relatively low volume, it is suitable for call scenarios that require privacy.

TUIDeviceInfo

TUIDeviceInfo

Device information.

EnumType
DESC
deviceId
Device ID.
deviceName
Device name.
deviceProperties
Device properties.