Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 <video> element - buffering size, starting video quickly

is there any way we can specify the buffering data size for the element? Is it somewhere specified how much data/seconds the browser needs to buffer?

I am asking because we need to make the video shown as soon as possible, even if that means cutting the buffer size to absolute minimum...

We do not use any streaming protocol (e.g. HLS). It is simple progressive download of a large video file...

Thanks

STeN

like image 799
STeN Avatar asked Dec 05 '11 08:12

STeN


1 Answers

  1. you canNOT change the buffer size of browsers at the current time

  2. simply do the following after the video-element is available to the DOM (i.e. use jQuery's onLoad function to run it)

    myVideo = document.getElementById("myVideoId");
    myVideo.load();
    myVideo.play();
    

    this will start the video as soon as possible - unless you try to serve it on an iOS-device. Apple prohibits autoplay and actually fixed possible workarounds from the past.

like image 120
Jörn Berkefeld Avatar answered Oct 15 '22 05:10

Jörn Berkefeld