How to Un-Mute all media?

Problem: Mute all sounds - "How to unmute all sounds.

Saola Animate version: 2.7.1

OS: Windows 10

Notes:
I have a few buttons with sounds attached so that when you click the button the play media command is triggered, and an audio file plays. I have another button programmed with the “Mute All Media” command so if more than one sound is playing all can be muted with that button. After the “mute all media” command is run though, no sound will play again until I “refresh” the page.
Is there a way to un-mute all media without refreshing the page?

Hi Locky,

You can use the following script to unmute or toggle mute/unmute all media:

// mute all
doc.setMuted(true);
// unmute all
doc.setMuted(false);
// toggle
doc.setMuted(!doc.isMuted());

We’ll add these actions to the action list in future updates.

Regards

Thanks ToanSL, this may save what’s left of the hair on my head. :laughing:. Going to give it a try now, thanks again!

ToanLS…that worked perfectly! Guess it’s obvious I’m still a newbie when it comes to js coding, I have been trying to figure out how to do that for quite a while, I should have asked sooner. :roll_eyes:

I’m glad to hear that it works :grinning:

ToanLs…is it also possible to stop the playing or pause the playing of all media files with a line of code?

It’s not possible.
However, you can do that for a list of media if you know the media element names:

var mediaNames = ['media_1', 'media_2']; // update this list
for (var i = 0; i < mediaNames.length; ++i) {
  var mediaElement = doc.getElement(mediaNames[i]);
  if (mediaElement)
    mediaElement.pause();
}

Regards

Ok, good to know, ( I can stop going around in circles in my brain now :crazy_face: :slightly_smiling_face:) thanks so much for all the information!