NEGroupMediaDelegate class
媒体事件回调代理
用于监听 NERtc 媒体相关事件,包括:
- 远端用户音视频状态变更
- 音量回调
- 连接状态变更
- 运行时错误
使用方式:
final delegate = NEGroupMediaDelegate(
onUserAudioStart: (uid) {
print('用户 $uid 开启音频');
},
onUserVideoStart: (uid, maxProfile) {
print('用户 $uid 开启视频');
},
onRemoteAudioVolumeIndication: (volumes, totalVolume) {
for (var info in volumes) {
print('用户 ${info.uid} 音量: ${info.volume}');
}
},
onDisconnect: (reason) {
print('连接断开: $reason');
},
);
NEGroupCallEngine.instance.addGroupMediaDelegate(delegate);
Constructors
-
NEGroupMediaDelegate({void onUserAudioStart(int uid)?, void onUserAudioStop(int uid)?, void onUserAudioMute(int uid, bool muted)?, void onUserVideoStart(int uid, int maxProfile)?, void onUserVideoStop(int uid)?, void onUserVideoMute(int uid, bool muted)?, void onRemoteAudioVolumeIndication(List<
NEAudioVolumeInfo> volumes, int totalVolume)?, void onDisconnect(int reason)?, void onError(int code)?}) -
构造函数
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- onDisconnect → void Function(int reason)?
-
与服务器连接中断回调
final
- onError → void Function(int code)?
-
音视频组件运行时错误回调
final
-
onRemoteAudioVolumeIndication
→ void Function(List<
NEAudioVolumeInfo> volumes, int totalVolume)? -
远端用户音量回调
final
- onUserAudioMute → void Function(int uid, bool muted)?
-
远端用户音频静音状态变更回调
final
- onUserAudioStart → void Function(int uid)?
-
远端用户开启音频回调
final
- onUserAudioStop → void Function(int uid)?
-
远端用户关闭音频回调
final
- onUserVideoMute → void Function(int uid, bool muted)?
-
远端用户视频静音状态变更回调
final
- onUserVideoStart → void Function(int uid, int maxProfile)?
-
远端用户开启视频回调
final
- onUserVideoStop → void Function(int uid)?
-
远端用户关闭视频回调
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited