Bootstrap 轮播使 Html5 视频在 chrome 上闪烁
Bootstrap Carousel makes Html5 video flicker on chrome
任何人都可以向我解释为什么 Bootstrap Carousel
会使 HTML5 视频在 google chrome 上闪烁吗?每次轮播更改图像时下面的视频都会闪烁,我不明白这是怎么回事,它与视频包装器上的 class "embed-responsive embed-responsive-16by9" 有关,因为当我删除 class 问题不再发生,但我需要在页面上有一个响应式视频。
https://codepen.io/anon/pen/zREPqP
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<h2>Carousel Example</h2>
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img src="https://www.w3schools.com/bootstrap/la.jpg" alt="Los Angeles" style="width:100%;">
</div>
<div class="item">
<img src="https://www.w3schools.com/bootstrap/chicago.jpg" alt="Chicago" style="width:100%;">
</div>
<div class="item">
<img src="https://www.w3schools.com/bootstrap/ny.jpg" alt="New york" style="width:100%;">
</div>
</div>
<!-- Left and right controls -->
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
<div class="row">
<div class="col-md-offset-2 col-md-8">
<div class="embed-responsive embed-responsive-16by9"><video src="//player.vimeo.com/external/159873222.hd.mp4?s=54c0141dd1e7ab5a78a2fda1d69a9f011c89bf42&profile_id=113" poster="http://cletadmin.git-staging.clet.edu.au/assets/images/video/why-study.jpg" controls="controls" width="300" height="150"></video></div></div>
</div>
</body>
</html>
重现步骤:在chrome上打开上面的link让滑块播放,不要在视频上点击播放只是观察它从海报图像闪烁到灰色背景。
对我来说,它适用于:
.embed-responsive {
z-index:1000
}
任何人都可以向我解释为什么 Bootstrap Carousel
会使 HTML5 视频在 google chrome 上闪烁吗?每次轮播更改图像时下面的视频都会闪烁,我不明白这是怎么回事,它与视频包装器上的 class "embed-responsive embed-responsive-16by9" 有关,因为当我删除 class 问题不再发生,但我需要在页面上有一个响应式视频。
https://codepen.io/anon/pen/zREPqP
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<h2>Carousel Example</h2>
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img src="https://www.w3schools.com/bootstrap/la.jpg" alt="Los Angeles" style="width:100%;">
</div>
<div class="item">
<img src="https://www.w3schools.com/bootstrap/chicago.jpg" alt="Chicago" style="width:100%;">
</div>
<div class="item">
<img src="https://www.w3schools.com/bootstrap/ny.jpg" alt="New york" style="width:100%;">
</div>
</div>
<!-- Left and right controls -->
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
<div class="row">
<div class="col-md-offset-2 col-md-8">
<div class="embed-responsive embed-responsive-16by9"><video src="//player.vimeo.com/external/159873222.hd.mp4?s=54c0141dd1e7ab5a78a2fda1d69a9f011c89bf42&profile_id=113" poster="http://cletadmin.git-staging.clet.edu.au/assets/images/video/why-study.jpg" controls="controls" width="300" height="150"></video></div></div>
</div>
</body>
</html>
重现步骤:在chrome上打开上面的link让滑块播放,不要在视频上点击播放只是观察它从海报图像闪烁到灰色背景。
对我来说,它适用于:
.embed-responsive {
z-index:1000
}