Autoplay video from beginning every time? #638
-
On my page, I have a bunch of Here's how I'm mounting my slides (suggestions appreciated!) var elms = document.getElementsByClassName('splide');
for (var i = 0; i < elms.length; i++) {
new Splide(elms[i], {
speed: 0,
drag: false,
pagination: false,
}).mount();
.on('move', function () {
<--do some stuff here to make the video autoplay from the beginning?-->
});
} Edit: I'm not using the video extension because with that particular extension, there is an extremely small (but noticeable) flicker when switching videos. For my use case (a sequence of math animations), flicker is not acceptable, and so I am just manually placing the videos in each slide: <li class="splide__slide">
<video src="/path/to/video-1.mp4">
</li>
<li class="splide__slide">
<video src="/path/to/video-2.mp4">
</li>
<li class="splide__slide">
<video src="/path/to/video-3.mp4">
</li> |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
Why don't you use the The |
Beta Was this translation helpful? Give feedback.
-
@NaotoshiFujita Thank you for your reply—I'll make sure to use the |
Beta Was this translation helpful? Give feedback.
-
Didn't test it, but like this: var elms = document.getElementsByClassName( 'splide' );
for ( var i = 0; i < elms.length; i++ ) {
var splide = new Splide( elms[ i ], {} );
splide.on( 'active', function ( Slide ) {
var slide = Slide.slide;
console.log( slide ); // slide element
var video = slide.querySelector( 'video' );
if ( video ) {
console.log( video ); // video element
}
} );
splide.mount();
} |
Beta Was this translation helpful? Give feedback.
-
@NaotoshiFujita Any idea how to do this with a Vimeo video? |
Beta Was this translation helpful? Give feedback.
Didn't test it, but like this: