Skip to content

Commit

Permalink
fix(playhead): Safeguard getStallsDetected as stallDetector can be nu…
Browse files Browse the repository at this point in the history
…ll (#4581)

`player.getStats()` currently fails when `stallEnabled` is set to false
in Player configuration. In this PR I've added a safeguard to make sure
`getStallsDetected` returns 0 when `stallDetector` is null.
  • Loading branch information
koenoe authored and joeyparrish committed Oct 18, 2022
1 parent ca60381 commit 5d12efd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,4 @@ Vincent Valot <[email protected]>
Wayne Morgan <[email protected]>
Raymond Cheng <[email protected]>
Blue Billywig <*@bluebillywig.com>
Koen Romers <[email protected]>
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,4 @@ Wayne Morgan <[email protected]>
Yohann Connell <[email protected]>
Raymond Cheng <[email protected]>
Janroel Koppen <[email protected]>
Koen Romers <[email protected]>
2 changes: 1 addition & 1 deletion lib/media/playhead.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ shaka.media.MediaSourcePlayhead = class {

/** @override */
getStallsDetected() {
return this.stallDetector_.getStallsDetected();
return this.stallDetector_ ? this.stallDetector_.getStallsDetected() : 0;
}

/** @override */
Expand Down

0 comments on commit 5d12efd

Please sign in to comment.