mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-03-13 12:40:17 +00:00
get firefox working again
This commit is contained in:
parent
cd398673b2
commit
df7bf942a7
@ -289,7 +289,7 @@
|
||||
|
||||
if (self.options.useVideo) {
|
||||
self.options.useVideo.style.display = 'none';
|
||||
self.options.useVideo[moz ? 'mozSrcObject' : 'src'] = "";
|
||||
self.options.useVideo[moz ? 'mozSrcObject' : 'src'] = null;
|
||||
}
|
||||
|
||||
if (self.localStream) {
|
||||
@ -299,7 +299,7 @@
|
||||
|
||||
if (self.options.localVideo) {
|
||||
self.options.localVideo.style.display = 'none';
|
||||
self.options.localVideo[moz ? 'mozSrcObject' : 'src'] = "";
|
||||
self.options.localVideo[moz ? 'mozSrcObject' : 'src'] = null;
|
||||
}
|
||||
|
||||
if (self.options.localVideoStream) {
|
||||
|
@ -2151,6 +2151,7 @@
|
||||
$.FSRTC.getValidRes(obj.camera, function() {
|
||||
console.info("enumerating devices");
|
||||
|
||||
if (MediaStreamTrack.getSources) {
|
||||
MediaStreamTrack.getSources(function (media_sources) {
|
||||
for (var i = 0; i < media_sources.length; i++) {
|
||||
|
||||
@ -2168,6 +2169,45 @@
|
||||
console.info("Video Devices", $.verto.videoDevices);
|
||||
runtime();
|
||||
});
|
||||
} else {
|
||||
/* of course it's a totally different API CALL with different element names for the same exact thing */
|
||||
|
||||
if (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices) {
|
||||
console.log("enumerateDevices() not supported.");
|
||||
return;
|
||||
}
|
||||
|
||||
// List cameras and microphones.
|
||||
|
||||
navigator.mediaDevices.enumerateDevices()
|
||||
.then(function(devices) {
|
||||
devices.forEach(function(device) {
|
||||
console.log(device);
|
||||
|
||||
console.log(device.kind + ": " + device.label +
|
||||
" id = " + device.deviceId);
|
||||
|
||||
if (device.kind === "videoinput") {
|
||||
vid.push({id: device.deviceId, kind: "video", label: device.label});
|
||||
} else {
|
||||
aud.push({id: device.deviceId, kind: "audio", label: device.label});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$.verto.videoDevices = vid;
|
||||
$.verto.audioDevices = aud;
|
||||
|
||||
console.info("Audio Devices", $.verto.audioDevices);
|
||||
console.info("Video Devices", $.verto.videoDevices);
|
||||
runtime();
|
||||
|
||||
})
|
||||
.catch(function(err) {
|
||||
console.log(err.name + ": " + error.message);
|
||||
runtime();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
11
html5/verto/video_demo/js/verto-min.js
vendored
11
html5/verto/video_demo/js/verto-min.js
vendored
@ -27,9 +27,9 @@ function onRemoteStream(self,stream){if(self.options.useVideo){self.options.useV
|
||||
var element=self.options.useAudio;console.log("REMOTE STREAM",stream,element);if(typeof element.srcObject!=='undefined'){element.srcObject=stream;}else if(typeof element.mozSrcObject!=='undefined'){element.mozSrcObject=stream;}else if(typeof element.src!=='undefined'){element.src=URL.createObjectURL(stream);}else{console.error('Error attaching stream to element.');}
|
||||
self.options.useAudio.play();self.remoteStream=stream;}
|
||||
function onOfferSDP(self,sdp){self.mediaData.SDP=self.stereoHack(sdp.sdp);console.log("Offer SDP");doCallback(self,"onOfferSDP");}
|
||||
$.FSRTC.prototype.answer=function(sdp,onSuccess,onError){this.peer.addAnswerSDP({type:"answer",sdp:sdp},onSuccess,onError);};$.FSRTC.prototype.stop=function(){var self=this;if(self.options.useVideo){self.options.useVideo.style.display='none';self.options.useVideo[moz?'mozSrcObject':'src']="";}
|
||||
$.FSRTC.prototype.answer=function(sdp,onSuccess,onError){this.peer.addAnswerSDP({type:"answer",sdp:sdp},onSuccess,onError);};$.FSRTC.prototype.stop=function(){var self=this;if(self.options.useVideo){self.options.useVideo.style.display='none';self.options.useVideo[moz?'mozSrcObject':'src']=null;}
|
||||
if(self.localStream){self.localStream.stop();self.localStream=null;}
|
||||
if(self.options.localVideo){self.options.localVideo.style.display='none';self.options.localVideo[moz?'mozSrcObject':'src']="";}
|
||||
if(self.options.localVideo){self.options.localVideo.style.display='none';self.options.localVideo[moz?'mozSrcObject':'src']=null;}
|
||||
if(self.options.localVideoStream){self.options.localVideoStream.stop();}
|
||||
if(self.peer){console.log("stopping peer");self.peer.stop();}};$.FSRTC.prototype.getMute=function(){var self=this;return self.enabled;}
|
||||
$.FSRTC.prototype.setMute=function(what){var self=this;var audioTracks=self.localStream.getAudioTracks();for(var i=0,len=audioTracks.length;i<len;i++){switch(what){case"on":audioTracks[i].enabled=true;break;case"off":audioTracks[i].enabled=false;break;case"toggle":audioTracks[i].enabled=!audioTracks[i].enabled;default:break;}
|
||||
@ -116,7 +116,7 @@ $.ajax({url:self.jsonrpcclient.options.ajaxUrl,data:$.toJSON(batch_request),data
|
||||
if(typeof all_done_cb==='function')all_done_cb(result);};})(jQuery);(function($){var sources=[];var generateGUID=(typeof(window.crypto)!=='undefined'&&typeof(window.crypto.getRandomValues)!=='undefined')?function(){var buf=new Uint16Array(8);window.crypto.getRandomValues(buf);var S4=function(num){var ret=num.toString(16);while(ret.length<4){ret="0"+ret;}
|
||||
return ret;};return(S4(buf[0])+S4(buf[1])+"-"+S4(buf[2])+"-"+S4(buf[3])+"-"+S4(buf[4])+"-"+S4(buf[5])+S4(buf[6])+S4(buf[7]));}:function(){return'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,function(c){var r=Math.random()*16|0,v=c=='x'?r:(r&0x3|0x8);return v.toString(16);});};$.verto=function(options,callbacks){var verto=this;$.verto.saved.push(verto);verto.options=$.extend({login:null,passwd:null,socketUrl:null,tag:null,localTag:null,videoParams:{},audioParams:{},loginParams:{},userVariables:{},iceServers:false,ringSleep:6000},options);verto.sessid=$.cookie('verto_session_uuid')||generateGUID();$.cookie('verto_session_uuid',verto.sessid,{expires:1});verto.dialogs={};verto.callbacks=callbacks||{};verto.eventSUBS={};verto.rpcClient=new $.JsonRpcClient({login:verto.options.login,passwd:verto.options.passwd,socketUrl:verto.options.socketUrl,loginParams:verto.options.loginParams,userVariables:verto.options.userVariables,sessid:verto.sessid,onmessage:function(e){return verto.handleMessage(e.eventData);},onWSConnect:function(o){o.call('login',{});},onWSLogin:function(success){if(verto.callbacks.onWSLogin){verto.callbacks.onWSLogin(verto,success);}},onWSClose:function(success){if(verto.callbacks.onWSClose){verto.callbacks.onWSClose(verto,success);}
|
||||
verto.purge();}});if(verto.options.ringFile&&verto.options.tag){verto.ringer=$("#"+verto.options.tag);}
|
||||
verto.rpcClient.call('login',{});};$.verto.prototype.videoParams=function(on){var verto=this;verto.options.videoParams=on;};$.verto.prototype.iceServers=function(on){var verto=this;verto.options.iceServers=on;};$.verto.prototype.loginData=function(params){verto.options.login=params.login;verto.options.passwd=params.passwd;verto.rpcClient.loginData(params);};$.verto.prototype.logout=function(msg){var verto=this;verto.rpcClient.closeSocket();if(verto.callbacks.onWSClose){verto.callbacks.onWSClose(verto,false);}
|
||||
verto.rpcClient.call('login',{});};$.verto.prototype.videoParams=function(on){var verto=this;verto.options.videoParams=on;};$.verto.prototype.iceServers=function(on){var verto=this;verto.options.iceServers=on;};$.verto.prototype.loginData=function(params){var verto=this;verto.options.login=params.login;verto.options.passwd=params.passwd;verto.rpcClient.loginData(params);};$.verto.prototype.logout=function(msg){var verto=this;verto.rpcClient.closeSocket();if(verto.callbacks.onWSClose){verto.callbacks.onWSClose(verto,false);}
|
||||
verto.purge();};$.verto.prototype.login=function(msg){var verto=this;verto.logout();verto.rpcClient.call('login',{});};$.verto.prototype.message=function(msg){var verto=this;var err=0;if(!msg.to){console.error("Missing To");err++;}
|
||||
if(!msg.body){console.error("Missing Body");err++;}
|
||||
if(err){return false;}
|
||||
@ -240,5 +240,6 @@ if(dialog.state.val>=$.verto.enum.state.early.val){dialog.setState($.verto.enum.
|
||||
if(params.display_number){dialog.params.remote_caller_id_number=params.display_number;}
|
||||
dialog.sendMessage($.verto.enum.message.display,{});};$.verto.dialog.prototype.handleMedia=function(params){var dialog=this;if(dialog.state.val>=$.verto.enum.state.early.val){return;}
|
||||
dialog.gotEarly=true;dialog.rtc.answer(params.sdp,function(){console.log("Dialog "+dialog.callID+"Establishing early media");dialog.setState($.verto.enum.state.early);if(dialog.gotAnswer){console.log("Dialog "+dialog.callID+"Answering Channel");dialog.setState($.verto.enum.state.active);}},function(e){console.error(e);dialog.hangup();});console.log("Dialog "+dialog.callID+"EARLY SDP",params.sdp);};$.verto.ENUM=function(s){var i=0,o={};s.split(" ").map(function(x){o[x]={name:x,val:i++};});return Object.freeze(o);};$.verto.enum={};$.verto.enum.states=Object.freeze({new:{requesting:1,recovering:1,ringing:1,destroy:1,answering:1,hangup:1},requesting:{trying:1,hangup:1},recovering:{answering:1,hangup:1},trying:{active:1,early:1,hangup:1},ringing:{answering:1,hangup:1},answering:{active:1,hangup:1},active:{answering:1,requesting:1,hangup:1,held:1},held:{hangup:1,active:1},early:{hangup:1,active:1},hangup:{destroy:1},destroy:{},purge:{destroy:1}});$.verto.enum.state=$.verto.ENUM("new requesting trying recovering ringing answering early active held hangup destroy purge");$.verto.enum.direction=$.verto.ENUM("inbound outbound");$.verto.enum.message=$.verto.ENUM("display info pvtEvent");$.verto.enum=Object.freeze($.verto.enum);$.verto.saved=[];$(window).bind('beforeunload',function(){for(var i in $.verto.saved){var verto=$.verto.saved[i];if(verto){verto.purge();verto.logout();}}
|
||||
return $.verto.warnOnUnload;});$.verto.videoDevices=[];$.verto.audioDevices=[];$.verto.init=function(obj,runtime){var aud=[],vid=[];$.FSRTC.getValidRes(obj.camera,function(){console.info("enumerating devices");MediaStreamTrack.getSources(function(media_sources){for(var i=0;i<media_sources.length;i++){if(media_sources[i].kind=='video'){vid.push(media_sources[i]);}else{aud.push(media_sources[i]);}}
|
||||
$.verto.videoDevices=vid;$.verto.audioDevices=aud;console.info("Audio Devices",$.verto.audioDevices);console.info("Video Devices",$.verto.videoDevices);runtime();});});}})(jQuery);
|
||||
return $.verto.warnOnUnload;});$.verto.videoDevices=[];$.verto.audioDevices=[];$.verto.init=function(obj,runtime){var aud=[],vid=[];$.FSRTC.getValidRes(obj.camera,function(){console.info("enumerating devices");if(MediaStreamTrack.getSources){MediaStreamTrack.getSources(function(media_sources){for(var i=0;i<media_sources.length;i++){if(media_sources[i].kind=='video'){vid.push(media_sources[i]);}else{aud.push(media_sources[i]);}}
|
||||
$.verto.videoDevices=vid;$.verto.audioDevices=aud;console.info("Audio Devices",$.verto.audioDevices);console.info("Video Devices",$.verto.videoDevices);runtime();});}else{if(!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices){console.log("enumerateDevices() not supported.");return;}
|
||||
navigator.mediaDevices.enumerateDevices().then(function(devices){devices.forEach(function(device){console.log(device);console.log(device.kind+": "+device.label+" id = "+device.deviceId);if(device.kind==="videoinput"){vid.push({id:device.deviceId,kind:"video",label:device.label});}else{aud.push({id:device.deviceId,kind:"audio",label:device.label});}});$.verto.videoDevices=vid;$.verto.audioDevices=aud;console.info("Audio Devices",$.verto.audioDevices);console.info("Video Devices",$.verto.videoDevices);runtime();}).catch(function(err){console.log(err.name+": "+error.message);runtime();});}});}})(jQuery);
|
Loading…
x
Reference in New Issue
Block a user