G
G
Gorini42012-04-19 12:48:59
YouTube
Gorini4, 2012-04-19 12:48:59

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

2 answer(s)
V
Vitaliy Petrychuk, 2012-04-19
@gorini4

Here is a detailed instruction.
developers.google.com/youtube/iframe_api_reference
Listen to onStateChange and play/pause the music.

S
Sergey But, 2018-09-22
@Locko

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&amp;mute=1&amp;start=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>

where https://www.youtube.com/embed/CwJ4eBWalFo is the original link

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question