Skip to content

Commit

Permalink
feat: add Amazon Fire TV platform support (shaka-project#4375)
Browse files Browse the repository at this point in the history
The `isBrowserSupported` function in the `utils/player.js` fails if the Safari Version is < 13. However, this check doesn't work for Amazon Fire TV devices. Even though they have a `Version/4.0` in the user agent string, the browser still supports all other requirements to support playback with Shaka Player. 

Here are a couple of examples of the different FireTV device user agents:

Fire TV Stick 4K - 1st Gen:
Mozilla/5.0 (Linux; Android 7.1.2; AFTMM Build/NS6289; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/100.0.4896.127 Mobile Safari/537.36

Fire TV Stick - 3rd Gen:
Mozilla/5.0 (Linux; Android 9; AFTSSS Build/PS7285.2877N; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/96.0.4664.92 Mobile Safari/537.36

The fix involves identifying the Amazon Fire TV device based on the parameters described [in the Amazon Fire TV docs](https://developer.amazon.com/docs/fire-tv/identify-amazon-fire-tv-devices.html) and disabling the Safari version check for these devices.
  • Loading branch information
subhanahmed047 authored Jul 28, 2022
1 parent bca2c9e commit 5102dac
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/util/platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ shaka.util.Platform = class {
return !!navigator.vendor && navigator.vendor.includes('Apple') &&
!shaka.util.Platform.isTizen() &&
!shaka.util.Platform.isEOS() &&
!shaka.util.Platform.isPS4();
!shaka.util.Platform.isPS4() &&
!shaka.util.Platform.isAmazonFireTV();
}

/**
Expand All @@ -222,6 +223,16 @@ shaka.util.Platform = class {
return shaka.util.Platform.userAgentContains_('PlayStation 4');
}

/**
* Check if the current platform is Amazon Fire TV.
* https://developer.amazon.com/docs/fire-tv/identify-amazon-fire-tv-devices.html
*
* @return {boolean}
*/
static isAmazonFireTV() {
return shaka.util.Platform.userAgentContains_('AFT');
}

/**
* Returns a major version number for Safari, or Safari-based iOS browsers.
*
Expand Down

0 comments on commit 5102dac

Please sign in to comment.