]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-10688: [verto.js] Add hack for IOS11 #resolve
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 20 Sep 2017 23:00:39 +0000 (18:00 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 20 Sep 2017 23:00:39 +0000 (18:00 -0500)
html5/verto/js/src/jquery.FSRTC.js
html5/verto/video_demo-live_canvas/js/verto-min.js
html5/verto/video_demo/js/verto-min.js

index 691a938349d25a6e35920c1577a67d5e820a1a54..ed8a5500d8650fa20493f2ef4ae80066368b4dae 100644 (file)
             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;
             }
 
            if (obj.options.useMic !== "any") {
-               //audio.optional = [{sourceId: obj.options.useMic}]
+               //audio.optional = [{sourceId: obj.options.useMic}];
                audio.deviceId = {exact: obj.options.useMic};
            }
        }
index 2f60ba200c6d1c0e7835b98506df4b6b5ac98688..c93b8aca64a6f53a1068ea67ff93283d5ba020cb 100644 (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;}
index 2f60ba200c6d1c0e7835b98506df4b6b5ac98688..c93b8aca64a6f53a1068ea67ff93283d5ba020cb 100644 (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;}