Stop youtube video

Hey forum,

I have a video element on a pop-up. When it shows the pop-up, it shows the youtube video. You can manually press play.
The problem is if you click outside the pop-up, the video still runs, somewhere.
How to stop it right after the pop-up is no longer visible?

Thanks!

Hi, did you ever figure out how to stop the youtube video from playing when the focus moves to another element?

Hey Man!
Is “Play the video automatically on load” & “Replay video when over” selected?

The simplest way is to reset the data of the parent element when it’s hidden (or closed if it’s a popup).

Obviously for that to work the video source must refer to the parent’s data, so just make sure that’s how your app and video element are set up to work (you can do the same thing with a custom state instead of the element’s content type).

3 Likes