mirror of
https://github.com/owncast/owncast.git
synced 2024-11-25 14:20:54 +03:00
Guard against browsers not running VHS
This commit is contained in:
parent
cd4f19108a
commit
44afc9c1ea
2 changed files with 12 additions and 2 deletions
|
@ -63,6 +63,10 @@ class LatencyCompensator {
|
|||
|
||||
const tech = this.player.tech({ IWillNotUseThisInPlugins: true });
|
||||
|
||||
if (!tech || !tech.vhs) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// Check the player buffers to make sure there's enough playable content
|
||||
// that we can safely play.
|
||||
|
|
|
@ -211,11 +211,12 @@ class OwncastPlayer {
|
|||
this.appPlayerPlayingCallback();
|
||||
}
|
||||
|
||||
if (!this.hasStartedPlayback) {
|
||||
if (this.latencyCompensator && !this.hasStartedPlayback) {
|
||||
this.latencyCompensator.enable();
|
||||
this.hasStartedPlayback = true;
|
||||
}
|
||||
|
||||
this.hasStartedPlayback = true;
|
||||
|
||||
setInterval(() => {
|
||||
this.collectPlaybackMetrics();
|
||||
}, 5000);
|
||||
|
@ -223,6 +224,10 @@ class OwncastPlayer {
|
|||
|
||||
collectPlaybackMetrics() {
|
||||
const tech = this.vjsPlayer.tech({ IWillNotUseThisInPlugins: true });
|
||||
if (!tech || !tech.vhs) {
|
||||
return;
|
||||
}
|
||||
|
||||
const bandwidth = tech.vhs.systemBandwidth;
|
||||
this.playbackMetrics.trackBandwidth(bandwidth);
|
||||
|
||||
|
@ -242,6 +247,7 @@ class OwncastPlayer {
|
|||
if (this.appPlayerEndedCallback) {
|
||||
this.appPlayerEndedCallback();
|
||||
}
|
||||
|
||||
this.latencyCompensator.disable();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue