- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在标准规范中,它说您可以将 ENUM 值设置为“中继”:http://dev.w3.org/2011/webrtc/editor/webrtc.html#idl-def-RTCIceServer
但是,您如何使用以下 Javascript 将枚举设置为“中继”?if (tmp.indexOf("typ relay ") >= 0) {
在我的测试中从未发生过。我怎样才能强制它枚举“中继”?
或者
是BUG吗? https://code.google.com/p/webrtc/issues/detail?id=1179
任何想法。
function createPeerConnection() {
try {
// Create an RTCPeerConnection via the polyfill (adapter.js).
pc = new RTCPeerConnection(pcConfig, pcConstraints);
pc.onicecandidate = onIceCandidate;
console.log('Created RTCPeerConnnection with:\n' +
' config: \'' + JSON.stringify(pcConfig) + '\';\n' +
' constraints: \'' + JSON.stringify(pcConstraints) + '\'.');
} catch (e) {
console.log('Failed to create PeerConnection, exception: ' + e.message);
alert('Cannot create RTCPeerConnection object; \
WebRTC is not supported by this browser.');
return;
}
pc.onaddstream = onRemoteStreamAdded;
pc.onremovestream = onRemoteStreamRemoved;
pc.onsignalingstatechange = onSignalingStateChanged;
pc.oniceconnectionstatechange = onIceConnectionStateChanged;
}
function onIceCandidate(event) {
if (event.candidate) {
var tmp = event.candidate.candidate;
if (tmp.indexOf("typ relay ") >= 0) {
/////////////////////////////////////////// NEVER happens
sendMessage({type: 'candidate',
label: event.candidate.sdpMLineIndex,
id: event.candidate.sdpMid,
candidate: tmp});
noteIceCandidate("Local", iceCandidateType(tmp));
}
} else {
console.log('End of candidates.');
}
}
最佳答案
有一个 Chrome 扩展程序,WebRTC Network Limiter ,即通过更改 Chrome 的隐私设置来配置 WebRTC 的网络流量的路由方式。您可以强制流量通过 TURN,而无需进行任何 SDP 修改。
编辑 1
在扩展中提供此功能的目的是为担心其安全性的用户提供。您可以查看this关于 WebRTC 安全性的优秀帖子。与此扩展相同,也可以在 FF 中通过更改标志 media.peerconnection.ice.relay_only
来完成.这可以在 about:config
中找到。 .不知道其他两个,但我敢打赌他们确实有类似的东西。
另一方面,如果您正在分发一个应用程序并希望您的所有客户都通过 TURN,您将无法访问他们的浏览器,并且不能指望他们更改这些标志或安装任何扩展。在这种情况下,您将不得不破坏您的 SDP。您可以使用此代码
function onIceCandidate(event) {
if (event.candidate) {
var type = event.candidate.candidate.split(" ")[7];
if (type != "relay") {
trace("ICE - Created " + type + " candidate ignored: TURN only mode.");
return;
} else {
sendCandidateMessage(candidate);
trace("ICE - Sending " + type + " candidate.");
}
} else {
trace("ICE - End of candidate generation.");
}
}
iceTransportPolicy: "relay"
在您的 WebRtcPeer 配置中强制 TURN:
var options = {
localVideo: videoInput, //if you want to see what you are sharing
onicecandidate: onIceCandidate,
mediaConstraints: constraints,
sendSource: 'screen',
iceTransportPolicy: 'relay',
iceServers: [{ urls: 'turn:XX.XX.XX.XX', username:'user', credential:'pass' }]
}
webRtcPeerScreencast = kurentoUtils.WebRtcPeer.WebRtcPeerSendrecv(options, function(error) {
if (error) return onError(error) //use whatever you use for handling errors
this.generateOffer(onOffer)
});
关于javascript - WebRTC - 如何设置始终使用 TURN 服务器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22130311/
我一直在探索 Mapbox Map SDK 和 Navigation SDK,但遇到了瓶颈,如有任何帮助,我们将不胜感激。 我在 GeoJSON 中定义了一些路由。是否可以将 GeoJSON 中的这条
我在 C 中有两个静态可变变量,我想在逻辑语句中检查它们。但是,当我这样做时,我收到警告“未定义的行为:此语句 1037 中未定义 volatile 访问的顺序”是否有可能在很短的时间内暂停 C 变量
有没有像 googlemaps 应用程序和 mapkit 那样做 turn-by-turn mapping 的方法?就像下面的图片。谢谢 最佳答案 我猜你想在你的应用程序中使用精细导航?在 MapKi
我正在构建一个 Android 应用程序,帮助用户在两点之间导航。这是 doc 的链接.这正是我想要提供给用户的功能,但是我希望导航在我的应用程序中进行,而不是通过以这种方式启动 Intent Uri
我正在开发从当前位置到目的地的转弯导航。我使用以下代码完成了此操作 Uri gmmIntentUri = Uri.parse("google.navigation:q="+address); Inte
假设我有一个控制 android 服务的开关:当Switch处于“on”状态时,表示服务正在运行,当开关处于“关闭”位置时,表示服务未运行。此外,当用户点击 Switch 时,它应该切换服务(因此切换
我正在尝试实现一种算法来填充一个区域,该特定算法在以下 Wikipedia 中给出“固定内存法(右手填充法)”标题下的文档。下面给出算法中发生左转和右转的特定部分... START: set
我正在使用 HERE NOKIA SDK。我已经在 2 点和语音指令之间创建了一条路线。现在我想显示图像箭头和操作的特定文本。 最佳答案 SDK不提供回合图标。请创建一些图像以将它们与机动转弯类型配对
我的应用程序需要像 OLA、UBER 和出租车出租应用程序一样包含转弯 GPS 导航。我使用 Google Direction API 来显示路径和持续时间。我检查了以下链接,但对我没有帮助。 gps
我的应用需要包含转弯 gps 导航。任何人都可以告诉如何通过转弯 gps 导航集成谷歌地图。 我可以在android开发中找到它。但是我无法从谷歌地图的 iOS 开发文档中找到导航。 https://
构建时出现以下错误: ...has undefined behavior [-Werror,-Wundefined-reinterpret-cast] Bazel 构建完全停止,因为 clang (l
如何关闭 Rmd HTML 文档中的标题? --- title: "" output: html_document --- rmarkdown::render("index.Rmd") [WARNIN
我试图使用 部署一个简单的 TURN 服务器coturn . 当我在 Trickle ICE 上测试时( turn:rtc.jackxujh.me:3478 [webrtc:mighty] ),Tri
我正在使用一个任性的库,不幸的是,它会将信息打印到 System.out(或偶尔打印到 System.err)。防止这种情况的最简单方法是什么? 我一直在考虑创建一个输出流到内存,在每次调用其中一个麻
比如说我搭建了WebRTC视频聊天网站,有的握手后连接(ICE Candidates)会直接p2p,有的会使用STUN服务器,有的会使用“不得已”的TURN服务器建立连接.与直接连接和 STUN 连接
我在查找有关如何“打开”mysqli 的确切文档时遇到了麻烦。我正在运行 OS X SL,据我所知,由于安装了 php5,mysqli 扩展也应该已经存在。 这是否像在 php.ini 中添加 Loa
在我的 Ubuntu 引擎上设计了一个简单的基于 shell/bash 的备份脚本并使其工作后,我将它上传到了我的 Debian 服务器,它在执行它时会输出一些错误。 我该怎么做才能在我的 Ubunt
我正在使用 Twilio Network Traversal Service作为 native 应用程序的一部分,我是 working on执行对等远程桌面连接。我们实现了 WebRTC 协议(pro
我正在尝试将负载均衡器放在 Turn 服务器前面以与 WebRTC 一起使用。我在下面的示例中使用了一个轮流服务器,直到负载平衡器正常工作。 Turn 服务器需要多个端口,包括一个 UDP,如下所示:
在哪些情况下我应该使用 TURN 服务器? 现在我有一个完美运行的 WebRTC 应用程序。该应用程序即将发布。 我是否需要设置自己的 TURN 服务器,或者这可能仅适用于主要应用程序? 最佳答案 已
我是一名优秀的程序员,十分优秀!