Skip to content

Instantly share code, notes, and snippets.

@wplit
Created November 27, 2020 00:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wplit/dcfbc9dfcc5cfaf0e6c4d9c7bc8a1dc6 to your computer and use it in GitHub Desktop.
Save wplit/dcfbc9dfcc5cfaf0e6c4d9c7bc8a1dc6 to your computer and use it in GitHub Desktop.
When video ends inside carousel, force carousel to move and start next video
jQuery(document).ready(function($) {
var myFlickity = Flickity.data('.my-carousel .oxy-inner-content');
var MediaPlayers = $('vime-player');
MediaPlayers.each(function() {
var nextMedia = $(this).parent('.oxy-pro-media-player').next('.oxy-pro-media-player').find('vime-player')[0];
var eachMedia = $(this)[0];
// Listening for the player to end playback
eachMedia.addEventListener('vPlaybackEnded', (event) => {
// do something here when the video ends. //
myFlickity.next(); // Move the carousel one cell
nextMedia.play(); // Play the next video
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment