diff --git a/html5/verto/demo/js/verto-min.js b/html5/verto/demo/js/verto-min.js index 9a520c7da2..28dcf4c105 100644 --- a/html5/verto/demo/js/verto-min.js +++ b/html5/verto/demo/js/verto-min.js @@ -6,7 +6,7 @@ function getCodecPayloadType(sdpLine){var pattern=new RegExp('a=rtpmap:(\\d+) \\ function setDefaultCodec(mLine,payload){var elements=mLine.split(' ');var newLine=[];var index=0;for(var i=0;i=28)TURN={url:'turn:turn.bistri.com:80',credential:'homeo',username:'homeo'};iceServers.iceServers=[STUN];} +getUserMedia({constraints:{audio:true,video:this.options.useVideo?{mandatory:this.options.videoParams,optional:[]}:null},video:this.options.useVideo?true:false,onsuccess:onSuccess,onerror:onError});};window.moz=!!navigator.mozGetUserMedia;function RTCPeerConnection(options){var w=window,PeerConnection=w.mozRTCPeerConnection||w.webkitRTCPeerConnection,SessionDescription=w.mozRTCSessionDescription||w.RTCSessionDescription,IceCandidate=w.mozRTCIceCandidate||w.RTCIceCandidate;var STUN={url:!moz?'stun:stun.l.google.com:19302':'stun:23.21.150.121'};var TURN={url:'turn:homeo@turn.bistri.com:80',credential:'homeo'};var iceServers=null;if(options.iceServers){var tmp=options.iceServers;;if(typeof(tmp)==="boolean"){tmp=null;} +if(tmp&&typeof(tmp)!=="array"){console.warn("iceServers must be an array, reverting to default ice servers");tmp=null;} +iceServers={iceServers:tmp||[STUN]};if(!moz&&!tmp){if(parseInt(navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)[2])>=28)TURN={url:'turn:turn.bistri.com:80',credential:'homeo',username:'homeo'};iceServers.iceServers=[STUN];}} var optional={optional:[]};if(!moz){optional.optional=[{DtlsSrtpKeyAgreement:true},{RtpDataChannels:options.onChannelMessage?true:false}];} var peer=new PeerConnection(iceServers,optional);openOffererChannel();var x=0;peer.onicecandidate=function(event){if(event.candidate){options.onICE(event.candidate);}else{if(options.onICEComplete){options.onICEComplete();} if(options.type=="offer"){if(!moz&&!x&&options.onICESDP){options.onICESDP(peer.localDescription);}}else{if(!x&&options.onICESDP){options.onICESDP(peer.localDescription);}}}};if(options.attachStream)peer.addStream(options.attachStream);if(options.attachStreams&&options.attachStream.length){var streams=options.attachStreams;for(var i=0;i= 28) TURN = { - url: 'turn:turn.bistri.com:80', - credential: 'homeo', - username: 'homeo' + if (options.iceServers) { + var tmp = options.iceServers;; + + if (typeof(tmp) === "boolean") { + tmp = null; + } + + if (tmp && typeof(tmp) !== "array") { + console.warn("iceServers must be an array, reverting to default ice servers"); + tmp = null; + } + + iceServers = { + iceServers: tmp || [STUN] }; - iceServers.iceServers = [STUN]; - } + if (!moz && !tmp) { + if (parseInt(navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)[2]) >= 28) TURN = { + url: 'turn:turn.bistri.com:80', + credential: 'homeo', + username: 'homeo' + }; + + iceServers.iceServers = [STUN]; + } + } var optional = { optional: [] diff --git a/html5/verto/js/src/jquery.verto.js b/html5/verto/js/src/jquery.verto.js index e0d98a44d1..aef3f39a81 100644 --- a/html5/verto/js/src/jquery.verto.js +++ b/html5/verto/js/src/jquery.verto.js @@ -72,6 +72,7 @@ socketUrl: null, tag: null, videoParams: {}, + iceServers: false, ringSleep: 6000 }, options); @@ -1487,6 +1488,7 @@ useAudio: dialog.audioStream, useStereo: dialog.params.useStereo, videoParams: verto.options.videoParams, + iceServers: verto.options.iceServers }); dialog.rtc.verto = dialog.verto;