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?
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).