There's a DOM event called canplaythrough
that you can subscribe to in your JavaScript. This event is called when the browser estimates it can play through the entire video without pausing to buffer.
EDIT: Similarly, you can use the progress
event to determine how much of the video has been buffered:
var player = document.getElementById('video_player'); // The <video> element
player.addEventListener('progress', onVideoProgressUpdate, false);
function onVideoProgressUpdate(e) {
var percentageBuffered = 0;
if (player.buffered.length > 0 && player.buffered.end && player.duration) {
percentageBuffered = player.buffered.end(0) / player.duration;
} else if (player.bytesTotal != undefined && player.bytesTotal > 0 && player.bufferedBytes != undefined) {
percentageBuffered = player.bufferedBytes / player.bytesTotal;
}
if (percentageBuffered == 1) { // 100% of the video has been buffered
player.Play();
}
}