Stopping Video Playing When Popup Is Closed

Hi Guys
I have a popup on a site which contains a video, The issue I am having is that when the video is playing and the popup is closed it continues to play in the background.

The code is below, is there anything I can do to stop the video playing on close or do I need to be looking at a java script solution for the popup

Click to See Actual Day & Night Recorded Footage

Replace this line in your content:

with this one:

Add these lines:

var video = document.getElementById("video_block");
if (video) {
    video.pause();
}

below the following line:

close: function(e,u) {

in the js/core.js

Remove var/cache folder.


Or there are a lot of these pop-ups with different videos?

Replace this line in your content:

with this one:

Add these lines:

var video = document.getElementById("video_block");
if (video) {
    video.pause();
}

below the following line:

close: function(e,u) {

in the js/core.js

Remove var/cache folder.


Or there are a lot of these pop-ups with different videos?

Thank you for that, No at the moment there is only one video, I have embedded the link directly into a new product template as it is only for 4 specific products.

The file that you mentioned js/core.js is not in the js/ folder. I take it that it is in /js/tygh

If I modify this directly will it be overwritten on upgrade.

Alan

Oh, sorry. Yes, this file is in js/Tygh/core.js, indeed. You are right.

And it might be overwritten while upgrade. But it has no hooks, no ways to override this file directly. You can copy this file to add-on and overrider the common/scripts.tpl to include your modified file.

Or just note where you made this change and restore it after upgrade. In any case you should modify the behaviour of dialog:close method

You can try to add custom js script with my changes addon

http://forum.cs-cart.com/topic/37758-how-to-add-custom-javascript-with-my-changes-addon/

and check each dialogclose event to pause your video

http://stackoverflow.com/questions/171928/hook-into-dialog-close-event