mirror of
https://github.com/shaka-project/shaka-player.git
synced 2026-06-26 17:46:26 +03:00
fix: don't use navigator.connection event listener if it isn't implemented (#5157)
Fixes #4542
This commit is contained in:
committed by
GitHub
parent
9c4a61f836
commit
fb6830693c
@@ -52,7 +52,7 @@ shaka.abr.SimpleAbrManager = class {
|
||||
// retrieving information about a user's network connection. We listen
|
||||
// to the change event to be able to make quick changes in case the type
|
||||
// of connectivity changes.
|
||||
if (navigator.connection) {
|
||||
if (navigator.connection && navigator.connection.addEventListener) {
|
||||
this.onNetworkInformationChange_ = () => {
|
||||
if (this.config_.useNetworkInformation && this.enabled_) {
|
||||
this.bandwidthEstimator_ = new shaka.abr.EwmaBandwidthEstimator();
|
||||
@@ -143,7 +143,7 @@ shaka.abr.SimpleAbrManager = class {
|
||||
release() {
|
||||
// stop() should already have been called for unload
|
||||
|
||||
if (navigator.connection) {
|
||||
if (navigator.connection && navigator.connection.removeEventListener) {
|
||||
navigator.connection.removeEventListener(
|
||||
'change', this.onNetworkInformationChange_);
|
||||
this.onNetworkInformationChange_ = null;
|
||||
|
||||
Reference in New Issue
Block a user