Multiple Videos embed on Page, how to pause all others when one is playing?

Hello,

I have a page with mulitple videos embed in, I’m using then “new” tag like:

As it’s multiple videos on a same page I like when someone Play one it switch to Pause all others videos on the page (to avoid having all sound playing at same time).

Any script to help me ?

Thank you !

You can achieve this by writing a custom javascript function that uses the Stream Player API’s play event in conjunction with the pause method. You can find details here: https://developers.cloudflare.com/stream/viewing-videos/using-the-player-api

Basically, you can get every instance of the Stream player to call your custom javascript function any time a user hits play on a video. Your custom function can then traverse through the videos and make sure all videos other than the one the user just hit play on is paused.

1 Like