Skip to content

Commit

Permalink
Fix stalls on WebOS (#1820)
Browse files Browse the repository at this point in the history
Disable the StallDetector on WebOS, where we often mistake slowness for stalling.

Fix for #1704
  • Loading branch information
Álvaro Velad Galván authored and joeyparrish committed Feb 26, 2019
1 parent 71e8c49 commit bbbce06
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

AdsWizz <*@adswizz.com>
Alugha GmbH <*@alugha.com>
Alvaro Velad Galvan <alvaro.velad@mirada.tv>
Bonnier Broadcasting <*@bonnierbroadcasting.com>
Bryan Huh <bhh1988@gmail.com>
Esteban Dosztal <edosztal@gmail.com>
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
# Please keep the list sorted.

Aaron Vaage <vaage@google.com>
Alvaro Velad Galvan <alvaro.velad@mirada.tv>
Andy Hochhaus <ahochhaus@samegoal.com>
Benjamin Wallberg <benjamin.wallberg@bonnierbroadcasting.com>
Bryan Huh <bhh1988@gmail.com>
Expand Down
6 changes: 6 additions & 0 deletions lib/media/stall_detector.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
goog.provide('shaka.media.StallDetector');
goog.provide('shaka.media.StallDetector.Implementation');
goog.provide('shaka.media.StallDetector.MediaElementImplementation');
goog.require('shaka.util.Platform');

/**
* Some platforms/browsers can get stuck in the middle of a buffered range (e.g.
Expand Down Expand Up @@ -141,6 +142,11 @@ shaka.media.StallDetector.MediaElementImplementation = class {

/** @override */
shouldBeMakingProgress() {
// If we are in WebOS platform disable StallDetector. This is because WebOS
// TVs tend to have long hardware pipelines that respond slowly, so we tend
// to mistake slow operation for a stall.
if (shaka.util.Platform.isWebOS()) { return false; }

// If we are not trying to play, the lack of change could be misidentified
// as a stall.
if (this.mediaElement_.paused) { return false; }
Expand Down
9 changes: 9 additions & 0 deletions lib/util/platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ shaka.util.Platform = class {
return shaka.util.Platform.userAgentContains_('Tizen 3');
}

/**
* Check if the current platform is a WebOS.
*
* @return {boolean}
*/
static isWebOS() {
return shaka.util.Platform.userAgentContains_('Web0S');
}

/**
* Check if the current platform is a Google Chromecast.
*
Expand Down

0 comments on commit bbbce06

Please sign in to comment.