Player Buffer Events
Buffer events:
Tracking buffer events:
Buffer events and buffer evaluates
are documented on the player API page.
<script>
kWidget.addReadyCallback(function( playerId ){
var kdp = document.getElementById(playerId);
kdp.kBind('bufferProgress', function(event){
$('.bufferEvents').prepend( "bufferProgress: " + event.newTime + " sec, buffered: " +
( kdp.evaluate("{video.buffer.percent}") * 100 ).toFixed(2) + "%\n" );
})
kdp.kBind('bufferStartEvent', function(){
$('.bufferEvents').prepend( "bufferStartEvent\n");
})
kdp.kBind('bufferEndEvent', function( event ){
// to access buffer duration you can read the event object or evaluate against mediaProxy
// for the latest buffer duration both in float seconds.
var bufferDuration = event.bufferDuration || kdp.evaluate("{video.buffer.duration}");
$('.bufferEvents').prepend( "bufferEndEvent: bufferrTime: " + bufferDuration + " currentTime: " +
kdp.evaluate("{video.player.currentTime}") + "\n" );
})
});
</script>