Để hiển thị Overlay Element, thay vì làm toàn màn hình video, làm cho cha mẹ của Video Yếu tố toàn màn hình.
xem ví dụ ở đây - https://jsfiddle.net/tv1981/tm069z9c/1/
Trong cấu trúc sau đây, tôi đang làm cho 'container' fullscreen
<div id="container">
<div class="btn-fs" id="btnFS">
Fullscreen
</div>
<div class='logo'>
Logo Overlay
</div>
<video width="100%" height="100%" autoplay>
<source src="http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4" type="video/mp4"> Your browser does not support the video tag.
</video>
<div class='footer'>
This is Test Overlay for Video
</div>
</div>
Javascript
fs.addEventListener('click', goFullScreen);
function goFullScreen() {
var fullscreenElement = document.fullscreenElement || document.mozFullScreenElement ||
document.webkitFullscreenElement || document.msFullscreenElement;
if (fullscreenElement) {
exitFullscreen();
} else {
launchIntoFullscreen(document.getElementById('container'));
}
}
này đang làm việc trong Chrome Version 60.0.3112.101 (Official Bản dựng) (64 bit), Phiên bản dành cho nhà phát triển FireFox 56.0b5 (64 bit)
Nguồn
2017-08-25 10:55:30
Thiết bị thay thế ive giải pháp tôi có trong tâm trí sẽ là "giả toàn màn hình": hiển thị video trong một lớp phủ của 100% màn hình, và sau đó đặt các yếu tố trên đầu trang của nó, nhưng tôi sẽ thích giải pháp toàn màn hình nguyên bản. – Dalibor