Callback from WonderPlugin Gallery when a video is changed

Question:

* This question is for WonderPlugin Gallery Plugin.

I’d like to know if there is a way to get a call back from WonderPlugin when a video is changed in the gallery, this is to show related content to that specific video within the playlist.

Answer:

There are two events you can use:

onchange: The event will be be fired on changing the slide.
onvideoend: The event will be be fired when the video playing ends.

To use the events, firstly, you need to define a JavaScript function in your webpage, for example:

<script language="JavaScript">
    function onSlideChange(data) {
        try {
           console.log(data);
        } catch (error)   {}
    }
    function onVideoEnd(data) {
        try {
           console.log(data);
        } catch (error)   {}
    }
</script>

In the above code, data is the data array of current slide object, the definition is [index, Thumbnail address, File address, File address for video ogg file, Fire address for video webm file, Link address, Link target, Title, Description, Media type, Width, Height, Address for video poster image, Address for HD video, Address for HD Ogg file, Address for HD webm file].

Then in the plugin, Step 3, Options tab, Advanced Options, enter:

data-onchange="onSlideChange"
data-onvideoend="onVideoEnd"