문제

I'm making a simple web page, and I wanted the first window to have a full screen playing video. I tried to embed it like this:

<div class="section active">
<video id="video_background" preload="auto" autoplay="true" loop="loop" muted="muted" volume="0"> 
<source src="videos/Space.mp4" type="video/mp4">
<source src="videos/Space.webm" type="video/webm"> 
Video not supported 
</video> 

and

#video_background {
    position: absolute;
    bottom: 0px;
    right: 0px;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    z-index: 69;
    overflow: hidden;
}

The first frame shows up, but it doesn't start playing. The files are in their proper location. Why could this be? I'm using fullPage.js if it makes any difference.

도움이 되었습니까?

해결책

Please check this link: https://github.com/alvarotrigo/fullPage.js/issues/267

You will have to make use of the callbacks afterRender or afterLoad for it.

$.fn.fullpage({
    afterRender: function(){
        $('#video')[0].play();
    }
});

Now you can find also an available example to download in the examples folder of the plugin.

다른 팁

Try this

<div class="section active">
<video id="video_background" autoplay loop muted preload="auto">
<source src="videos/Space.mp4" type="video/mp4">
<source src="videos/Space.webm" type="video/webm"> 
Video not supported 
</video> 
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top