我有一个bootstrap模式,显示html5视频正常;然而,当我用plyr插件取代html5视频播放器时,视频根本没有显示在模态中?对此的任何想法将不胜感激。请检查以下代码:
HTML代码:
<!--Modal: Name-->
<div class="modal fade" id="product-video-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<!--Content-->
<div class="modal-content">
<!--Body-->
<div class="modal-body mb-0 p-0">
<div class="embed-responsive embed-responsive-16by9 z-depth-1-half">
<video id="product-vid-src" class="embed-responsive-item " width="100%" controls crossorigin playsinline >
<source src="https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-720p.mp4" type="video/mp4" size="720">
</video>
</div>
</div>
<!--Footer-->
<div class="modal-footer justify-content-center">
<span class="mr-4">Spread the word!</span>
<a type="button" class="btn-floating btn-sm btn-fb"><i class="fa fa-facebook"></i></a>
<!--Twitter-->
<a type="button" class="btn-floating btn-sm btn-tw"><i class="fa fa-twitter"></i></a>
<!--Google +-->
<a type="button" class="btn-floating btn-sm btn-gplus"><i class="fa fa-google-plus"></i></a>
<!--Linkedin-->
<a type="button" class="btn-floating btn-sm btn-ins"><i class="fa fa-linkedin"></i></a>
<button type="button" class="closeBut btn btn-outline-primary btn-rounded btn-md ml-4" data-dismiss="modal">Close</button>
</div>
</div>
<!--/.Content-->
</div>
</div>
<!--Modal: Name-->
javascript和jquery代码是:
<script type="text/javascript">
jQuery(document).ready(function($) {
// snippet for plyr plugin
const player = new Plyr('video', {captions: {active: true}});
window.player = player;
$('#product-video-modal').on('shown.bs.modal', function() {
var product_vid = document.getElementById("product-vid-src");
if (product_vid != null) {
product_vid.pause();
product_vid.currentTime = 0;
}
});
})
</script>
我删除上面评论的“plyr插件片段”的那一刻,HTML5插件工作正常并在模态上显示没有任何问题?
任何输入都将非常感激1
我最后通过执行以下操作解决了这个问题:
1 - 删除以下课程
embed-responsive
2-调整填充
.embed-responsive-16by9 {
padding-bottom:0;
}