diff --git a/html5/verto/js/src/jquery.FSRTC.js b/html5/verto/js/src/jquery.FSRTC.js index 1e6a2c3f08..8c5ef6f38b 100644 --- a/html5/verto/js/src/jquery.FSRTC.js +++ b/html5/verto/js/src/jquery.FSRTC.js @@ -1111,14 +1111,14 @@ var iceTimer; checkRes(cam, func); } - $.FSRTC.checkPerms = function () { + $.FSRTC.checkPerms = function (runtime) { getUserMedia({ constraints: { audio: true, video: true, }, - onsuccess: function(e) {e.stop(); console.info("media perm init complete");}, - onerror: function(e) {console.error("media perm init error");} + onsuccess: function(e) {e.stop(); console.info("media perm init complete"); if (runtime) {runtime(true)}}, + onerror: function(e) {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 3a145d2c60..bc8f2177b9 100644 --- a/html5/verto/js/src/jquery.verto.js +++ b/html5/verto/js/src/jquery.verto.js @@ -87,6 +87,7 @@ $.FSRTC.getValidRes(verto.options.deviceParams.useCamera, verto.options.deviceParams.onResCheck); } else { verto.options.deviceParams.useCamera = "any"; + $.FSRTC.getValidRes(undefined, undefined); } if (!verto.options.deviceParams.useMic) { @@ -2599,7 +2600,9 @@ } $.verto.init = function(obj, runtime) { - checkDevices(runtime); + $.FSRTC.checkPerms(function() { + checkDevices(runtime); + }); } $.verto.genUUID = function () { diff --git a/html5/verto/video_demo/js/verto-min.js b/html5/verto/video_demo/js/verto-min.js index 9d8247f1f6..3980b9ad31 100644 --- a/html5/verto/video_demo/js/verto-min.js +++ b/html5/verto/video_demo/js/verto-min.js @@ -87,7 +87,7 @@ w=resList[resI][0];h=resList[resI][1];resI++;video.mandatory={"minWidth":w,"minH getUserMedia({constraints:{audio:ttl++==0,video:video},onsuccess:function(e){e.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){$.FSRTC.validRes=$.parseJSON(cached);console.log("CACHED RES FOR CAM "+cam,$.FSRTC.validRes);return func?func():null;} $.FSRTC.validRes=[];resI=0;checkRes(cam,func);} -$.FSRTC.checkPerms=function(){getUserMedia({constraints:{audio:true,video:true,},onsuccess:function(e){e.stop();console.info("media perm init complete");},onerror:function(e){console.error("media perm init error");}});}})(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){getUserMedia({constraints:{audio:true,video:true,},onsuccess:function(e){e.stop();console.info("media perm init complete");if(runtime){runtime(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={};} 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);};} @@ -120,7 +120,7 @@ for(i=0;i