ent.getContext('2d');
		const facingMode = ['user', 'environment'];
		let camera, video, mirrored = false;
		let facingModeIndex = 0;
		let downloadFn;
		let videoWidth, videoHeight, videoRatio;
		let smallestWindowDimension = Math.min(window.innerWidth, window.innerHeight);

		function hide(el) { el.style.display = 'none'; }
		function show(el) { el.style.display = 'block'; }

		startEl.addEventListener('click', () => {
			start();
		});

		mirrorEl.addEventListener('click', () => {
			if (mirrored) {
				