Here’s how you can create a Mute button with JavaScript (roughly based on these instructions: http://www.w3schools.com/tags/av_prop_muted.asp)
Select your audio or video element and adjust its ‘unique element ID’. You’ll need to target the unique element ID of each of your audio/video files.
To mute an element on all scenes, you could set a variable with JavaScript when clicking the mute button that sets:
var ismuted = true;
The above JavaScript would be the function that is triggered when clicking the ‘Mute’ button.
Next, we would need to detect whether the above button has been pressed. Run the following ‘on scene load’ to then mute any audio or video elements you have:
if (ismuted === true) {
document.getElementById("audio1").muted = true;
document.getElementById("audio2").muted = true;
} else {
};
Your ‘unmute’ button would run this script:
var ismuted = false;
The above example assumes that you have an audio element with the id audio1
and audio2
. The Element ID is set in the Identity inspector when an element is selected, or by setting a standard id=""
value for your element.
For documents with larger numbers of Audio elements, you can programmatically add audio to your document (and follow muting rules) by following these instructions.