lib/quagga.js
/**
	 * Tries to attach the camera-stream to a given video-element
	 * and calls the callback function when the content is ready
	 * @param {Object} constraints
	 * @param {Object} video
	 */
Tries to attach the camera-stream to a given video-element
and calls the callback function when the content is ready
@param {Object} constraints
@param {Object} video
Tries to attach the camera - stream to a given video - element and calls the callback function when the content is ready @param { Object } constraints @param { Object } video
function initCamera(video, constraints) {
	    return navigator.mediaDevices.getUserMedia(constraints).then(function (stream) {
	        return new Promise(function (resolve) {
	            streamRef = stream;
	            video.setAttribute("autoplay", 'true');
	            video.srcObject = stream;
	            video.addEventListener('loadedmetadata', function () {
	                video.play();
	                resolve();
	            });
	        });
	    }).then(waitForVideo.bind(null, video));
	}
function initCamera ( video , constraints ) { return navigator . mediaDevices . getUserMedia ( constraints ) . then ( function ( stream ) { return new Promise ( function ( resolve ) { streamRef = stream ; video . setAttribute ( "autoplay" , 'true' ) ; video . srcObject = stream ; video . addEventListener ( 'loadedmetadata' , function ( ) { video . play ( ) ; resolve ( ) ; } ) ; } ) ; } ) . then ( waitForVideo . bind ( null , video ) ) ; }
Tries to attach the camera-stream to a given video-element
 and calls the callback function when the content is ready
 @param {Object} constraints
 @param {Object} video
Tries to attach the camera - stream to a given video - element and calls the callback function when the content is ready @param { Object } constraints @param { Object } video