Answer the question
In order to leave comments, you need to log in
Mute music when starting YouTube or Vimeo
Good afternoon everyone!
There is a task: to attach music to the site, but videos from YouTube or Vimeo will be inserted on some pages, so I would like the sound on the page to turn off when the video starts. Is it possible to track the JavaScript video start event? Or is there some other way?
Answer the question
In order to leave comments, you need to log in
Here is a detailed instruction.
developers.google.com/youtube/iframe_api_reference
Listen to onStateChange and play/pause the music.
perhaps this solution will suit you:
in any YouTube video connected via src="" you can add it to the link
so that the iframe looks like this:
<iframe width="100%" height="100%" src="https://www.youtube.com/embed/CwJ4eBWalFo?rel=0&mute=1&start=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question