From 010d484581e85aa8b090880de72a887e3a41ccc7 Mon Sep 17 00:00:00 2001 From: vincnetas Date: Wed, 24 Jun 2015 22:13:34 +0300 Subject: [PATCH] Allow specify web cam constraints. tracking.track('#video', tracker, { camera: true, video: { mandatory: { minWidth: 1280, minHeight: 720 } } }); --- src/tracking.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/tracking.js b/src/tracking.js index 7f74577..779316c 100644 --- a/src/tracking.js +++ b/src/tracking.js @@ -56,7 +56,7 @@ */ tracking.initUserMedia_ = function(element, opt_options) { window.navigator.getUserMedia({ - video: true, + video: opt_options.video, audio: opt_options.audio }, function(stream) { try { @@ -125,7 +125,8 @@ * video. * @param {tracking.Tracker} tracker The tracker instance used to track the * element. - * @param {object} opt_options Optional configuration to the tracker. + * @param {object} opt_options Optional configuration to the tracker. + * Used only with 'video' tag for specifying constrains when initialising webcam source. */ tracking.track = function(element, tracker, opt_options) { element = tracking.one(element); @@ -144,6 +145,9 @@ case 'video': if (opt_options) { if (opt_options.camera) { + if (!opt_options.video) { + opt_options.video = true; + } this.initUserMedia_(element, opt_options); } }