提交 f48289ca authored 作者: Anthony Minessale's avatar Anthony Minessale 提交者: Michael Jerris

FS-7509: update res detection

上级 d1e466e7
This diff was suppressed by a .gitattributes entry.
......@@ -966,7 +966,16 @@
return [w, h];
}
var checkRes = function (cam, w, h) {
var resList = [[320, 180], [320, 240], [640, 360], [640, 480], [1280, 720], [1920, 1080]];
var resI = 0;
var checkRes = function (cam, func) {
if (resI >= resList.length) {
if (func) return func();
return;
}
var video = {
mandatory: {},
optional: []
......@@ -976,6 +985,10 @@
video.optional = [{sourceId: obj.options.useCamera}];
}
w = resList[resI][0];
h = resList[resI][1];
resI++;
video.mandatory = {
"minWidth": w,
"minHeight": h,
......@@ -988,20 +1001,19 @@
audio: false,
video: video
},
onsuccess: function(e) {e.stop(); console.info(w + "x" + h + " supported."); $.FSRTC.validRes.push([w, h])},
onerror: function(e) {console.error( w + "x" + h + " not supported.");}
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) {
var used = [[320, 180], [320, 240], [640, 360], [640, 480], [1280, 720], [1920, 1080]];
$.FSRTC.getValidRes = function (cam, func) {
var used = [];
$.FSRTC.validRes = [];
resI = 0;
for (var i in used) {
checkRes(cam, used[i][0], used[i][1]);
}
checkRes(cam, func);
}
$.FSRTC.checkPerms = function () {
......
......@@ -2147,32 +2147,32 @@
$.verto.findDevices = function(runtime) {
var aud = [], vid = [];
$.FSRTC.checkPerms();
setTimeout(function() {
$.FSRTC.getValidRes(null);
}, 2000);
MediaStreamTrack.getSources(function (media_sources) {
for (var i = 0; i < media_sources.length; i++) {
if (media_sources[i].kind == 'video') {
vid.push(media_sources[i]);
} else {
aud.push(media_sources[i]);
$.FSRTC.getValidRes(null, function() {
console.info("enumerating devices");
MediaStreamTrack.getSources(function (media_sources) {
for (var i = 0; i < media_sources.length; i++) {
if (media_sources[i].kind == 'video') {
vid.push(media_sources[i]);
} else {
aud.push(media_sources[i]);
}
}
}
$.verto.videoDevices = vid;
$.verto.audioDevices = aud;
console.info("Audio Devices", $.verto.audioDevices);
console.info("Video Devices", $.verto.videoDevices);
runtime();
$.verto.videoDevices = vid;
$.verto.audioDevices = aud;
console.info("Audio Devices", $.verto.audioDevices);
console.info("Video Devices", $.verto.videoDevices);
runtime();
});
});
}
$.verto.init = function(runtime) {
$.verto.findDevices(runtime);
};
})(jQuery);
This diff was suppressed by a .gitattributes entry.
......@@ -1273,9 +1273,7 @@ $(document).ready(function() {
});
init();
$.verto.init(init);
});
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论