mp4没有参加野生动物园11

时间:2017-11-17 05:21:59

标签: video safari html5-video

我必须.mp4视频。一个是用HTML 5标签在safari中玩,而另一个则不是。 为什么呢?

<video loop autoplay muted >
        <source src="video.mp4" type="video/mp4"></source>            
        <source src="video.ogv" type="video/ogg; codecs=theora, vorbis"></source>
        <source src="video.webm" type="video/webm; codecs=vp8, vorbis"></source>
    </video>

1 个答案:

答案 0 :(得分:0)

<script>
        var video = document.getElementById("video-bg");
        var refreshVideo,videoReady;
        video.play();
        refreshVideo = setInterval(function(){
            if ( video.readyState === 4 ) {
                videoReady = true;                      
                if (video.play){
                    stopFunc();
                }               
            }else{  
                videoReady = false;
            }
            if(videoReady == true){
                video.play();
            }
        },500)
        function stopFunc(){
            clearInterval(refreshVideo);
        }       
    </script>