Created
November 27, 2020 00:07
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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