Stop the embedded Plyr video while closing the pop-up modal

Hello all,

I use the Plyr to embed YouTube video in a pop-up modal. However, when I close the pop-up window, while the video disappears, the sound continues to be played in the background.

Do you have any solutions for this?

Thanks a lot!


Here is my site Read-Only:
https://preview.webflow.com/preview/alter-agent?utm_medium=preview_link&utm_source=designer&utm_content=alter-agent&preview=a5f3f978d16f72cac7852a52b9897698&workflow=preview

Hi Kaiting, you could adapt this approach.

Basically you need to set up a mutation observer that detects when your pop-up is hidden, and then have it pause the video using the Plyr API.

1 Like