IAgoraRtcAudioRecordingDeviceManager

IAgoraRtcAudioRecordingDeviceManager class, which manages audio recording devices.

EnumerateRecordingDevices

Enumerates the audio capture devices.

public abstract DeviceInfo[] EnumerateRecordingDevices();

Returns

  • Success: Returns a DeviceInfo array that contains the device ID and device name of all the audio recording devices.
  • Failure: NULL.

SetRecordingDevice

Sets the audio capture device.

public abstract int SetRecordingDevice(string deviceId);

Parameters

deviceId

The ID of the audio capture device. You can get the device ID by calling EnumerateRecordingDevices. Plugging or unplugging the audio device does not change the device ID.

Returns

  • 0: Success.
  • < 0: Failure.

StartRecordingDeviceTest

Starts the audio capture device test.

public abstract int StartRecordingDeviceTest(int indicationInterval);

This method tests whether the audio capturing device works properly.

As of v3.6.2, you can call this method either before or after joining a channel. Depending on the call sequence, the SDK triggers the following callbacks at the set time interval to report the volume of the audio capturing device:
  • OnAudioVolumeIndication and OnAudioDeviceTestVolumeIndication when you call this method before joining the channel, with the following values:
    • uid = 0 and volume in OnAudioVolumeIndication.
    • volumeType = AudioTestRecordingVolume(0) and volume in OnAudioDeviceTestVolumeIndication.
    The two callbacks report the same volume information. Agora recommends using OnAudioDeviceTestVolumeIndication.
  • OnAudioDeviceTestVolumeIndication when you call this method after joining a channel, which reports volumeType = AudioTestRecordingVolume(0) and volume.
Attention:
  • When you call this method after joining a channel, ensure the audio capturing device is on ( EnableLocalAudio is set as true); otherwise, the method call fails, and the SDK triggers the OnError callback with ERR_ADM_START_RECORDING(1012).
  • Calling this method after joining a channel tests the audio capturing device that the SDK is using.
  • After calling startRecordingDeviceTest, you must call StopRecordingDeviceTest to stop the test.

Parameters

indicationInterval
The time interval (ms) at which the SDK triggers the OnAudioVolumeIndication or OnAudioDeviceTestVolumeIndication callback. Agora recommends a setting greater than 200 ms. This value must not be less than 10 ms; otherwise, you can not receive the OnAudioVolumeIndication or OnAudioDeviceTestVolumeIndication callback.

Returns

  • 0: Success.
  • < 0: Failure.

StopRecordingDeviceTest

Stops the audio capture device test.

public abstract int StopRecordingDeviceTest();

This method stops the audio capture device test. You must call this method to stop the test after calling the StartRecordingDeviceTest method.

Attention: Ensure that you call this method before joining a channel.

Returns

  • 0: Success.
  • < 0: Failure.

SetRecordingDeviceVolume

Sets the volume of the audio capture device.

public abstract int SetRecordingDeviceVolume(int volume);

Parameters

volume
The volume of the audio recording device. The value ranges between 0 (lowest volume) and 255 (highest volume).

Returns

  • 0: Success.
  • < 0: Failure.

GetRecordingDeviceVolume

Retrieves the volume of the audio recording device.

public abstract int GetRecordingDeviceVolume();

Returns

The volume of the audio recording device. The value ranges between 0 (lowest volume) and 255 (highest volume).

SetRecordingDeviceMute

Sets the mute status of the audio capture device.

public abstract int SetRecordingDeviceMute(bool mute);

Parameters

mute
Whether to mute the audio capture device:
  • true: Mute the audio capture device.
  • false: Unmute the audio capture device.

Returns

  • 0: Success.
  • < 0: Failure.

GetRecordingDeviceMute

Gets the microphone's mute status.

public abstract bool GetRecordingDeviceMute();

Returns

  • true: The microphone is muted.
  • false: The microphone is unmuted.

GetRecordingDevice

Gets the current audio recording device.

public abstract string GetRecordingDevice();

Returns

The current audio recording device.

GetRecordingDeviceInfo

Retrieves the audio capture device information associated with the device ID and device name.

public abstract DeviceInfo GetRecordingDeviceInfo();

Returns

A DeviceInfo array that contains the device ID and device name of all the audio recording devices.