diff --git a/html5/verto/js/src/jquery.FSRTC.js b/html5/verto/js/src/jquery.FSRTC.js index e025c669c0..1bdeeed80f 100644 --- a/html5/verto/js/src/jquery.FSRTC.js +++ b/html5/verto/js/src/jquery.FSRTC.js @@ -1089,14 +1089,25 @@ checkRes(cam, func); } - $.FSRTC.checkPerms = function (runtime) { + $.FSRTC.checkPerms = function (runtime, check_audio, check_video) { getUserMedia({ constraints: { - audio: true, - video: true, + audio: check_audio, + video: check_video, }, onsuccess: function(e) {e.stop(); console.info("media perm init complete"); if (runtime) {setTimeout(runtime, 100, true)}}, - onerror: function(e) {console.error("media perm init error"); if (runtime) {runtime(false)}} + onerror: function(e) { + if (check_video && check_audio) { + console.error("error, retesting with audio params only"); + return $.FSRTC.checkPerms(runtime, check_audio, false); + } + + console.error("media perm init error"); + + if (runtime) { + runtime(false) + } + } }); } diff --git a/html5/verto/js/src/jquery.verto.js b/html5/verto/js/src/jquery.verto.js index 9a9ccc9fe5..34acbd5fcc 100644 --- a/html5/verto/js/src/jquery.verto.js +++ b/html5/verto/js/src/jquery.verto.js @@ -2602,7 +2602,7 @@ $.verto.init = function(obj, runtime) { $.FSRTC.checkPerms(function() { checkDevices(runtime); - }); + }, true, true); } $.verto.genUUID = function () { diff --git a/html5/verto/video_demo/js/verto-min.js b/html5/verto/video_demo/js/verto-min.js index 71380394d3..66cc902862 100644 --- a/html5/verto/video_demo/js/verto-min.js +++ b/html5/verto/video_demo/js/verto-min.js @@ -91,7 +91,8 @@ getUserMedia({constraints:{audio:ttl++==0,video:video},onsuccess:function(e){e.s $.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);} -$.FSRTC.checkPerms=function(runtime){getUserMedia({constraints:{audio:true,video:true,},onsuccess:function(e){e.stop();console.info("media perm init complete");if(runtime){setTimeout(runtime,100,true)}},onerror:function(e){console.error("media perm init error");if(runtime){runtime(false)}}});}})(jQuery);(function($){$.JsonRpcClient=function(options){var self=this;this.options=$.extend({ajaxUrl:null,socketUrl:null,onmessage:null,login:null,passwd:null,sessid:null,loginParams:null,userVariables:null,getSocket:function(onmessage_cb){return self._getSocket(onmessage_cb);}},options);self.ws_cnt=0;this.wsOnMessage=function(event){self._wsOnMessage(event);};};$.JsonRpcClient.prototype._ws_socket=null;$.JsonRpcClient.prototype._ws_callbacks={};$.JsonRpcClient.prototype._current_id=1;$.JsonRpcClient.prototype.call=function(method,params,success_cb,error_cb){if(!params){params={};} +$.FSRTC.checkPerms=function(runtime,check_audio,check_video){getUserMedia({constraints:{audio:check_audio,video:check_video,},onsuccess:function(e){e.stop();console.info("media perm init complete");if(runtime){setTimeout(runtime,100,true)}},onerror:function(e){if(check_video&&check_audio){console.error("error, retesting with audio params only");return $.FSRTC.checkPerms(runtime,check_audio,false);} +console.error("media perm init error");if(runtime){runtime(false)}}});}})(jQuery);(function($){$.JsonRpcClient=function(options){var self=this;this.options=$.extend({ajaxUrl:null,socketUrl:null,onmessage:null,login:null,passwd:null,sessid:null,loginParams:null,userVariables:null,getSocket:function(onmessage_cb){return self._getSocket(onmessage_cb);}},options);self.ws_cnt=0;this.wsOnMessage=function(event){self._wsOnMessage(event);};};$.JsonRpcClient.prototype._ws_socket=null;$.JsonRpcClient.prototype._ws_callbacks={};$.JsonRpcClient.prototype._current_id=1;$.JsonRpcClient.prototype.call=function(method,params,success_cb,error_cb){if(!params){params={};} if(this.options.sessid){params.sessid=this.options.sessid;} var request={jsonrpc:'2.0',method:method,params:params,id:this._current_id++};if(!success_cb){success_cb=function(e){console.log("Success: ",e);};} if(!error_cb){error_cb=function(e){console.log("Error: ",e);};} @@ -274,5 +275,5 @@ for(var i in $.verto.saved){var verto=$.verto.saved[i];if(verto){verto.purge();v return $.verto.warnOnUnload;});$.verto.videoDevices=[];$.verto.audioInDevices=[];$.verto.audioOutDevices=[];var checkDevices=function(runtime){console.info("enumerating devices");var aud_in=[],aud_out=[],vid=[];if((!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices)&&MediaStreamTrack.getSources){MediaStreamTrack.getSources(function(media_sources){for(var i=0;i