Title: Player doesn&#039;t stop when closed
Last modified: August 21, 2016

---

# Player doesn't stop when closed

 *  Resolved [30000monkeys](https://wordpress.org/support/users/30000monkeys/)
 * (@30000monkeys)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/player-doesnt-stop-when-closed/)
 * Hi,
    when I click a video in the gallery and press play, everything’s fine. But
   when I click the X in the top right corner or press escape, the player will disappear
   but the sound will keep playing in the background until I refresh the page. Any
   ideas?
 * [http://wordpress.org/plugins/simple-video-gallery/](http://wordpress.org/plugins/simple-video-gallery/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [30000monkeys](https://wordpress.org/support/users/30000monkeys/)
 * (@30000monkeys)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/player-doesnt-stop-when-closed/#post-4470645)
 * * happens in all ie versions and SRWare 31.0.1700.0.
    Works fine in Firefox 26
   though.
 *  Thread Starter [30000monkeys](https://wordpress.org/support/users/30000monkeys/)
 * (@30000monkeys)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/player-doesnt-stop-when-closed/#post-4470693)
 * Sry for spamming 😀
 * I found a solution from those guys
 * [http://webdevstudios.com/2013/02/13/how-to-stop-a-youtube-video-from-playing-when-closing-a-lightbox-modal/](http://webdevstudios.com/2013/02/13/how-to-stop-a-youtube-video-from-playing-when-closing-a-lightbox-modal/)
 * So the code I needed looks like this:
 *     ```
       jQuery(document).bind('dialogclose', function() {
       var vid = jQuery('.svg-video-object iframe[src*="youtube"]');
       if ( vid.length > 0 ){
       var src = vid.attr('src');
       vid.attr('src', '');
       vid.attr('src', src);
       }
       });
       ```
   
 * Maybe you wanna patch it?
 * Anyways, resolved for me.
 * Wrote a Review now, 5 stars!
 *  Thread Starter [30000monkeys](https://wordpress.org/support/users/30000monkeys/)
 * (@30000monkeys)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/player-doesnt-stop-when-closed/#post-4470696)
 * Ok this code had some problems, I found another (and simpler) solution:
 *     ```
       .dialog({
               'dialogClass'   : 'wp-dialog',
               'modal'         : true,
               'autoOpen'      : false,
               'closeOnEscape' : true,
               'title'         : link.attr('title'),
               'width'         : 580,
               'height'        : 440,
               'buttons'       : { },
               // FIX
               close: function() {
                   var inrHTML = $(this).html();
                   $(this).empty().html(inrHTML);
               }
               // #FIX
             });
       ```
   
 *  Plugin Author [mch0lic](https://wordpress.org/support/users/mch0lic/)
 * (@mch0lic)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/player-doesnt-stop-when-closed/#post-4470868)
 * Thanks, will include soon!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Player doesn't stop when closed’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/simple-video-gallery.svg)
 * [Simple Video Gallery](https://wordpress.org/plugins/simple-video-gallery/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/simple-video-gallery/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/simple-video-gallery/)
 * [Active Topics](https://wordpress.org/support/plugin/simple-video-gallery/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simple-video-gallery/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simple-video-gallery/reviews/)

## Tags

 * [stop](https://wordpress.org/support/topic-tag/stop/)
 * [svg](https://wordpress.org/support/topic-tag/svg/)

 * 4 replies
 * 2 participants
 * Last reply from: [mch0lic](https://wordpress.org/support/users/mch0lic/)
 * Last activity: [12 years, 5 months ago](https://wordpress.org/support/topic/player-doesnt-stop-when-closed/#post-4470868)
 * Status: resolved