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