0
使用HTML 5視頻標記和jQuery,我成功獲得了以全屏模式打開的視頻,以響應事件(點擊,按鍵)。我如何讓視頻在頁面加載而不是onclick上以全屏方式打開?任何幫助,將不勝感激。非常感謝!獲取html 5視頻以全屏模式自動打開
我的HTML:
<div id="video_container>
<video id="video1" width="1280" height="720" controls autoplay>
<source src="videos/ballet.mp4" type="video/mp4">
<source src="videos/ballet.webm" type="video/webm">
<source src="videos/ballet.ogv" type="video/ogg">
</video>
</div>
我的javascript:
$(document).ready(function(){
$('#video1').bind("playing", function(){
var elem = document.getElementById("video1");
if (elem.requestFullscreen) {
elem.requestFullscreen();
} else if (elem.mozRequestFullScreen) {
elem.mozRequestFullScreen();
} else if (elem.webkitRequestFullscreen) {
elem.webkitRequestFullscreen();
}
});
$('#video1').bind("ended", function(){
$("#video_container").hide();
});
});
http://css-tricks.com/custom-controls-in-html5-video-full-screen/ –