mirror of
https://github.com/owncast/owncast.git
synced 2024-10-24 21:45:59 +03:00
Track buffering events as errors differently in playback metrics
This commit is contained in:
parent
78b0f7addc
commit
9f6151359f
2 changed files with 18 additions and 4 deletions
|
@ -238,7 +238,7 @@ class OwncastPlayer {
|
|||
const latency = now - segmentTime;
|
||||
this.playbackMetrics.trackLatency(latency);
|
||||
} catch (err) {
|
||||
console.warn(err);
|
||||
// console.warn(err);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -261,12 +261,12 @@ class OwncastPlayer {
|
|||
}
|
||||
|
||||
handleWaiting(e) {
|
||||
// this.playbackMetrics.incrementErrorCount(1);
|
||||
this.playbackMetrics.isBuffering = true;
|
||||
this.playbackMetrics.incrementErrorCount(1);
|
||||
this.playbackMetrics.setIsBuffering(true);
|
||||
}
|
||||
|
||||
handleNoLongerBuffering() {
|
||||
this.playbackMetrics.isBuffering = false;
|
||||
this.playbackMetrics.setIsBuffering(false);
|
||||
}
|
||||
|
||||
log(message) {
|
||||
|
|
|
@ -11,6 +11,7 @@ class PlaybackMetrics {
|
|||
this.errors = 0;
|
||||
this.qualityVariantChanges = 0;
|
||||
this.isBuffering = false;
|
||||
this.bufferingDurationTimer = 0;
|
||||
|
||||
setInterval(() => {
|
||||
this.send();
|
||||
|
@ -31,6 +32,19 @@ class PlaybackMetrics {
|
|||
this.qualityVariantChanges++;
|
||||
}
|
||||
|
||||
setIsBuffering(isBuffering) {
|
||||
this.isBuffering = isBuffering;
|
||||
|
||||
if (!isBuffering) {
|
||||
clearTimeout(this.bufferingDurationTimer);
|
||||
return;
|
||||
}
|
||||
|
||||
this.bufferingDurationTimer = setTimeout(() => {
|
||||
this.incrementErrorCount(1);
|
||||
}, 500);
|
||||
}
|
||||
|
||||
trackSegmentDownloadTime(seconds) {
|
||||
this.segmentDownloadTime.push(seconds);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue