Skip to content

Commit 6046e48

Browse files
author
Rob Walch
committed
Fix demo real-time stats
v0.x -> v1.0 breaking changes stats.trequest -> stats.loading.start stats.tfirst -> stats.loading.first stats.tload -> stats.loading.end stats.tparsed -> stats.parsing.end stats.tbuffered -> stats.buffering.end
1 parent 00596cc commit 6046e48

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

demo/main.js

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,10 @@ function loadSelectedStream () {
297297
name: '',
298298
start: 0,
299299
end: data.levels.length,
300-
time: data.stats.trequest - events.t0,
301-
latency: data.stats.tfirst - data.stats.trequest,
302-
load: data.stats.tload - data.stats.tfirst,
303-
duration: data.stats.tload - data.stats.tfirst
300+
time: data.stats.loading.start - events.t0,
301+
latency: data.stats.loading.first - data.stats.loading.start,
302+
load: data.stats.loading.end - data.stats.loading.first,
303+
duration: data.stats.loading.end - data.stats.loading.first
304304
});
305305
trimEventHistory();
306306
self.refreshCanvas();
@@ -357,14 +357,14 @@ function loadSelectedStream () {
357357
id: data.level,
358358
start: data.details.startSN,
359359
end: data.details.endSN,
360-
time: data.stats.trequest - events.t0,
361-
latency: data.stats.tfirst - data.stats.trequest,
362-
load: data.stats.tload - data.stats.tfirst,
363-
parsing: data.stats.tparsed - data.stats.tload,
364-
duration: data.stats.tload - data.stats.tfirst
360+
time: data.stats.loading.start - events.t0,
361+
latency: data.stats.loading.first - data.stats.loading.start,
362+
load: data.stats.loading.end - data.stats.loading.first,
363+
parsing: data.stats.parsing.end - data.stats.loading.end,
364+
duration: data.stats.loading.end - data.stats.loading.first
365365
};
366366

367-
const parsingDuration = data.stats.tparsed - data.stats.tload;
367+
const parsingDuration = data.stats.parsing.end - data.stats.loading.end;
368368
if (stats.levelParsed) {
369369
this.sumLevelParsingMs += parsingDuration;
370370
} else {
@@ -388,11 +388,11 @@ function loadSelectedStream () {
388388
id: data.id,
389389
start: data.details.startSN,
390390
end: data.details.endSN,
391-
time: data.stats.trequest - events.t0,
392-
latency: data.stats.tfirst - data.stats.trequest,
393-
load: data.stats.tload - data.stats.tfirst,
394-
parsing: data.stats.tparsed - data.stats.tload,
395-
duration: data.stats.tload - data.stats.tfirst
391+
time: data.stats.loading.start - events.t0,
392+
latency: data.stats.loading.first - data.stats.loading.start,
393+
load: data.stats.loading.end - data.stats.loading.first,
394+
parsing: data.stats.parsing.end - data.stats.loading.end,
395+
duration: data.stats.loading.end - data.stats.loading.first
396396
};
397397
events.load.push(event);
398398
trimEventHistory();
@@ -404,13 +404,13 @@ function loadSelectedStream () {
404404
type: data.frag.type + ' fragment',
405405
id: data.frag.level,
406406
id2: data.frag.sn,
407-
time: data.stats.trequest - events.t0,
408-
latency: data.stats.tfirst - data.stats.trequest,
409-
load: data.stats.tload - data.stats.tfirst,
410-
parsing: data.stats.tparsed - data.stats.tload,
411-
buffer: data.stats.tbuffered - data.stats.tparsed,
412-
duration: data.stats.tbuffered - data.stats.tfirst,
413-
bw: Math.round(8 * data.stats.total / (data.stats.tbuffered - data.stats.trequest)),
407+
time: data.stats.loading.start - events.t0,
408+
latency: data.stats.loading.first - data.stats.loading.start,
409+
load: data.stats.loading.end - data.stats.loading.first,
410+
parsing: data.stats.parsing.end - data.stats.loading.end,
411+
buffer: data.stats.buffering.end - data.stats.parsing.end,
412+
duration: data.stats.buffering.end - data.stats.loading.first,
413+
bw: Math.round(8 * data.stats.total / (data.stats.buffering.end - data.stats.loading.start)),
414414
size: data.stats.total
415415
};
416416
events.load.push(event);
@@ -432,10 +432,10 @@ function loadSelectedStream () {
432432
self.refreshCanvas();
433433
updateLevelInfo();
434434

435-
const latency = data.stats.tfirst - data.stats.trequest;
436-
const parsing = data.stats.tparsed - data.stats.tload;
437-
const process = data.stats.tbuffered - data.stats.trequest;
438-
const bitrate = Math.round(8 * data.stats.length / (data.stats.tbuffered - data.stats.tfirst));
435+
const latency = data.stats.loading.first - data.stats.loading.start;
436+
const parsing = data.stats.parsing.end - data.stats.loading.end;
437+
const process = data.stats.buffering.end - data.stats.loading.start;
438+
const bitrate = Math.round(8 * data.stats.length / (data.stats.buffering.end - data.stats.loading.first));
439439

440440
if (stats.fragBuffered) {
441441
stats.fragMinLatency = Math.min(stats.fragMinLatency, latency);

0 commit comments

Comments
 (0)