Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is a Youtube buffer finish event possible

Is it possible to detect the finish of a youtube buffering through javascript? Here http://code.google.com/intl/de-DE/apis/youtube/js_api_reference.html are a lot of methods but no one has an event that says "finished with buffering".

like image 895
Bartosz Stankiewicz Avatar asked Jul 21 '11 09:07

Bartosz Stankiewicz


1 Answers

var ytplayer;

function onYouTubePlayerReady(playerId) {
    ytplayer = document.getElementById("myytplayer");
    checkBuffer();
}

function checkBuffer(){
    if(ytplayer.getVideoBytesLoaded() == ytplayer.getVideoBytesTotal()){
        alert('Buffer Complete!');
    }else{
        var t = setTimeout(function(){
            Editor.split();
        },1000);
    }
}
like image 96
Alessandro Avatar answered Oct 15 '22 15:10

Alessandro