TgoAudioManager class

Manager for handling audio output and device changes.

This is a singleton class that provides audio control functionality such as switching between speaker and earpiece.

Usage

// Switch to speaker
await TgoRTC.instance.audioManager.setSpeakerphoneOn(true);

// Toggle speaker
await TgoRTC.instance.audioManager.toggleSpeakerphone();

// Check if speaker is on
final isSpeakerOn = TgoRTC.instance.audioManager.isSpeakerOn;

Properties

canSwitchSpeakerphone → bool
是否可以切换扬声器
no setter
currentAudioInputDeviceId → String?
no setter
currentAudioOutputDeviceId → String?
no setter
hashCode → int
The hash code for this object.
no setterinherited
isSpeakerOn → bool
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
speakerOn → bool?
当前是否使用扬声器
no setter

Methods

addDeviceChangeListener(dynamic listener(List<MediaDevice>)) → void
添加设备变化监听
dispose() → void
销毁
getAudioInputDevices() → Future<List<MediaDevice>>
获取音频输入设备列表(麦克风)
getAudioOutputDevices() → Future<List<MediaDevice>>
获取音频输出设备列表(扬声器/耳机)
getDevices(String kind) → Future<List<MediaDevice>>
获取指定类型的设备列表
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeDeviceChangeListener(dynamic listener(List<MediaDevice>)) → void
移除设备变化监听
setSpeakerphoneOn(bool on, {bool forceSpeakerOutput = false}) → Future<void>
切换扬声器/听筒
switchAudioInputDevice(String deviceId, {bool setAsDefault = true}) → Future<bool>
切换音频输入设备(麦克风)
switchAudioOutputDevice(String deviceId, {bool setAsDefault = true}) → Future<bool>
切换音频输出设备(扬声器/耳机)
toggleSpeakerphone() → Future<void>
切换扬声器状态
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

instance → TgoAudioManager
no setter