TUIRoomDeviceManager

最近更新时间:2024-06-21 16:16:11

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



TUIRoomDeviceManager

TUIRoomDeviceManagerObserver

函数列表
描述
The status of a local device changed (only availiable for desktop OS).
Test camera video rendered success callback.
Test microphone volume callback.
Test speakerphone volume callback.

TUIRoomDeviceManager

函数列表
描述
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 callback.
Start camera test (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)

结构体类型

函数列表
描述
Device information.

枚举类型

枚举类型
描述
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 a local device changed (only availiable for desktop OS).

参数
描述
deviceId
Device ID.
state
0: Device has been added; 1: Device has been removed; 2: Device has been enabled.
type
Device type.
注意
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.

参数
描述
height
Height of the video.
width
Width of the video.
注意
When the local test camera video rendered successfully, the SDK will trigger the callback.

onTestMicVolume:

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

Test microphone volume callback.

参数
描述
volume
The volume value captured by the microphone, with a range of 0 - 100.
注意
When testing the local microphone, the SDK will trigger the callback.

onTestSpeakerVolume:

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

Test speakerphone volume callback.

参数
描述
volume
The volume value set by the SDK, with a range of 0 - 100.
注意
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. This mode enables the "hands-free" feature.

setObserver:

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

Set event callback.

You can use TUIRoomDeviceManagerObserver to receive events.
参数
描述
observer
Listening instance.

startCameraDeviceTest:

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

Start camera test (only availiable for desktop OS)

注意
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.
参数
描述
interval
Interval of volume callbacks
playback
Whether to play back the microphone sound. The user will hear his own sound when testing the microphone if playback is true.

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.
参数
描述
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)

参数
描述
type
Device type, set it to the type of device you want to get. 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)

参数
描述
deviceId
Device ID, which you can use getDevicesList to get.
type
Device type. You can get the ID of a device using the getDevicesList API. 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)

参数
描述
type
Device type. More details, see $TUIMediaDeviceType$.

TUIMediaDeviceType

TUIMediaDeviceType

Device type.

枚举
取值
描述
TUIMediaDeviceTypeUnknown
-1
Undefined device type.
TUIMediaDeviceTypeAudioInput
0
Microphone.
TUIMediaDeviceTypeAudioOutput
1
Speaker or earpiece.
TUIMediaDeviceTypeVideoCamera
2
Camera.

TUIMediaDeviceState

TUIMediaDeviceState

Device operation.

枚举
取值
描述
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)

枚举
取值
描述
TUIAudioRouteSpeakerphone
0
Speakerphone: The speaker at the bottom is used for playback (hands-free). 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.

枚举类型
描述
deviceId
Device ID.
deviceName
Device name.
deviceProperties
Device properties.