MediaPlayerEvents.BUFFER_EMPTY not triggering
Created by: protoAdnan
Hi all,
I am trying to implement a dash player and track the rebuffering (stalling) events and bitrates during the video playback.
I tried to look for "MediaPlayerEvents.BUFFER_EMPTY" or just "bufferstalled" to track stalling events in the playback as: player.on(dashjs.MediaPlayer.events.dashjs.BUFFER_EMPTY, function() {n_buff += 1;});
but apparently "MediaPlayerEvents.BUFFER_EMPTY" or "bufferstalled" never triggers even when the video stalls and console registers the stalling event.
I am able to track buffering events using "MediaPlayerEvents.LOG" or "log" events and checking for a "Stalling Buffer" substring in the string like: player.on(dashjs.MediaPlayer.events.dashjs.LOG, function(event) {if ( event.message.indexOf("Stalling Buffer") > -1 ){n_buff += 1;}});
However, I was wondering why the first approach isn't working. We should be able to track event triggered by the dashjs scripts.
On the other hand, I was able to track the stalling events from player element using. var waitTime; function playHandler() { console.log('Rebuffering for ' + (window.performance.now() - waitTime)); waitTime = NaN; element.removeEventListener(playHandler); } element.addEventListener('waiting', function() { waitTime = window.performance.now(); element.addEventListener('playing', playHandler); });
One more thing: in the dash.all.debug.js I saw that there are 2 different instances and assignments of BUFFER_EMPTY.
- BUFFER_EMPTY = 'bufferstalled' in MediaPlayerEvents
- BUFFER_EMPTY = 'bufferStalled' in some other scope.
I am not sure what is happening here. If anyone can clear this up I would be extremely grateful.
Regards