Script to mute my site (game)

Asked

Viewed 202 times

4

I have a project in localhost (little game in HTML 5, JS and CSS), at the bottom of the game plays a song, I can’t make the button to turn off the sound work, anyone knows any article teaching or method to do this?

Sorry lacked some details, the game itself has no audio, the page is that has an "audio" coming from a video on YT, I wish I could make a link that left my page changes :/

  • 3

    post your code there, as complete as possible so that we can do a test and so help you better,.

1 answer

4

If the audio comes from the tag audio

 <audio id="musica" autoplay="autoplay">
      <source src="musica.mp3" type="audio/mpeg" />
    </audio> 


document.getElementById('musica').muted = true;

Since the video comes from youtube I think there is no parameter for embedded videos to mute the video.

Anyway I leave you here a link Player Parameters

The best will be to download the video and put it back through the tag

Browser other questions tagged

You are not signed in. Login or sign up in order to post.