FS-8245 #resolve [Video Resolutions available in "Video Quality" drop down are not always correct]

This commit is contained in:
Anthony Minessale 2015-09-30 03:30:24 -05:00
parent 33ffdb34a8
commit cc00d1d098
3 changed files with 26 additions and 28 deletions

View File

@ -85,9 +85,6 @@
if (verto.options.deviceParams.useCamera) {
$.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) {

View File

@ -1,8 +1,8 @@
'use strict';
/* Controllers */
var videoQuality = [{
var videoQuality = [];
var videoQualitySource = [{
id: 'qvga',
label: 'QVGA 320x240',
width: 320,
@ -158,28 +158,28 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
function updateResolutions(supportedResolutions) {
console.debug('Attempting to sync supported and available resolutions');
var removed = 0;
//var removed = 0;
angular.forEach(videoQuality, function(resolution, id) {
var supported = false;
console.debug("VQ length: " + videoQualitySource.length);
console.debug(supportedResolutions);
angular.forEach(videoQualitySource, function(resolution, id) {
angular.forEach(supportedResolutions, function(res) {
var width = res[0];
var height = res[1];
if(resolution.width == width && resolution.height == height) {
supported = true;
videoQuality.push(resolution);
}
});
if(!supported) {
delete videoQuality[id];
++removed;
}
});
videoQuality.length = videoQuality.length - removed;
// videoQuality.length = videoQuality.length - removed;
console.debug("VQ length 2: " + videoQuality.length);
data.videoQuality = videoQuality;
console.debug(videoQuality);
data.vidQual = (videoQuality.length > 0) ? videoQuality[videoQuality.length - 1].id : null;
console.debug(data.vidQual);
return videoQuality;
};
@ -553,6 +553,8 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
if (data.instance && !data.instance.rpcClient.socketReady()) {
clearTimeout(data.instance.rpcClient.to);
data.instance.logout();
data.instance.login();
return;
};
data.instance = new jQuery.verto({
login: data.login + '@' + data.hostname,
@ -562,25 +564,24 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
ringFile: "sounds/bell_ring2.wav",
// TODO: Add options for this.
audioParams: {
googEchoCancellation: storage.data.googEchoCancellation || false,
googNoiseSuppression: storage.data.googNoiseSuppression || false,
googHighpassFilter: storage.data.googHighpassFilter || false
googEchoCancellation: storage.data.googEchoCancellation || true,
googNoiseSuppression: storage.data.googNoiseSuppression || true,
googHighpassFilter: storage.data.googHighpassFilter || true
},
iceServers: storage.data.useSTUN
}, callbacks);
data.instance.deviceParams({
useCamera: storage.data.selectedVideo,
useMic: storage.data.selectedAudio,
onResCheck: that.refreshVideoResolution
});
data.instance.deviceParams({
useCamera: storage.data.selectedVideo,
useMic: storage.data.selectedAudio,
onResCheck: that.refreshVideoResolution
});
}
if(data.mediaPerm) {
if (data.mediaPerm) {
ourBootstrap();
} else {
$.verto.init({skipDeviceCheck: true}, ourBootstrap);
$.FSRTC.checkPerms(ourBootstrap, true, true);
}
},

View File

@ -128,7 +128,7 @@ for(i=0;i<this._requests.length;i++){call=this._requests[i];batch_request.push(c
success_cb=function(data){self._batchCb(data,handlers,self.all_done_cb);};if(self.jsonrpcclient.options.ajaxUrl===null){throw"$.JsonRpcClient.batch used with no websocket and no http endpoint.";}
$.ajax({url:self.jsonrpcclient.options.ajaxUrl,data:$.toJSON(batch_request),dataType:'json',cache:false,type:'POST',error:function(jqXHR,textStatus,errorThrown){self.error_cb(jqXHR,textStatus,errorThrown);},success:success_cb});};$.JsonRpcClient._batchObject.prototype._batchCb=function(result,handlers,all_done_cb){for(var i=0;i<result.length;i++){var response=result[i];if('error'in response){if(response.id===null||!(response.id in handlers)){if('console'in window)console.log(response);}else{handlers[response.id].error_cb(response.error,this);}}else{if(!(response.id in handlers)&&'console'in window){console.log(response);}else{handlers[response.id].success_cb(response.result,this);}}}
if(typeof all_done_cb==='function')all_done_cb(result);};})(jQuery);(function($){var sources=[];var generateGUID=(typeof(window.crypto)!=='undefined'&&typeof(window.crypto.getRandomValues)!=='undefined')?function(){var buf=new Uint16Array(8);window.crypto.getRandomValues(buf);var S4=function(num){var ret=num.toString(16);while(ret.length<4){ret="0"+ret;}
return ret;};return(S4(buf[0])+S4(buf[1])+"-"+S4(buf[2])+"-"+S4(buf[3])+"-"+S4(buf[4])+"-"+S4(buf[5])+S4(buf[6])+S4(buf[7]));}:function(){return'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,function(c){var r=Math.random()*16|0,v=c=='x'?r:(r&0x3|0x8);return v.toString(16);});};$.verto=function(options,callbacks){var verto=this;$.verto.saved.push(verto);verto.options=$.extend({login:null,passwd:null,socketUrl:null,tag:null,localTag:null,videoParams:{},audioParams:{},loginParams:{},deviceParams:{onResCheck:null},userVariables:{},iceServers:false,ringSleep:6000,sessid:null},options);if(verto.options.deviceParams.useCamera){$.FSRTC.getValidRes(verto.options.deviceParams.useCamera,verto.options.deviceParams.onResCheck);}else{verto.options.deviceParams.useCamera="any";$.FSRTC.getValidRes(undefined,undefined);}
return ret;};return(S4(buf[0])+S4(buf[1])+"-"+S4(buf[2])+"-"+S4(buf[3])+"-"+S4(buf[4])+"-"+S4(buf[5])+S4(buf[6])+S4(buf[7]));}:function(){return'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,function(c){var r=Math.random()*16|0,v=c=='x'?r:(r&0x3|0x8);return v.toString(16);});};$.verto=function(options,callbacks){var verto=this;$.verto.saved.push(verto);verto.options=$.extend({login:null,passwd:null,socketUrl:null,tag:null,localTag:null,videoParams:{},audioParams:{},loginParams:{},deviceParams:{onResCheck:null},userVariables:{},iceServers:false,ringSleep:6000,sessid:null},options);if(verto.options.deviceParams.useCamera){$.FSRTC.getValidRes(verto.options.deviceParams.useCamera,verto.options.deviceParams.onResCheck);}
if(!verto.options.deviceParams.useMic){verto.options.deviceParams.useMic="any";}
if(!verto.options.deviceParams.useSpeak){verto.options.deviceParams.useSpeak="any";}
if(verto.options.sessid){verto.sessid=verto.options.sessid;}else{verto.sessid=localStorage.getItem("verto_session_uuid")||generateGUID();localStorage.setItem("verto_session_uuid",verto.sessid);}