Fully buffer video in Chrome

后端 未结 5 2000
我在风中等你
我在风中等你 2021-02-07 16:01

Is it possible to fully buffer HTML5 video in Chrome (and Opera)?

I host the movie in .mp4 and .webm on amazon S3. In HTML I use standard tag.

5条回答
  •  -上瘾入骨i
    2021-02-07 16:39

    There are several ways to load a video all the way then play it:
    1. There is the goody goody browser developer would be proud way:

    var video = document.createElement('video');
    video.src='myvideo.mp4';
    document.appendChild(video);
    video.load();
    video.addEventListener('loadedmeta',function(){
    video.play()
    });
    

    2. And there is the lazy "But, I'll get carpel tunnel!" developer way:

    
    

    Sources:
    http://www.w3schools.com/tags/tag_video.asp
    how to run js code when video is fully buffered/loaded
    How do I add new Video entirely from JavaScript?
    javascript with html

提交回复
热议问题