Skip to content

Commit

Permalink
demo page: display audio/video buffered in stats
Browse files Browse the repository at this point in the history
  • Loading branch information
mangui committed Jul 26, 2016
1 parent 2fe83e8 commit 6fece45
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ <h4> Stats Display </h4>


'use strict';
var hls,events, stats,
var hls,events, stats,tracks,
enableStreaming = JSON.parse(getURLParam('enableStreaming',true))
autoRecoverError = JSON.parse(getURLParam('autoRecoverError',true)),
enableWorker = JSON.parse(getURLParam('enableWorker',true)),
Expand Down Expand Up @@ -560,6 +560,10 @@ <h4> Stats Display </h4>
$("#HlsStats").text(JSON.stringify(sortObject(stats),null,"\t"));
});

hls.on(Hls.Events.BUFFER_CREATED, function(event,data) {
tracks = data.tracks;
});

hls.on(Hls.Events.FPS_DROP,function(event,data) {
var evt = {time : performance.now() - events.t0, type : "frame drop", name : data.currentDropped + "/" + data.currentDecoded};
events.video.push(evt);
Expand Down Expand Up @@ -775,6 +779,9 @@ <h4> Stats Display </h4>
+ "Played:"
+ timeRangesToString(v.played) + "<br>";

for(var type in tracks) {
log += type + " Buffered:" + timeRangesToString(tracks[type].buffer.buffered) + "<br>";
}

var videoPlaybackQuality = v.getVideoPlaybackQuality;
if(videoPlaybackQuality && typeof(videoPlaybackQuality) === typeof(Function)) {
Expand Down

0 comments on commit 6fece45

Please sign in to comment.