0

How to pause a youtube video when soundcloud audio paying and vise versa

<span class="soundcloud_embed" id="soundcloud_post_312">
  <iframe id="ui-id-1" width="100%" height="300" scrolling="no" 
     frameborder="no" src="https://w.soundcloud.com/player/?
     url=https%3A//api.soundcloud.com/tracks/163100334&amp;
     color=%23ff5500&amp;
     auto_play=false&amp;hide_related=false&amp;show_comments=true&amp;
     show_user=true&amp;show_reposts=false&amp;show_teaser=true&amp;
     visual=true">
  </iframe>

</span>

<span class="youtube_embed" id="youtube_post_309">
 <iframe id="ui-id-2" width="560"height="315" src="https://www.youtube.com/
    embed/M7lc1UVf-VE" frameborder="0" gesture="media" 
    allow="encrypted-media" allowfullscreen></iframe>
</span>

I've found the source at this link Pause Youtube embed when playing Soundcloud embed

http://jsfiddle.net/Lpq9n7ht/

luxshan
  • 54
  • 6

1 Answers1

0

If you need to control the player, you need IFrame API.

The IFrame player API lets you embed a YouTube video player on your website and control the player using JavaScript.

Read through the documentation to get started. There is starter guide that will help you how to use the API. Codes are also available as your reference depending on the functions that you want to use.

For the requirements, remember this.

The user's browser must support the HTML5 postMessage feature. Most modern browsers support postMessage, though Internet Explorer 7 does not support it.

MαπμQμαπkγVπ.0
  • 5,887
  • 1
  • 27
  • 65