How can I stop sound when closing the widget that is playing a media

Hey there!

I’m struggling with this, I created a widget that plays a video, all fine. I created a button to stop showing that video, all fine. But… when I call the “Start” for the sound of the video, when I close the widget the video still sounding.

How can I stop playing the sound with the “close” button I made on the widget? I’m newbie