Here is my Bootstrap 2 carousel in which there is one html5 video and 2 images (I have to use Bootstrap 2 and jQuery 1.9.1 in this project):
!function ($) {
$(function(){
$('#homepage_slider').carousel()
})
}(window.jQuery)
#homepage_slider video {
min-height: 100% !important;
min-width: 100% !important;
height: auto !important;
width: auto !important;
overflow: hidden;
}
#homepage_slider img {
width: 100%;
max-width: 100%;
height: auto;
vertical-align: middle;
border: 0;
}
.carousel-inner>.item>img {
display: block;
line-height: 1;
}
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.2/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
<div id="banner">
<div id="homepage_slider" class="carousel slide">
<ol class="carousel-indicators">
<li data-target="#homepage_slider" data-slide-to="0" class="active"></li>
<li data-target="#homepage_slider" data-slide-to="1"></li>
<li data-target="#homepage_slider" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div data-slide="0" class="item active">
<video title="1" id="bgvid" autoplay loop muted poster="http://www.thefrasier.com/wp-content/themes/frasier/images/Frasier_Home_120314.jpg"><source src="http://www.thefrasier.com/wp-content/uploads/2014/12/0_final_reel_home.webm" type="video/webm">Your browser does not support the video tag.</video>
</div>
<div data-slide="1" class="item">
<img title="2" alt="image of hotel" src="http://hdcoolwallpapers.com/wp-content/uploads/2014/09/Hd-Ocean-Wallpapers-5.jpg">
</div>
<div data-slide="2" class="item">
<img title="3" alt="image of apartment" src="http://imgs.abduzeedo.com/files/gismullr/beautifulhouses/bh306/wh01.jpg">
</div>
</div>
<a class="carousel-control left" href="#homepage_slider" data-slide="prev">‹</a>
<a class="carousel-control right" href="#homepage_slider" data-slide="next">›</a>
</div>
</div>
Run codeHide resultCurrently, the slider does not start on its own, so I had to include the .carousel () script to run it.
Problem: The carousel does not stop during video playback. How to pause the slider during video playback, and then resume video playback? And then, when the video slide is activated again to play the video again (and the slider pauses again)?
Note. The slider will always have only 1 video and an unlimited number of images in any order.
!
( CodePen: https://codepen.io/mashablair/pen/eWLRJg)