mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-26 12:37:26 +00:00
FS-10688: [verto.js] Add hack for IOS11 #resolve
This commit is contained in:
parent
9e5b680084
commit
dacca35a18
@ -244,12 +244,12 @@
|
|||||||
self.options.useVideo.style.display = 'block';
|
self.options.useVideo.style.display = 'block';
|
||||||
|
|
||||||
// Hacks for Mobile Safari
|
// Hacks for Mobile Safari
|
||||||
|
var iOS = ['iPad', 'iPhone', 'iPod'].indexOf(navigator.platform) >= 0;
|
||||||
|
|
||||||
|
if (iOS) {
|
||||||
self.options.useVideo.setAttribute("playsinline", true);
|
self.options.useVideo.setAttribute("playsinline", true);
|
||||||
self.options.useVideo.setAttribute("controls", true);
|
self.options.useVideo.setAttribute("controls", true);
|
||||||
setTimeout(function() {
|
}
|
||||||
self.options.useVideo.removeAttribute("controls");
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var element = self.options.useAudio;
|
var element = self.options.useAudio;
|
||||||
@ -487,7 +487,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (obj.options.useMic !== "any") {
|
if (obj.options.useMic !== "any") {
|
||||||
//audio.optional = [{sourceId: obj.options.useMic}]
|
//audio.optional = [{sourceId: obj.options.useMic}];
|
||||||
audio.deviceId = {exact: obj.options.useMic};
|
audio.deviceId = {exact: obj.options.useMic};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ function onICESDP(self,sdp){self.mediaData.SDP=self.stereoHack(sdp.sdp);console.
|
|||||||
function onAnswerSDP(self,sdp){self.answer.SDP=self.stereoHack(sdp.sdp);console.log("ICE ANSWER SDP");doCallback(self,"onAnswerSDP",self.answer.SDP);}
|
function onAnswerSDP(self,sdp){self.answer.SDP=self.stereoHack(sdp.sdp);console.log("ICE ANSWER SDP");doCallback(self,"onAnswerSDP",self.answer.SDP);}
|
||||||
function onMessage(self,msg){console.log("Message");doCallback(self,"onICESDP",msg);}
|
function onMessage(self,msg){console.log("Message");doCallback(self,"onICESDP",msg);}
|
||||||
FSRTCattachMediaStream=function(element,stream){if(typeof element.srcObject!=='undefined'){element.srcObject=stream;}else if(typeof element.src!=='undefined'){element.src=URL.createObjectURL(stream);}else{console.error('Error attaching stream to element.');}}
|
FSRTCattachMediaStream=function(element,stream){if(typeof element.srcObject!=='undefined'){element.srcObject=stream;}else if(typeof element.src!=='undefined'){element.src=URL.createObjectURL(stream);}else{console.error('Error attaching stream to element.');}}
|
||||||
function onRemoteStream(self,stream){if(self.options.useVideo){self.options.useVideo.style.display='block';self.options.useVideo.setAttribute("playsinline",true);self.options.useVideo.setAttribute("controls",true);setTimeout(()=>{self.options.useVideo.removeAttribute("controls");});}
|
function onRemoteStream(self,stream){if(self.options.useVideo){self.options.useVideo.style.display='block';var iOS=['iPad','iPhone','iPod'].indexOf(navigator.platform)>=0;if(iOS){self.options.useVideo.setAttribute("playsinline",true);self.options.useVideo.setAttribute("controls",true);}}
|
||||||
var element=self.options.useAudio;console.log("REMOTE STREAM",stream,element);FSRTCattachMediaStream(element,stream);self.remoteStream=stream;}
|
var element=self.options.useAudio;console.log("REMOTE STREAM",stream,element);FSRTCattachMediaStream(element,stream);self.remoteStream=stream;}
|
||||||
function onOfferSDP(self,sdp){self.mediaData.SDP=self.stereoHack(sdp.sdp);console.log("Offer SDP");doCallback(self,"onOfferSDP");}
|
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.stopPeer=function(){if(self.peer){console.log("stopping peer");self.peer.stop();}}
|
$.FSRTC.prototype.answer=function(sdp,onSuccess,onError){this.peer.addAnswerSDP({type:"answer",sdp:sdp},onSuccess,onError);};$.FSRTC.prototype.stopPeer=function(){if(self.peer){console.log("stopping peer");self.peer.stop();}}
|
||||||
@ -55,8 +55,7 @@ $.FSRTC.prototype.call=function(profile){checkCompat();var self=this;var screen=
|
|||||||
function onSuccess(stream){self.localStream=stream;if(screen){self.constraints.offerToReceiveVideo=false;self.constraints.offerToReceiveAudio=false;self.constraints.offerToSendAudio=false;}
|
function onSuccess(stream){self.localStream=stream;if(screen){self.constraints.offerToReceiveVideo=false;self.constraints.offerToReceiveAudio=false;self.constraints.offerToSendAudio=false;}
|
||||||
self.peer=FSRTCPeerConnection({type:self.type,attachStream:self.localStream,onICE:function(candidate){return onICE(self,candidate);},onICEComplete:function(){return onICEComplete(self);},onRemoteStream:screen?function(stream){}:function(stream){return onRemoteStream(self,stream);},onOfferSDP:function(sdp){return onOfferSDP(self,sdp);},onICESDP:function(sdp){return onICESDP(self,sdp);},onChannelError:function(e){return onChannelError(self,e);},constraints:self.constraints,iceServers:self.options.iceServers,});onStreamSuccess(self,stream);}
|
self.peer=FSRTCPeerConnection({type:self.type,attachStream:self.localStream,onICE:function(candidate){return onICE(self,candidate);},onICEComplete:function(){return onICEComplete(self);},onRemoteStream:screen?function(stream){}:function(stream){return onRemoteStream(self,stream);},onOfferSDP:function(sdp){return onOfferSDP(self,sdp);},onICESDP:function(sdp){return onICESDP(self,sdp);},onChannelError:function(e){return onChannelError(self,e);},constraints:self.constraints,iceServers:self.options.iceServers,});onStreamSuccess(self,stream);}
|
||||||
function onError(e){onStreamError(self,e);}
|
function onError(e){onStreamError(self,e);}
|
||||||
var mediaParams=getMediaParams(self);console.log("Audio constraints",mediaParams.audio);console.log("Video constraints",mediaParams.video);if(mediaParams.audio||mediaParams.video){getUserMedia({constraints:{audio:mediaParams.audio,video:mediaParams.video},video:mediaParams.useVideo,onsuccess:onSuccess,onerror:onError});}else{onSuccess(null);}};function FSRTCPeerConnection(options){var gathering=false,done=false;var config={};var default_ice;if(navigator.appVersion.indexOf('Edge')>-1){default_ice={urls:['turn:turn-testdrive.cloudapp.net:3478?transport=udp'],username:"redmond",credential:"redmond123"};}else{default_ice={urls:['stun:stun.l.google.com:19302']}}
|
var mediaParams=getMediaParams(self);console.log("Audio constraints",mediaParams.audio);console.log("Video constraints",mediaParams.video);if(mediaParams.audio||mediaParams.video){getUserMedia({constraints:{audio:mediaParams.audio,video:mediaParams.video},video:mediaParams.useVideo,onsuccess:onSuccess,onerror:onError});}else{onSuccess(null);}};function FSRTCPeerConnection(options){var gathering=false,done=false;var config={};var default_ice={urls:['stun:stun.l.google.com:19302']};if(options.iceServers){if(typeof(options.iceServers)==="boolean"){config.iceServers=[default_ice];}else{config.iceServers=options.iceServers;}}
|
||||||
if(options.iceServers){if(typeof(options.iceServers)==="boolean"){config.iceServers=[default_ice];}else{config.iceServers=options.iceServers;}}
|
|
||||||
var peer=new window.RTCPeerConnection(config);openOffererChannel();var x=0;function ice_handler(){done=true;gathering=null;if(options.onICEComplete){options.onICEComplete();}
|
var peer=new window.RTCPeerConnection(config);openOffererChannel();var x=0;function ice_handler(){done=true;gathering=null;if(options.onICEComplete){options.onICEComplete();}
|
||||||
if(options.type=="offer"){options.onICESDP(peer.localDescription);}else{if(!x&&options.onICESDP){options.onICESDP(peer.localDescription);}}}
|
if(options.type=="offer"){options.onICESDP(peer.localDescription);}else{if(!x&&options.onICESDP){options.onICESDP(peer.localDescription);}}}
|
||||||
peer.onicecandidate=function(event){if(done){return;}
|
peer.onicecandidate=function(event){if(done){return;}
|
||||||
|
5
html5/verto/video_demo/js/verto-min.js
vendored
5
html5/verto/video_demo/js/verto-min.js
vendored
@ -23,7 +23,7 @@ function onICESDP(self,sdp){self.mediaData.SDP=self.stereoHack(sdp.sdp);console.
|
|||||||
function onAnswerSDP(self,sdp){self.answer.SDP=self.stereoHack(sdp.sdp);console.log("ICE ANSWER SDP");doCallback(self,"onAnswerSDP",self.answer.SDP);}
|
function onAnswerSDP(self,sdp){self.answer.SDP=self.stereoHack(sdp.sdp);console.log("ICE ANSWER SDP");doCallback(self,"onAnswerSDP",self.answer.SDP);}
|
||||||
function onMessage(self,msg){console.log("Message");doCallback(self,"onICESDP",msg);}
|
function onMessage(self,msg){console.log("Message");doCallback(self,"onICESDP",msg);}
|
||||||
FSRTCattachMediaStream=function(element,stream){if(typeof element.srcObject!=='undefined'){element.srcObject=stream;}else if(typeof element.src!=='undefined'){element.src=URL.createObjectURL(stream);}else{console.error('Error attaching stream to element.');}}
|
FSRTCattachMediaStream=function(element,stream){if(typeof element.srcObject!=='undefined'){element.srcObject=stream;}else if(typeof element.src!=='undefined'){element.src=URL.createObjectURL(stream);}else{console.error('Error attaching stream to element.');}}
|
||||||
function onRemoteStream(self,stream){if(self.options.useVideo){self.options.useVideo.style.display='block';self.options.useVideo.setAttribute("playsinline",true);self.options.useVideo.setAttribute("controls",true);setTimeout(()=>{self.options.useVideo.removeAttribute("controls");});}
|
function onRemoteStream(self,stream){if(self.options.useVideo){self.options.useVideo.style.display='block';var iOS=['iPad','iPhone','iPod'].indexOf(navigator.platform)>=0;if(iOS){self.options.useVideo.setAttribute("playsinline",true);self.options.useVideo.setAttribute("controls",true);}}
|
||||||
var element=self.options.useAudio;console.log("REMOTE STREAM",stream,element);FSRTCattachMediaStream(element,stream);self.remoteStream=stream;}
|
var element=self.options.useAudio;console.log("REMOTE STREAM",stream,element);FSRTCattachMediaStream(element,stream);self.remoteStream=stream;}
|
||||||
function onOfferSDP(self,sdp){self.mediaData.SDP=self.stereoHack(sdp.sdp);console.log("Offer SDP");doCallback(self,"onOfferSDP");}
|
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.stopPeer=function(){if(self.peer){console.log("stopping peer");self.peer.stop();}}
|
$.FSRTC.prototype.answer=function(sdp,onSuccess,onError){this.peer.addAnswerSDP({type:"answer",sdp:sdp},onSuccess,onError);};$.FSRTC.prototype.stopPeer=function(){if(self.peer){console.log("stopping peer");self.peer.stop();}}
|
||||||
@ -55,8 +55,7 @@ $.FSRTC.prototype.call=function(profile){checkCompat();var self=this;var screen=
|
|||||||
function onSuccess(stream){self.localStream=stream;if(screen){self.constraints.offerToReceiveVideo=false;self.constraints.offerToReceiveAudio=false;self.constraints.offerToSendAudio=false;}
|
function onSuccess(stream){self.localStream=stream;if(screen){self.constraints.offerToReceiveVideo=false;self.constraints.offerToReceiveAudio=false;self.constraints.offerToSendAudio=false;}
|
||||||
self.peer=FSRTCPeerConnection({type:self.type,attachStream:self.localStream,onICE:function(candidate){return onICE(self,candidate);},onICEComplete:function(){return onICEComplete(self);},onRemoteStream:screen?function(stream){}:function(stream){return onRemoteStream(self,stream);},onOfferSDP:function(sdp){return onOfferSDP(self,sdp);},onICESDP:function(sdp){return onICESDP(self,sdp);},onChannelError:function(e){return onChannelError(self,e);},constraints:self.constraints,iceServers:self.options.iceServers,});onStreamSuccess(self,stream);}
|
self.peer=FSRTCPeerConnection({type:self.type,attachStream:self.localStream,onICE:function(candidate){return onICE(self,candidate);},onICEComplete:function(){return onICEComplete(self);},onRemoteStream:screen?function(stream){}:function(stream){return onRemoteStream(self,stream);},onOfferSDP:function(sdp){return onOfferSDP(self,sdp);},onICESDP:function(sdp){return onICESDP(self,sdp);},onChannelError:function(e){return onChannelError(self,e);},constraints:self.constraints,iceServers:self.options.iceServers,});onStreamSuccess(self,stream);}
|
||||||
function onError(e){onStreamError(self,e);}
|
function onError(e){onStreamError(self,e);}
|
||||||
var mediaParams=getMediaParams(self);console.log("Audio constraints",mediaParams.audio);console.log("Video constraints",mediaParams.video);if(mediaParams.audio||mediaParams.video){getUserMedia({constraints:{audio:mediaParams.audio,video:mediaParams.video},video:mediaParams.useVideo,onsuccess:onSuccess,onerror:onError});}else{onSuccess(null);}};function FSRTCPeerConnection(options){var gathering=false,done=false;var config={};var default_ice;if(navigator.appVersion.indexOf('Edge')>-1){default_ice={urls:['turn:turn-testdrive.cloudapp.net:3478?transport=udp'],username:"redmond",credential:"redmond123"};}else{default_ice={urls:['stun:stun.l.google.com:19302']}}
|
var mediaParams=getMediaParams(self);console.log("Audio constraints",mediaParams.audio);console.log("Video constraints",mediaParams.video);if(mediaParams.audio||mediaParams.video){getUserMedia({constraints:{audio:mediaParams.audio,video:mediaParams.video},video:mediaParams.useVideo,onsuccess:onSuccess,onerror:onError});}else{onSuccess(null);}};function FSRTCPeerConnection(options){var gathering=false,done=false;var config={};var default_ice={urls:['stun:stun.l.google.com:19302']};if(options.iceServers){if(typeof(options.iceServers)==="boolean"){config.iceServers=[default_ice];}else{config.iceServers=options.iceServers;}}
|
||||||
if(options.iceServers){if(typeof(options.iceServers)==="boolean"){config.iceServers=[default_ice];}else{config.iceServers=options.iceServers;}}
|
|
||||||
var peer=new window.RTCPeerConnection(config);openOffererChannel();var x=0;function ice_handler(){done=true;gathering=null;if(options.onICEComplete){options.onICEComplete();}
|
var peer=new window.RTCPeerConnection(config);openOffererChannel();var x=0;function ice_handler(){done=true;gathering=null;if(options.onICEComplete){options.onICEComplete();}
|
||||||
if(options.type=="offer"){options.onICESDP(peer.localDescription);}else{if(!x&&options.onICESDP){options.onICESDP(peer.localDescription);}}}
|
if(options.type=="offer"){options.onICESDP(peer.localDescription);}else{if(!x&&options.onICESDP){options.onICESDP(peer.localDescription);}}}
|
||||||
peer.onicecandidate=function(event){if(done){return;}
|
peer.onicecandidate=function(event){if(done){return;}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user