Files
VibeCoding/webrtc_controller_flutter/lib/app/constants/ice_servers.dart
tongtongstudio d5e66a1777 docs(webrtc_controller_flutter): 更新项目文档以反映重构后的架构
AGENTS.md 与 README.md 同步更新:根据实际代码结构重写目录树、技术栈、架构分层及编码规范,移除旧版内联示例并补充新的开发约定与代码生成命令。
2026-08-03 16:12:44 +08:00

49 lines
1.8 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 原生项目相同的服务器。
///
/// **iOS 模拟器关键修复**
/// 明文 `turn:175.178.213.60:3478` 在 iOS 模拟器libwebrtc下不会发起
/// RELAY 分配请求,导致控制端本地候选缺失 `typ relay`,两端无公共中继可
/// 配对 → candidate-pair=0 → ICE FailedAndroid 真机/网页则正常)。
/// 改用 `turns:`TLS over TCP 5349模拟器能稳定拿到 relay 候选。
/// 同时保留 udp / tcp 明文项作为降级,以及 STUN 用于 srflx。
const List<Map<String, dynamic>> kIceServers = [
{'urls': 'stun:stun.l.google.com:19302'},
{'urls': 'stun:175.178.213.60:3478'},
{
// 首选TLS over TCPiOS 模拟器下能稳定分配 relay 候选。
'urls': 'turns:175.178.213.60:5349',
'username': 'fanhuitong',
'credential': 'Fan19961907..',
},
{
// 降级:明文 UDP/TCP。
'urls': 'turn:175.178.213.60:3478',
'username': 'fanhuitong',
'credential': 'Fan19961907..',
},
{
'urls': 'turn:175.178.213.60:3478?transport=tcp',
'username': 'fanhuitong',
'credential': 'Fan19961907..',
},
{'urls': 'stun:47.242.112.133:3478'},
{
'urls': 'turn:47.242.112.133:3478',
'username': 'ttstd',
'credential': 'fanhuitong',
},
{'urls': 'stun:192.168.5.224:3478'},
{
'urls': 'turn:192.168.5.224:3478',
'username': 'tt',
'credential': 'fht',
},
];