]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-8599 #resolve [Workaround for Mozilla is no longer needed for video size]
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 2 Dec 2015 16:23:25 +0000 (10:23 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 2 Dec 2015 16:23:25 +0000 (10:23 -0600)
html5/verto/js/src/jquery.FSRTC.js
html5/verto/video_demo/js/verto-min.js

index 7d3e0ad2ec3f8a4dbbed69bf545be11cadfac39f..b63a57e4e97340dca54a5c64d12fa7df099db8c0 100644 (file)
        var bestFrameRate = obj.options.videoParams.vertoBestFrameRate;
        delete obj.options.videoParams.vertoBestFrameRate;
 
-       if (window.moz) {
-           video = obj.options.videoParams;
-           if (!video.width) video.width = video.minWidth;
-           if (!video.height) video.height = video.minHeight;
-           if (!video.frameRate) video.frameRate = video.minFrameRate;
-       } else {
-           video = {
-               mandatory: obj.options.videoParams,
-               optional: []
-            }              
-       }
+       video = {
+           mandatory: obj.options.videoParams,
+           optional: []
+        }                  
        
        var useVideo = obj.options.useVideo;
 
            "maxHeight": h
        };
 
-       if (window.moz) {
-           video = video.mandatory;
-           if (!video.width) video.width = video.minWidth;
-           if (!video.height) video.height = video.minHeight;
-           if (!video.frameRate) video.frameRate = video.minFrameRate;
-       }
-
        getUserMedia({
            constraints: {
                 audio: ttl++ == 0,
index 0e5580299ff6379f3d56d6e9ff924dab217a7d20..4a9e5a5c982d12099198acf79fe01760ebeb58a8 100644 (file)
@@ -47,7 +47,7 @@ function onError(e){onStreamError(self,e);}
 var mediaParams=getMediaParams(self);console.log("Audio constraints",mediaParams.audio);console.log("Video constraints",mediaParams.video);if(self.options.useVideo&&self.options.localVideo){getUserMedia({constraints:{audio:false,video:{mandatory:self.options.videoParams,optional:[]},},localVideo:self.options.localVideo,onsuccess:function(e){self.options.localVideoStream=e;console.log("local video ready");},onerror:function(e){console.error("local video error!");}});}
 getUserMedia({constraints:{audio:mediaParams.audio,video:mediaParams.video},video:mediaParams.useVideo,onsuccess:onSuccess,onerror:onError});};function getMediaParams(obj){var audio;if(obj.options.useMic&&obj.options.useMic==="none"){console.log("Microphone Disabled");audio=false;}else if(obj.options.videoParams&&obj.options.screenShare){console.error("SCREEN SHARE");audio=false;}else{audio={mandatory:obj.options.audioParams,optional:[]};if(obj.options.useMic!=="any"){audio.optional=[{sourceId:obj.options.useMic}]}}
 if(obj.options.useVideo&&obj.options.localVideo){getUserMedia({constraints:{audio:false,video:{mandatory:obj.options.videoParams,optional:[]},},localVideo:obj.options.localVideo,onsuccess:function(e){self.options.localVideoStream=e;console.log("local video ready");},onerror:function(e){console.error("local video error!");}});}
-var video={};var bestFrameRate=obj.options.videoParams.vertoBestFrameRate;delete obj.options.videoParams.vertoBestFrameRate;if(window.moz){video=obj.options.videoParams;if(!video.width)video.width=video.minWidth;if(!video.height)video.height=video.minHeight;if(!video.frameRate)video.frameRate=video.minFrameRate;}else{video={mandatory:obj.options.videoParams,optional:[]}}
+var video={};var bestFrameRate=obj.options.videoParams.vertoBestFrameRate;delete obj.options.videoParams.vertoBestFrameRate;video={mandatory:obj.options.videoParams,optional:[]}
 var useVideo=obj.options.useVideo;if(useVideo&&obj.options.useCamera&&obj.options.useCamera!=="none"){if(!video.optional){video.optional=[];}
 if(obj.options.useCamera!=="any"){video.optional.push({sourceId:obj.options.useCamera});}
 if(bestFrameRate&&!window.moz){video.optional.push({minFrameRate:bestFrameRate});}}else{console.log("Camera Disabled");video=false;useVideo=false;}
@@ -93,8 +93,7 @@ return[w,h];}
 var resList=[[320,180],[320,240],[640,360],[640,480],[1280,720],[1920,1080]];var resI=0;var ttl=0;var checkRes=function(cam,func){if(resI>=resList.length){var res={'validRes':$.FSRTC.validRes,'bestResSupported':$.FSRTC.bestResSupported()};localStorage.setItem("res_"+cam,$.toJSON(res));if(func)return func(res);return;}
 var video={mandatory:{},optional:[]}
 if(cam){video.optional=[{sourceId:cam}];}
-w=resList[resI][0];h=resList[resI][1];resI++;video.mandatory={"minWidth":w,"minHeight":h,"maxWidth":w,"maxHeight":h};if(window.moz){video=video.mandatory;if(!video.width)video.width=video.minWidth;if(!video.height)video.height=video.minHeight;if(!video.frameRate)video.frameRate=video.minFrameRate;}
-getUserMedia({constraints:{audio:ttl++==0,video:video},onsuccess:function(e){e.getTracks().forEach(function(track){track.stop();});console.info(w+"x"+h+" supported.");$.FSRTC.validRes.push([w,h]);checkRes(cam,func);},onerror:function(e){console.error(w+"x"+h+" not supported.");checkRes(cam,func);}});}
+w=resList[resI][0];h=resList[resI][1];resI++;video.mandatory={"minWidth":w,"minHeight":h,"maxWidth":w,"maxHeight":h};getUserMedia({constraints:{audio:ttl++==0,video:video},onsuccess:function(e){e.getTracks().forEach(function(track){track.stop();});console.info(w+"x"+h+" supported.");$.FSRTC.validRes.push([w,h]);checkRes(cam,func);},onerror:function(e){console.error(w+"x"+h+" not supported.");checkRes(cam,func);}});}
 $.FSRTC.getValidRes=function(cam,func){var used=[];var cached=localStorage.getItem("res_"+cam);if(cached){var cache=$.parseJSON(cached);if(cache){$.FSRTC.validRes=cache.validRes;console.log("CACHED RES FOR CAM "+cam,cache);}else{console.error("INVALID CACHE");}
 return func?func(cache):null;}
 $.FSRTC.validRes=[];resI=0;checkRes(cam,func);}