2014-02-06 33 views
1

我很新,对不起我的英语。 我正在使用WebRTC视频通话,我关注并在本地运行其apprtc.appspot.com其正常运行的Demo应用程序。但我得到以下错误为WebRTc设置rfc5766 TURN服务器

“XMLHttpRequest无法加载https://computeengineondemand.appspot.com/turn?username=83926066&key=4080218913。请求的资源上没有'Access-Control-Allow-Origin'标头,因此Origin''不允许访问。

谷歌搜索后,我发现我必须运行我自己的TURN服务器,如果我必须在全球发布我的应用程序。

我按照这个https://www.dialogic.com/den/developer_forums/f/71/p/10238/38432.aspx 安装TURN服务器我安装了服务器,通过跟着这个和服务器运行。

现在我的问题是如何使用此服务器为我的应用程序?如何设置或获取服务器的URL来调用表单应用程序?

在此先感谢。

+0

您提供已链接有一个明确的答案: VAR pc_config = { “iceServers”:[{ “URL”:“眩晕:眩晕.l.google.com:19302“},{”url“:”turn:my_username @“,”credential“:”my_password“}]}; pc_new = new webkitRTCPeerConnection(pc_config); – Robert

回答

1

我认为,这应该有助于您:

var pcConfig = {}; 
var pcConstraints = {}; 
var turnServer = { 
    username:'authUserNameAsConfiguredOnServer', 
    credential: 'password', 
    url:'turn:YOUR_SERVER_IP_HERE:YOUR_SERVER_PORT_HERE' 
} 
pcConfig.iceServers = [turnServer] 
var pc = new RTCPeerConnection(pcConfig, pcConstraints); 
// use your conn here