Video SDK v3.7.1 API Reference for Unity
Public Member Functions | List of all members
agora_gaming_rtc.AudioPlaybackDeviceManager Class Reference

Inherits agora_gaming_rtc.IAudioPlaybackDeviceManager.

Public Member Functions

override bool CreateAAudioPlaybackDeviceManager ()
 
override int ReleaseAAudioPlaybackDeviceManager ()
 
override int GetAudioPlaybackDeviceCount ()
 
override int GetAudioPlaybackDevice (int index, ref string deviceName, ref string deviceId)
 
override int GetAudioPlaybackDefaultDevice (ref string deviceName, ref string deviceId)
 
override int GetCurrentPlaybackDevice (ref string deviceId)
 
override int SetAudioPlaybackDevice (string deviceId)
 
override int SetAudioPlaybackDeviceVolume (int volume)
 
override int GetAudioPlaybackDeviceVolume ()
 
override int SetAudioPlaybackDeviceMute (bool mute)
 
override bool IsAudioPlaybackDeviceMute ()
 
override int StartAudioPlaybackDeviceTest (string testAudioFilePath)
 
override int StopAudioPlaybackDeviceTest ()
 
override int GetCurrentPlaybackDeviceInfo (ref string deviceName, ref string deviceId)
 
override int FollowSystemPlaybackDevice (bool enable)
 

Detailed Description

The definition of AudioPlaybackDeviceManager. The APIs of this class are only available on Windows and macOS.

Member Function Documentation

◆ GetInstance()

static AudioPlaybackDeviceManager agora_gaming_rtc.AudioPlaybackDeviceManager.GetInstance ( IRtcEngine  rtcEngine)
static

◆ ReleaseInstance()

static void agora_gaming_rtc.AudioPlaybackDeviceManager.ReleaseInstance ( )
static

◆ SetEngine()

void agora_gaming_rtc.AudioPlaybackDeviceManager.SetEngine ( IRtcEngine  engine)

◆ CreateAAudioPlaybackDeviceManager()

override bool agora_gaming_rtc.AudioPlaybackDeviceManager.CreateAAudioPlaybackDeviceManager ( )
virtual

Create an IAudioPlaybackDeviceManager instance.

Note
Ensure that you call ReleaseAAudioPlaybackDeviceManager to release this instance after calling this method.
Returns
  • true: Success.
  • false: Failure.

Implements agora_gaming_rtc.IAudioPlaybackDeviceManager.

◆ ReleaseAAudioPlaybackDeviceManager()

override int agora_gaming_rtc.AudioPlaybackDeviceManager.ReleaseAAudioPlaybackDeviceManager ( )
virtual

Release an IAudioPlaybackDeviceManager instance.

Returns
  • 0: Success.
  • < 0: Failure.

Implements agora_gaming_rtc.IAudioPlaybackDeviceManager.

◆ GetAudioPlaybackDeviceCount()

override int agora_gaming_rtc.AudioPlaybackDeviceManager.GetAudioPlaybackDeviceCount ( )
virtual

Retrieves the total number of the indexed audio playback devices in the system.

Returns
Total number of the indexed audio playback devices.

Implements agora_gaming_rtc.IAudioPlaybackDeviceManager.

◆ GetAudioPlaybackDevice()

override int agora_gaming_rtc.AudioPlaybackDeviceManager.GetAudioPlaybackDevice ( int  index,
ref string  deviceName,
ref string  deviceId 
)
virtual

Retrieves the audio playback device associated with the index.

After calling this method, the SDK retrieves the device name and device ID according to the index.

Note
Call GetAudioPlaybackDeviceCount before this method.
Parameters
indexThe index of the playback device in the system. The value of index is associated with the number of the playback device which is retrieved from GetAudioPlaybackDeviceCount. For example, when the number of playback devices is 3, the value range of index is [0,2].
deviceNameThe name of the playback device for the corresponding index.
deviceIdThe ID of the playback device for the corresponding index.
Returns
  • 0: Success.
  • < 0: Failure.

Implements agora_gaming_rtc.IAudioPlaybackDeviceManager.

◆ GetAudioPlaybackDefaultDevice()

override int agora_gaming_rtc.AudioPlaybackDeviceManager.GetAudioPlaybackDefaultDevice ( ref string  deviceName,
ref string  deviceId 
)
virtual

Gets the default audio playback device of the system.

Since
v3.6.1.1
Parameters
deviceNameThe name of the system default audio device.
deviceIdThe device ID of the the system default audio device.
Returns
  • 0: Success.
  • < 0: Failure.

Implements agora_gaming_rtc.IAudioPlaybackDeviceManager.

◆ GetCurrentPlaybackDevice()

override int agora_gaming_rtc.AudioPlaybackDeviceManager.GetCurrentPlaybackDevice ( ref string  deviceId)
virtual

Retrieves the device ID of the current audio playback device.

Parameters
deviceIdThe device ID of the current audio playback device.
Returns
  • 0: Success.
  • < 0: Failure.

Implements agora_gaming_rtc.IAudioPlaybackDeviceManager.

◆ SetAudioPlaybackDevice()

override int agora_gaming_rtc.AudioPlaybackDeviceManager.SetAudioPlaybackDevice ( string  deviceId)
virtual

Sets the audio playback device using the device ID.

Note
  • Call GetAudioPlaybackDevice before this method.
  • Plugging or unplugging the audio device does not change the device ID.
Parameters
deviceIdDevice ID of the audio playback device, retrieved by calling GetAudioPlaybackDevice.
Returns
  • 0: Success.
  • < 0: Failure.

Implements agora_gaming_rtc.IAudioPlaybackDeviceManager.

◆ SetAudioPlaybackDeviceVolume()

override int agora_gaming_rtc.AudioPlaybackDeviceManager.SetAudioPlaybackDeviceVolume ( int  volume)
virtual

Sets the volume of the current audio playback device.

Parameters
volumeThe volume of the current audio playback device. The value ranges between 0 (lowest volume) and 255 (highest volume).
Returns
  • 0: Success.
  • < 0: Failure.

Implements agora_gaming_rtc.IAudioPlaybackDeviceManager.

◆ GetAudioPlaybackDeviceVolume()

override int agora_gaming_rtc.AudioPlaybackDeviceManager.GetAudioPlaybackDeviceVolume ( )
virtual

Retrieves the volume of the current audio playback device.

Returns
  • The volume of the current audio playback device, if this method call succeeds.
  • < 0: Failure.

Implements agora_gaming_rtc.IAudioPlaybackDeviceManager.

◆ SetAudioPlaybackDeviceMute()

override int agora_gaming_rtc.AudioPlaybackDeviceManager.SetAudioPlaybackDeviceMute ( bool  mute)
virtual

Sets whether to stop audio playback.

Parameters
muteSets whether to stop audio playback.
  • true: Stops.
  • false: Doesn't stop.
Returns
  • 0: Success.
  • < 0: Failure.

Implements agora_gaming_rtc.IAudioPlaybackDeviceManager.

◆ IsAudioPlaybackDeviceMute()

override bool agora_gaming_rtc.AudioPlaybackDeviceManager.IsAudioPlaybackDeviceMute ( )
virtual

Retrieves the status of the current audio playback device.

Returns
Whether the current audio playback device stops audio playback.
  • true: Stops.
  • false: Doesn't stop.

Implements agora_gaming_rtc.IAudioPlaybackDeviceManager.

◆ StartAudioPlaybackDeviceTest()

override int agora_gaming_rtc.AudioPlaybackDeviceManager.StartAudioPlaybackDeviceTest ( string  testAudioFilePath)
virtual

Starts the test of the current audio playback device.

This method tests whether the audio playback device works properly. Once a user starts the test, the SDK plays an audio file specified by the user. If the user can hear the audio, the playback device works properly.

As of v3.7.0, you can call this method either before or after joining a channel. Depending on the call sequence, the SDK triggers the following callbacks every 100 ms to report the volume of the audio playback device:

  • OnVolumeIndicationHandler and OnAudioDeviceTestVolumeIndicationHandler when you call this method before joining the channel, with the following values:

    • uid = 1 and volume in OnVolumeIndicationHandler.
    • volumeType = AudioTestPlaybackVolume(1) and volume in OnAudioDeviceTestVolumeIndicationHandler.

    The two callbacks report the same volume information. Agora recommends using OnAudioDeviceTestVolumeIndicationHandler.

  • OnAudioDeviceTestVolumeIndication when you call this method after joining a channel, which reports volumeType = AudioTestPlaybackVolume(1) and volume.
    Note
  • Calling this method after joining a channel tests the audio playback device that the SDK is using.
  • After calling startPlaybackDeviceTest, you must call StopAudioPlaybackDeviceTest to stop the test.
  • This method applies to macOS and Windows only.
Parameters
testAudioFilePathThe path of the audio file for the audio playback device test in UTF-8:
  • Supported file formats: wav, mp3, m4a, and aac.
  • Supported file sample rates: 8000, 16000, 32000, 44100, and 48000 Hz.
Returns
  • 0: Success, and you can hear the sound of the specified audio file.
  • < 0: Failure.

Implements agora_gaming_rtc.IAudioPlaybackDeviceManager.

◆ StopAudioPlaybackDeviceTest()

override int agora_gaming_rtc.AudioPlaybackDeviceManager.StopAudioPlaybackDeviceTest ( )
virtual

Stops the test of the current audio playback device.

Note
Ensure that you call this method to stop the test after calling StartAudioPlaybackDeviceTest.
Returns
  • 0: Success.
  • < 0: Failure.

Implements agora_gaming_rtc.IAudioPlaybackDeviceManager.

◆ GetCurrentPlaybackDeviceInfo()

override int agora_gaming_rtc.AudioPlaybackDeviceManager.GetCurrentPlaybackDeviceInfo ( ref string  deviceName,
ref string  deviceId 
)
virtual

Retrieves the device information of the current audio playback device.

Parameters
deviceNameThe device name of the current audio playback device.
deviceIdThe device ID of the current audio playback device.
Returns
  • 0: Success.
  • < 0: Failure.

Implements agora_gaming_rtc.IAudioPlaybackDeviceManager.

◆ FollowSystemPlaybackDevice()

override int agora_gaming_rtc.AudioPlaybackDeviceManager.FollowSystemPlaybackDevice ( bool  enable)
virtual

Sets the audio playback device used by the SDK to follow the system default audio playback device.

Since
v3.6.1.1
Parameters
enableWhether to follow the system default audio playback device:
  • true: Follow. The SDK immediately switches the audio playback device when the system default audio playback device changes.
  • false: Do not follow. The SDK switches the audio playback device to the system default audio playback device only when the currently used audio playback device is disconnected.
Returns
  • 0: Success.
  • < 0: Failure.

Implements agora_gaming_rtc.IAudioPlaybackDeviceManager.


The documentation for this class was generated from the following file: