我正在寻找一种解决方案来获得 html5 视频的透明海报图像。
我有一个页面,其背景图片覆盖了页面的整个宽度(例如 1920x600)。我只想在这张背景图片的中间显示视频播放按钮。视频和背景图片具有不同的纵横比。按下播放按钮后,视频应以正确的纵横比显示在背景图片上。
作为 html5 视频播放器,我使用Plyr。
这是播放器的实际实现:
<style>
.container_plyr_teaser {
padding: 16px 0px 0px 0px;
max-width: 1000px;
margin: auto;
}
.plyr {
border-radius: 15px;
}
.plyr--stopped .plyr__controls {
opacity: 0;
pointer-events: none;
}
</style>
<div class="container_plyr_teaser">
<video class="js-player" controls playsinline preload="none" id="player11" data-plyr-config='{"volume": 0.3, "resetOnEnd": true, "enabled": true, "storage": { "enabled": false }, "quality": { "default": 720 } }'>
<source src="wolken_360p.mp4" type="video/mp4" size="360">
<source src="wolken_720p.mp4" type="video/mp4" size="720">
<source src="wolken_1080p.mp4" type="video/mp4" size="1080">
</video>
</div>
我的第一个想法是,使用透明海报图像poster="Wolken_Poster_transparent_16x9.png"
会产生黑色视频播放器。
我的第二个想法是使用背景图片的精确剪裁作为视频海报图像。这看起来符合要求,但仅适用于确切的分辨率。
如果浏览器窗口的分辨率错误,您将在视频海报图像和背景图像之间获得不吸引人的重叠。
另一个解决方案的想法?