On the gallery.js I found this bit of code but I cannot manage to call with a simple function the next video...
Is there a way I could do something like:
<button onclick="publish(text_event_galleryChangeVideo, [ galleryId, sequence[index + 1] ]);">Next</button>
(function () {
/**
* Go to the next video in the gallery.
*/
var onNextVideoRequested = function (event, galleryId) {
/** Get the gallery's sequence. This is an array of video ids. */
var sequence = galleryRegistry.getSequence(galleryId),
vidId = galleryRegistry.getCurrentVideoId(galleryId),
index = jquery.inArray(vidId.toString(), sequence),
lastIndex = sequence ? sequence.length - 1 : index;
/** Sorry, we don't know anything about this video id, or we've reached the end of the gallery. */
if (index === -1 || index === lastIndex) {
return;
}
/** Start the next video in line. */
publish(text_event_galleryChangeVideo, [ galleryId, sequence[index + 1] ]);
},
/** Play the previous video in the gallery. */
onPrevVideoRequested = function (event, galleryId) {
/** Get the gallery's sequence. This is an array of video ids. */
var sequence = galleryRegistry.getSequence(galleryId),
vidId = galleryRegistry.getCurrentVideoId(galleryId),
index = jquery.inArray(vidId.toString(), sequence);
/** Sorry, we don't know anything about this video id, or we're at the start of the gallery. */
if (index === -1 || index === 0) {
return;
}
/** Start the previous video in line. */
publish(text_event_galleryChangeVideo, [ galleryId, sequence[index - 1] ]);
};
subscribe(text_event_galleryNextVideo, onNextVideoRequested);
subscribe(text_event_galleryPreviousVideo, onPrevVideoRequested);
}());