feat: ice断开返回配置页面
This commit is contained in:
@@ -29,6 +29,9 @@ class WebRtcController {
|
||||
void Function(String error)? onConnectionFailed;
|
||||
void Function()? onDisconnected;
|
||||
|
||||
/// ICE 连接断开(如网络中断、被控端退出),用于提示用户并返回连接设置。
|
||||
void Function(String message)? onIceDisconnected;
|
||||
|
||||
/// 远端视频流就绪(renderer 已绑定视频轨道)。
|
||||
void Function(RTCVideoRenderer renderer)? onRemoteStream;
|
||||
|
||||
@@ -124,7 +127,10 @@ class WebRtcController {
|
||||
print('ICE connection state: $state');
|
||||
if (state == RTCIceConnectionState.RTCIceConnectionStateConnected) {
|
||||
onConnectionEstablished?.call();
|
||||
} else if (state == RTCIceConnectionState.RTCIceConnectionStateDisconnected) {
|
||||
onIceDisconnected?.call('ICE 连接已断开');
|
||||
} else if (state == RTCIceConnectionState.RTCIceConnectionStateFailed) {
|
||||
onConnectionFailed?.call('ICE 连接失败');
|
||||
onDisconnected?.call();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user