Files
VibeCoding/webrtc_controller_flutter/lib/config/ice_servers.dart
tongtongstudio 8935dc93d2 fix(webrtc): 修正ICE服务器配置并增强连接诊断日志
修正Flutter控制端TURN凭据错误,移除不可达的内网地址,新增TCP中继候选与详细的ICE状态/候选日志,以解决iOS模拟器下ICE连接失败问题。
2026-07-31 21:26:14 +08:00

38 lines
1.5 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/// ICE 服务器配置。
///
/// 与可正常连接的 `webrtc_controller_ios`(原生 Swift 项目)保持一致:
/// 使用 `www.ttstd.com:3478` 作为 STUN/TURN 服务器。
///
/// 注意:旧配置曾误用 `175.178.213.60:3478`(错误凭据)及内网
/// `192.168.5.224:3478`(模拟器不可达),导致 iOS 模拟器下
/// `ICE Checking -> Failed`。已修正为与 iOS 原生项目相同的服务器。
/// ICE 服务器配置。
///
/// 与「被控端 Android」完全一致同一台 TURN 服务器、同一凭据),
/// 并额外补充 `?transport=tcp` 的 TURN 候选作为 iOS 模拟器兜底:
/// - 被控端已用 `175.178.213.60:3478`fanhuitong / Fan19961907..)成功产出
/// relay 候选(见日志 `relay raddr 175.178.213.60`),故控制端用同一台、
/// 同一凭据即可在 TURN 中继相遇;
/// - 内网 `192.168.5.224` 在模拟器上不可达,已排除;
/// - 模拟器 UDP 不稳,保留 TCP 中继候选。
const List<Map<String, dynamic>> kIceServers = [
{'urls': 'stun:stun.l.google.com:19302'},
{'urls': 'stun:175.178.213.60:3478'},
{
'urls': 'turn:175.178.213.60:3478',
'username': 'fanhuitong',
'credential': 'Fan19961907..',
},
{
'urls': 'turn:175.178.213.60:3478?transport=tcp',
'username': 'fanhuitong',
'credential': 'Fan19961907..',
},
];
/// 信令 WebSocket 默认地址。
const String kDefaultSignalServer = 'wss://www.ttstd.com/signal';
/// DataChannel 标签,控制端与被控端需一致。
const String kDataChannelLabel = 'control_channel';