Bug 1321631 - Delay loading RDM camera audio until used. r=ochameau a=jcristau
authorJ. Ryan Stinnett <jryans@gmail.com>
Mon, 31 Oct 2016 14:22:29 -0500
changeset 352854 4a4ac66258d43524ecb2c39e129d81e44fdbb8fc
parent 352853 b563a3069c60fcc45ad3b27e05cffeb513da47e2
child 352855 48a4769a75a5d459dd86c4a1a2f9babb75c9eede
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersochameau, jcristau
bugs1321631
milestone52.0a2
Bug 1321631 - Delay loading RDM camera audio until used. r=ochameau a=jcristau MozReview-Commit-ID: LWHS1xFRvdd
devtools/client/responsive.html/actions/screenshot.js
--- a/devtools/client/responsive.html/actions/screenshot.js
+++ b/devtools/client/responsive.html/actions/screenshot.js
@@ -11,17 +11,17 @@ const {
   TAKE_SCREENSHOT_END,
 } = require("./index");
 
 const { getFormatStr } = require("../utils/l10n");
 const { getToplevelWindow } = require("sdk/window/utils");
 const { Task: { spawn } } = require("devtools/shared/task");
 const e10s = require("../utils/e10s");
 
-const audioCamera = new window.Audio("resource://devtools/client/themes/audio/shutter.wav");
+const CAMERA_AUDIO_URL = "resource://devtools/client/themes/audio/shutter.wav";
 
 const animationFrame = () => new Promise(resolve => {
   window.requestAnimationFrame(resolve);
 });
 
 function getFileName() {
   let date = new Date();
   let month = ("0" + (date.getMonth() + 1)).substr(-2);
@@ -49,17 +49,18 @@ function saveToFile(data, filename) {
 
     chromeWindow.saveURL(data, filename, null,
                          true, true,
                          chromeDocument.documentURIObject, chromeDocument);
   });
 }
 
 function simulateCameraEffects(node) {
-  audioCamera.play();
+  let cameraAudio = new window.Audio(CAMERA_AUDIO_URL);
+  cameraAudio.play();
   node.animate({ opacity: [ 0, 1 ] }, 500);
 }
 
 module.exports = {
 
   takeScreenshot() {
     return function* (dispatch, getState) {
       yield dispatch({ type: TAKE_SCREENSHOT_START });