webrtc 流媒体视频只有一侧
webrtc streaming video only one side
我正在尝试制作基于 http://www.html5rocks.com/en/tutorials/webrtc/basics/
的视频聊天应用程序
它在同一个网络中运行良好,
但是当我尝试其他网络时出现以下问题:
- 如果我邀请其他用户,只有其他用户可以看到流
- 如果他邀请我,只有他能看到直播
我认为问题出在 iceservers 上,
我正在使用 [{'url':'stun:stun.l.google.com:19302'}]
关于如何解决这个问题有什么想法吗?
根据您提到的同一篇文章:
If UDP fails, ICE tries TCP: first HTTP, then HTTPS. If direct connection fails—in particular, because of enterprise NAT traversal and firewalls—ICE uses an intermediary (relay) TURN server. In other words, ICE will first use STUN with UDP to directly connect peers and, if that fails, will fall back to a TURN relay server.
如果我没记错的话,你只使用了 STUN 服务器。在这种情况下如果不能直接连接,又没有作为中继的TURN服务器,就不可能建立双向连接。
查看这篇关于如何设置您自己的 TURN 服务器以及所有这些 STUN 和 TURN 内容的文章:http://www.html5rocks.com/en/tutorials/webrtc/infrastructure/
我解决了创建自己的服务器的问题STUN/TURN,现在可以双向连接。
Alaershov 谢谢你的帮助。
我正在尝试制作基于 http://www.html5rocks.com/en/tutorials/webrtc/basics/
的视频聊天应用程序它在同一个网络中运行良好, 但是当我尝试其他网络时出现以下问题:
- 如果我邀请其他用户,只有其他用户可以看到流
- 如果他邀请我,只有他能看到直播
我认为问题出在 iceservers 上, 我正在使用 [{'url':'stun:stun.l.google.com:19302'}]
关于如何解决这个问题有什么想法吗?
根据您提到的同一篇文章:
If UDP fails, ICE tries TCP: first HTTP, then HTTPS. If direct connection fails—in particular, because of enterprise NAT traversal and firewalls—ICE uses an intermediary (relay) TURN server. In other words, ICE will first use STUN with UDP to directly connect peers and, if that fails, will fall back to a TURN relay server.
如果我没记错的话,你只使用了 STUN 服务器。在这种情况下如果不能直接连接,又没有作为中继的TURN服务器,就不可能建立双向连接。
查看这篇关于如何设置您自己的 TURN 服务器以及所有这些 STUN 和 TURN 内容的文章:http://www.html5rocks.com/en/tutorials/webrtc/infrastructure/
我解决了创建自己的服务器的问题STUN/TURN,现在可以双向连接。 Alaershov 谢谢你的帮助。