cookpete / react-player

A React component for playing a variety of URLs, including file paths, YouTube, Facebook, Twitch, SoundCloud, Streamable, Vimeo, Wistia and DailyMotion
https://cookpete.github.io/react-player
MIT License
8.89k stars 1.12k forks source link

Stop other ReactPlayer instances #1754

Closed rondog closed 3 weeks ago

rondog commented 2 months ago

Current Behavior

I have a custom component thats contains a single <ReactPlayer>. I am calling my component <VideoPlayer>. If I have multiple <VideoPlayer>'s on one page, they can be played simultaneously and I have manually pause the other one.

Expected Behavior

I want to come up with a solution that will pause whatever other players are playing. I've tried doing custom events but I am not sure how to reference the player that is playing. Any ideas? I am using vimeo as the host of these videos if that makes a difference.

rondog commented 2 months ago

I posted the question to SO as well with a bit more detail https://stackoverflow.com/questions/78084892/multiple-reactplayers-how-can-i-pause-another-when-one-starts