FS-10688: [verto.js] Add hack for IOS11 #resolve

This commit is contained in:
Anthony Minessale 2017-09-20 18:00:39 -05:00
parent 9e5b680084
commit dacca35a18
3 changed files with 10 additions and 12 deletions

View File

@ -244,12 +244,12 @@
self.options.useVideo.style.display = 'block';
// Hacks for Mobile Safari
self.options.useVideo.setAttribute("playsinline", true);
self.options.useVideo.setAttribute("controls", true);
setTimeout(function() {
self.options.useVideo.removeAttribute("controls");
});
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;
@ -487,7 +487,7 @@
}
if (obj.options.useMic !== "any") {
//audio.optional = [{sourceId: obj.options.useMic}]
//audio.optional = [{sourceId: obj.options.useMic}];
audio.deviceId = {exact: obj.options.useMic};
}
}

View File

@ -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 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.');}}
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;}
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();}}
@ -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;}
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);}
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']}}
if(options.iceServers){if(typeof(options.iceServers)==="boolean"){config.iceServers=[default_ice];}else{config.iceServers=options.iceServers;}}
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;}}
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);}}}
peer.onicecandidate=function(event){if(done){return;}

View File

@ -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 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.');}}
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;}
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();}}
@ -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;}
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);}
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']}}
if(options.iceServers){if(typeof(options.iceServers)==="boolean"){config.iceServers=[default_ice];}else{config.iceServers=options.iceServers;}}
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;}}
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);}}}
peer.onicecandidate=function(event){if(done){return;}