Continued tweaking of latency compensation
This commit is contained in:
@@ -236,28 +236,35 @@ class OwncastPlayer {
|
||||
this.appPlayerPlayingCallback();
|
||||
}
|
||||
|
||||
setInterval(() => {
|
||||
const tech = this.vjsPlayer.tech({ IWillNotUseThisInPlugins: true });
|
||||
const bandwidth = tech.vhs.systemBandwidth;
|
||||
this.playbackMetrics.trackBandwidth(bandwidth);
|
||||
this.latencyCompensator.enable();
|
||||
|
||||
try {
|
||||
const segment = getCurrentlyPlayingSegment(tech);
|
||||
const segmentTime = segment.dateTimeObject.getTime();
|
||||
const now = new Date().getTime();
|
||||
const latency = now - segmentTime;
|
||||
this.playbackMetrics.trackLatency(latency);
|
||||
} catch (err) {
|
||||
console.warn(err);
|
||||
}
|
||||
setInterval(() => {
|
||||
this.collectPlaybackMetrics();
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
collectPlaybackMetrics() {
|
||||
const tech = this.vjsPlayer.tech({ IWillNotUseThisInPlugins: true });
|
||||
const bandwidth = tech.vhs.systemBandwidth;
|
||||
this.playbackMetrics.trackBandwidth(bandwidth);
|
||||
|
||||
try {
|
||||
const segment = getCurrentlyPlayingSegment(tech);
|
||||
const segmentTime = segment.dateTimeObject.getTime();
|
||||
const now = new Date().getTime();
|
||||
const latency = now - segmentTime;
|
||||
this.playbackMetrics.trackLatency(latency);
|
||||
} catch (err) {
|
||||
console.warn(err);
|
||||
}
|
||||
}
|
||||
|
||||
handleEnded() {
|
||||
this.log('on Ended');
|
||||
if (this.appPlayerEndedCallback) {
|
||||
this.appPlayerEndedCallback();
|
||||
}
|
||||
this.latencyCompensator.disable();
|
||||
}
|
||||
|
||||
handleError(e) {
|
||||
|
||||
Reference in New Issue
Block a user