Is it possible to use slick.js with html5 self hosted videos, to play and pause a video without user interaction?
I currently have the following code to have a dual slider with a vertical slick slideshow and a main section where the large image and video will appear and scroll automatically. This will be hosted on a television so there will be no user interaction.
How can I have the slide containing video play completely once it appears and once it finishes, continue the slideshow and repeat indefinitely. The videos may contain various lengths so it would need to detect the length dynamically.
I tried implementing the code on this question however I was not able to get my example working.
<div id="slideBox">
<!--Sidebar-->
<div class="sliderSidebar">
<div><img src="http://placehold.it/200x100"></div>
<div><img src="http://placehold.it/200x100"></div>
<div><img src="http://placehold.it/200x100"></div>
<div><img src="http://placehold.it/200x100"></div>
<div><img src="http://placehold.it/200x100"></div>
<div><img src="http://placehold.it/200x100/C8102E/FFFFFFF?text=Video" /></div>
</div>
<div id="main-image" class="sliderMain">
<div><img src="http://placehold.it/900x500"></div>
<div><img src="http://placehold.it/900x500"></div>
<div><img src="http://placehold.it/900x500"></div>
<div><img src="http://placehold.it/900x500"></div>
<div><img src="http://placehold.it/900x500"></div>
<div id="slide-video">
<video autoplay loop width="900px">
<source src="video/SampleVideo.mp4" />
</video>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
$('.sliderMain').slick({
slidesToShow: 1,
slidesToScroll: 1,
arrows: false,
fade: true,
asNavFor: '.sliderSidebar',
autoplay: true,
autoplaySpeed: 3000,
onAfterChange : function() {
player.stopVideo();
}
});
$('.sliderSidebar').slick({
slidesToShow: 5,
slidesToScroll: 1,
asNavFor: '.sliderMain',
dots: false,
centerMode: false,
focusOnSelect: true,
vertical: true,
arrows: false
});
var video = $('.sliderMain .slick-active').find('video').get(0).play();
$('.sliderMain').on('afterChange', function(event, slick, currentSlide, nextSlide){
$('.sliderMain .slick-slide').find('video').get(0).pause();
var video = $('.sliderMain .slick-active').find('video').get(0).play();
});
});
</script>