+ gModSound.mDisplay.AFRequestID = window.requestAnimationFrame(gModSound.paintAnalyzerFrame);
+ },
+ resize: function() {
+ gModSound.rebuildCanvas();
+ },
+ deactivate: function() {
+ if (gModSound.mDisplay.active) {
+ gModSound.mAudio.stream.stop();
+ gModSound.mDisplay.active = false;
+ }
+ gSounds.scan.pause();
+ },
+}
+
+var gModEnv = {
+ activate: function() {
+ gSounds.scan.play();
+ document.getElementById("envunavail").style.display = "none";
+ document.getElementById("envavail").style.display = "block";
+ window.addEventListener("devicelight", this.lightEvent, true);
+ window.addEventListener("deviceproximity", this.proxEvent, true);
+ setTimeout(function() {
+ if ((document.getElementById("envLight").textContent == "...") &&
+ (document.getElementById("envDistance").textContent == "...")) {
+ gModEnv.deactivate();
+ }
+ }, 5000);
+ try {
+ for (var cameraId of window.navigator.mozCameras.getListOfCameras()) {
+ window.navigator.mozCameras.getCamera({camera: cameraId}, function(aCamera) {
+ if (aCamera.capabilities.flashModes.indexOf('torch') !== -1) {
+ this.flashCamera = aCamera;
+ }
+ });
+ }
+ if (this.flashCamera) {
+ document.getElementById("envFlashOn").onclick = gModEnv.switchFlashlight(true);
+ document.getElementById("envFlashOff").onclick = gModEnv.switchFlashlight(false);
+ document.getElementById("envFlashUnavail").style.display = "none";
+ document.getElementById("envFlashAvail").style.display = "block";
+ }
+ } catch (e) {
+ // camera api not supported
+ document.getElementById("envFlashUnavail").style.display = "block";
+ document.getElementById("envFlashAvail").style.display = "none";
+ }