ByteRTCAudioDeviceManager class
- Inheritance
-
- Object
- NativeClass
- ByteRTCAudioDeviceManager
Properties
-
$resource
→ NativeResource
-
no setterinherited
-
hashCode
→ int
-
The hash code for this object.
no setterinherited
-
ready
→ Future<void>
-
Whether the instance is initialized
no setterinherited
-
runtimeType
→ Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
destroy()
→ void
-
inherited
-
enumerateAudioCaptureDevices()
→ FutureOr<ByteRTCDeviceCollection>
-
@detail api
@author dixing
@brief Get the list of audio capture devices.
@return The list of audio capture devices.. See ByteRTCDeviceCollection{@link #ByteRTCDeviceCollection}.
If a time-out occurs, it returns an empty list. By default, the time-out duration is set to 10 seconds. We recommend to call this API once you get notification of ByteRTCMediaDeviceListUpdated via rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error}.
@note When receiving rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error} for device change, you can call this API to get the latest list of audio playback devices.
-
enumerateAudioPlaybackDevices()
→ FutureOr<ByteRTCDeviceCollection>
-
@detail api
@author dixing
@brief Gets the list of the audio playback devices.
@return The list of all audio playback devices. See ByteRTCDeviceCollection{@link #ByteRTCDeviceCollection}.
If a time-out occurs, it returns an empty list. By default, the time-out duration is set to 10 seconds. We recommend to call this API once you get notification of ByteRTCMediaDeviceListUpdated via rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error}.
@note When receiving rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioDeviceStateChanged:device_type:device_state:device_error} for audio playback device change, you can call this API to get the latest list of audio playback devices.
-
followSystemCaptureDevice(BOOL followed)
→ FutureOr<void>
-
@detail api
@author yezijian.me
@brief Set the audio capture device to follow the OS default setting or not.
@param followed
- true: follow the OS setting. You can not call setAudioCaptureDevice:{@link #ByteRTCAudioDeviceManager#setAudioCaptureDevice} at the same time. The default value.
- false: do not follow the OS setting. You can call setAudioCaptureDevice:{@link #ByteRTCAudioDeviceManager#setAudioCaptureDevice} to set the audio capture device.
-
followSystemPlaybackDevice(BOOL followed)
→ FutureOr<void>
-
@detail api
@author yezijian.me
@brief Set the audio playback device to follow the OS default setting or not.
@param followed
- true: follow the OS setting. You can not call setAudioPlaybackDevice:{@link #ByteRTCAudioDeviceManager#setAudioPlaybackDevice} at the same time. The default value.
- false: do not follow the OS setting. You can call setAudioPlaybackDevice:{@link #ByteRTCAudioDeviceManager#setAudioPlaybackDevice} to set the audio playback device.
-
getAudioCaptureDevice(NSString deviceID)
→ FutureOr<int>
-
@detail api
@author dixing
@brief Gets the current audio capture device.
@param deviceID audio capture device ID.
@return Method call result
- 0: Success.
- < 0: failure
-
getAudioCaptureDeviceMute(bool mute)
→ FutureOr<int>
-
@detail api
@author dixing
@brief Gets information about the mute state of the current audio capture device.
@param mute
- true: Mute
- false: Speaking
@return Method call result
- 0: Success.
- < 0: failure
-
getAudioCaptureDeviceVolume(int volume)
→ FutureOr<int>
-
@detail api
@author dixing
@brief Get the current audio capture device volume.
@param volume Audio capture device volume. The range is
0,255.
- 0,25: nearly silent;
- 25,75: low volume;
- 76,204: medium volume;
- 205,255: high volume.
@return Method call result
- 0: Success.
- < 0: failure
-
getAudioPlaybackDevice(NSString deviceID)
→ FutureOr<int>
-
@detail api
@author dixing
@brief Gets the current audio playback device.
@param deviceID audio playback device ID
@return Method call result
- 0: Success.
- < 0: failure
-
getAudioPlaybackDeviceMute(bool mute)
→ FutureOr<int>
-
@detail api
@author dixing
@brief Get the mute state of the current audio playback device.
@param mute
- true: Mute
- false: Speaking
@return Method call result
- 0: Success.
- < 0: failure
-
getAudioPlaybackDeviceVolume(int volume)
→ FutureOr<int>
-
@detail api
@author dixing
@brief Get the current audio playback device volume.
@param volume Audio playback device volume. The range is
0,255.
- 0,25: nearly silent;
- 25,75: low volume;
- 76,204: medium volume;
- 205,255: high volume.
@return Method call result
- 0: Success.
- < 0: failure
-
initAudioCaptureDeviceForTest(NSString deviceID)
→ FutureOr<int>
-
@detail api
@author dixing
@brief Try to initialize the audio capture device for device test.
@param deviceID device ID
@return Device status error code:
- 0: Status normal.
- -1: Test not executed.
- -2: Init failed due to lack of permission.
- -3: The device does not exist. No device or device removed.
- -4: The audio format is not supported.
- -5: Error for other reasons
@note
- Call this API before joining the room;
- You may still fail to enable the device even you passed the test. Occupation by other application or shortage of CPU / memory may cause the failure.
-
initAudioPlaybackDeviceForTest(NSString deviceID)
→ FutureOr<int>
-
@detail api
@author dixing
@brief Try to initialize the audio playback device for device test.
@param deviceID Device ID
@return Device status error code:
- 0: Status normal.
- -1: Test not executed.
- -2: Init failed due to lack of permission.
- -3: The device does not exist. No device or device removed.
- -4: The audio format is not supported.
- -5: Error for other reasons
@note
- Call this API before the user joins the room.
- You may still fail to enable the device even you passed the test. Occupation by other application or shortage of CPU / memory may cause the failure.
-
nativeCall<T>(String method, [List? args, NativeMethodMeta? meta])
→ Future<T>
-
Call instance method
inherited
-
noSuchMethod(Invocation invocation)
→ dynamic
-
Invoked when a nonexistent method or property is accessed.
inherited
-
sendInstanceGet<T>(String property)
→ Future<T>
-
Get instance property
inherited
-
sendInstancePropertiesGet(dynamic nativeClass)
→ Future<Map<String, dynamic>>
-
Get instance properties
inherited
-
sendInstanceSet(String property, dynamic value)
→ Future<void>
-
Set instance property
inherited
-
setAudioCaptureDevice(NSString deviceID)
→ FutureOr<int>
-
@detail api
@author dixing
@brief Set the audio capture devices.
@param deviceID Audio capture device ID. You can get the device list by calling enumerateAudioCaptureDevices{@link #ByteRTCAudioDeviceManager#EnumerateAudioCaptureDevices}.
@return Method call result
- 0: Success.
- < 0: failure
@note After you call followSystemCaptureDevice:{@link #ByteRTCAudioDeviceManager#followSystemCaptureDevice} to set the audio playback device to follow the system setting, you cannot call this API to set the audio capture device.
-
setAudioCaptureDeviceMute(bool mute)
→ FutureOr<int>
-
@detail api
@author dixing
@brief Set the mute state of the current audio capture device. It's not mute by default.
@param mute
- true: Mute
- false: Speaking
@return Method call result
- 0: Success.
- < 0: failure
-
setAudioCaptureDeviceVolume(int volume)
→ FutureOr<int>
-
@detail api
@author dixing
@brief Set the current audio capture device volume
@param volume Audio capture device volume. The range is
0,255.
- 0,25: nearly silent;
- 25,75: low volume;
- 76,204: medium volume;
- 205,255: high volume.
@return Method call result
- 0: Success. The volume information returned by rtcEngine:onLocalAudioPropertiesReport:{@link #ByteRTCEngineDelegate#rtcEngine:onLocalAudioPropertiesReport} will be changed according to this value.
- < 0: failure
-
setAudioPlaybackDevice(NSString deviceID)
→ FutureOr<int>
-
@detail api
@author dixing
@brief Sets the audio playback device.
@param deviceID Device ID. You can get the ID by calling EnumerateAudioPlaybackDevices{@link #ByteRTCAudioDeviceManager#EnumerateAudioPlaybackDevices}.
@return
- 0: Success
- < 0: Failure
@note After you call followSystemPlaybackDevice:{@link #ByteRTCAudioDeviceManager#followSystemPlaybackDevice} to set the audio playback device to follow the system setting, you cannot call this API to set the audio playback device.
-
setAudioPlaybackDeviceMute(bool mute)
→ FutureOr<int>
-
@detail api
@author dixing
@brief Set the mute state of the current audio playback device. It's not mute by default.
@param mute
- true: Mute
- false: Speaking
@return Method call result
- 0: Success.
- < 0: failure
-
setAudioPlaybackDeviceVolume(int volume)
→ FutureOr<int>
-
@detail api
@author dixing
@brief Set the current audio playback device volume.
@param volume Audio playback device volume. The range is
0,255.
- 0,25: nearly silent;
- 25,75: low volume;
- 76,204: medium volume;
- 205,255: high volume.
@return Method call result
- 0: Success.
- < 0: failure
-
startAudioDeviceLoopbackTest(int indicationInterval)
→ FutureOr<int>
-
@detail api
@author dixing
@brief Begins audio device loop testing.
This method tests whether the audio capture device and the audio playback device can work normally. Once the test starts, the audio capture device will capture the local sound
And play it out through the audio playback device, and the user App will receive the volume information reported by the OnLocalAudioPropertiesReport callback.
@param indicationInterval The time interval of receiving callbacks in ms. It is recommended to set to no less than 200 ms. The minimum is 10 ms.
@return Method call result
- 0: Success.
- < 0: failure
@note
- This method do not rely on rtcEngine
- This method must be called before joining the room. And cannot be applied at the same time as other audio equipment test functions.
- You need to call stopAudioDeviceLoopbackTest{@link #ByteRTCAudioDeviceManager#stopAudioDeviceLoopbackTest} to stop the test.
- This method only tests audio equipment locally and does not involve network connection.
-
startAudioDeviceRecordTest(int interval)
→ FutureOr<int>
-
@hidden(iOS)
@detail api
@author dixing
@brief Start the capture and playback test for local audio devices.
@param interval During the test, you'll receive
rtcEngine:onLocalAudioPropertiesReport: periodically. Set the period in ms with this parameter. Recommended value is 200 ms; the minimal value is 10 ms.
@return result
- 0: success
- < 0: failure
@note
- The audio capturing stops in 30s after calling this API and begins to play the recording audio. Before that, you can call stopAudioDeviceRecordAndPlayTest{@link #ByteRTCAudioDeviceManager#stopAudioDeviceRecordAndPlayTest} to stop audio capturing and start playing the recording audio.
- Call stopAudioDevicePlayTest{@link #ByteRTCAudioDeviceManager#stopAudioDevicePlayTest} to stop the test, including capturing and playing the recording.
- You must stop the test before starting another test for audio devices.
- You must stop the test before calling enableAudioPropertiesReport:.
- This test performs locally and does not involve network connection testing.
-
startAudioPlaybackDeviceTest(NSString testAudioFilePath, int interval)
→ FutureOr<int>
-
@detail api
@author dixing
@brief Start the audio playback device test.
This method tests whether the playback device works properly. The SDK plays the specified audio file. If the tester can hear the sound, the playback device can work normally.
@param testAudioFilePath The absolute path of the audio file. The path string uses UTF-8 encoding format and supports the following audio formats: mp3, aac, m4a, 3gp, wav.
@param interval playback device test volume callback interval
@return Method call result
- 0: Success.
- < 0: failure
@note
- This method must be called before joining the room and cannot be applied at the same time as other audio device testing functions.
- Call stopAudioPlaybackDeviceTest{@link #ByteRTCAudioDeviceManager#stopAudioPlaybackDeviceTest} to stop the test.
-
startAudioRecordingDeviceTest(int indicationInterval)
→ FutureOr<int>
-
@detail api
@author dixing
@brief Start the audio capture device test.
This method tests whether the audio capture device can work properly. After starting the test, you will receive the volume information reported by rtcEngine:onLocalAudioPropertiesReport:{@link #ByteRTCEngineDelegate#rtcEngine:onLocalAudioPropertiesReport}.
@param indicationInterval The interval of receiving callbacks. It is recommended to set to no less than 200 ms. The minimum is 10 ms.
@return Method call result
- 0: Success.
- < 0: failure
@note
- This method do not rely on rtcEngine
- This method must be called before joining the room and cannot be applied at the same time as other audio device testing functions.
- You need to call stopAudioRecordingDeviceTest{@link #ByteRTCAudioDeviceManager#stopAudioRecordingDeviceTest} to stop the test.
-
stopAudioDeviceLoopbackTest()
→ FutureOr<int>
-
@detail api
@author dixing
@brief Stop audio device loop testing.
@return Method call result
- 0: Success.
- < 0: failure
@note
- This method do not rely on rtcEngine
- After calling startAudioDeviceLoopbackTest:{@link #ByteRTCAudioDeviceManager#startAudioDeviceLoopbackTest}, you need to call this method to stop the test.
-
stopAudioDevicePlayTest()
→ FutureOr<int>
-
@hidden(iOS)
@detail api
@author dixing
@brief Stop the capture and playback test for local audio devices which is started by calling startAudioDeviceRecordTest:{@link #ByteRTCAudioDeviceManager#startAudioDeviceRecordTest}.
Before the test ends by itself, you can call this API to stop the recording or playing.
@return
- 0: success
- < 0: failure
@note
- This method do rely on rtcEngine, this method only will be Effective when ByteRTCAudioDeviceManager created by getAudioDeviceManager{@link #ByteRTCEngine#getAudioDeviceManager}
-
stopAudioDeviceRecordAndPlayTest()
→ FutureOr<int>
-
@hidden(iOS)
@detail api
@author dixing
@brief Call this API to stop recording in the test and start to play the recording in 30 s after calling startAudioDeviceRecordTest:{@link #ByteRTCAudioDeviceManager#startAudioDeviceRecordTest}.
@return result
- 0: success
- < 0: failure
@note
- This method do rely on rtcEngine, this method only will be Effective when ByteRTCAudioDeviceManager created by getAudioDeviceManager{@link #ByteRTCEngine#getAudioDeviceManager}
- After calling this API, the recording starts playing during which you can call stopAudioDevicePlayTest{@link #ByteRTCAudioDeviceManager#stopAudioDevicePlayTest} to stop playing.
-
stopAudioPlaybackDeviceTest()
→ FutureOr<int>
-
@detail api
@author dixing
@brief Stop audio playback device testing.
@return Method call result
- 0: Success.
- < 0: failure
@note After calling startAudioPlaybackDeviceTest:interval:{@link #ByteRTCAudioDeviceManager#startAudioPlaybackDeviceTest:interval}, call this method to stop the test.
-
stopAudioRecordingDeviceTest()
→ FutureOr<int>
-
@detail api
@author dixing
@brief Stop audio capture device testing.
@return Method call result
- 0: Success.
- < 0: failure
@note
- This method do not rely on rtcEngine
+After calling startAudioRecordingDeviceTest:{@link #ByteRTCAudioDeviceManager#startAudioRecordingDeviceTest}, you must call this method to stop the test.
-
toString()
→ String
-
A string representation of this object.
inherited
-
updateResource(NativeResource resource)
→ void
-
inherited