feat: 目标不在线时进行提示和更新UI

This commit is contained in:
2026-07-14 16:40:41 +08:00
parent 67c7e48190
commit d43c0331b6
4 changed files with 80 additions and 4 deletions

View File

@@ -30,6 +30,9 @@ class RemoteController {
/// ICE 连接断开(用于提示用户并返回连接设置)。
void Function(String message)? onIceDisconnected;
/// 目标被控端不在线(服务器回送 TARGET_OFFLINE用于提示用户并复位 UI
void Function(String message)? onTargetOffline;
/// 远端视频渲染器就绪。
void Function(RTCVideoRenderer renderer)? onRemoteStream;
@@ -92,6 +95,11 @@ class RemoteController {
final payload = jsonDecode(message.payload!) as Map<String, dynamic>;
_webRtc?.handleIceCandidate(payload);
break;
case 'TARGET_OFFLINE':
final text = message.payload ?? '目标被控端不在线,请确认设备已开启并连接服务器';
onStatusChanged?.call('状态: $text');
onTargetOffline?.call(text);
break;
}
}