From 17ee8dde7081ecbb2bc409e83bcbbb7ad4707c9c Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 28 Aug 2015 14:28:48 -0500 Subject: [PATCH] FS-8087 #comment fix depth issue in cached json --- html5/verto/js/src/jquery.FSRTC.js | 7 ++++--- html5/verto/video_demo/js/verto-min.js | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/html5/verto/js/src/jquery.FSRTC.js b/html5/verto/js/src/jquery.FSRTC.js index 7fae1f65b9..adf8667fce 100644 --- a/html5/verto/js/src/jquery.FSRTC.js +++ b/html5/verto/js/src/jquery.FSRTC.js @@ -1105,9 +1105,10 @@ var iceTimer; var cached = localStorage.getItem("res_" + cam); if (cached) { - $.FSRTC.validRes = $.parseJSON(cached); - console.log("CACHED RES FOR CAM " + cam, $.FSRTC.validRes); - return func ? func($.FSRTC.validRes) : null; + var cache = $.parseJSON(cached); + $.FSRTC.validRes = cache.validRes; + console.log("CACHED RES FOR CAM " + cam, cache); + return func ? func(cache) : null; } diff --git a/html5/verto/video_demo/js/verto-min.js b/html5/verto/video_demo/js/verto-min.js index a67e8c1e29..9873f2ff3b 100644 --- a/html5/verto/video_demo/js/verto-min.js +++ b/html5/verto/video_demo/js/verto-min.js @@ -85,7 +85,7 @@ 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.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($.FSRTC.validRes):null;} +$.FSRTC.getValidRes=function(cam,func){var used=[];var cached=localStorage.getItem("res_"+cam);if(cached){var cache=$.parseJSON(cached);$.FSRTC.validRes=cache.validRes;console.log("CACHED RES FOR CAM "+cam,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){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;}