Class: shaka.util.Platform

Constructor

new Platform()

Source:

Members

cachedMediaElement_ :HTMLMediaElement

Type:
Source:

cacheExpirationTimer_ :shaka.util.Timer

Type:
Source:

Methods

anyMediaElement() → {HTMLMediaElement}

For canPlayType queries, we just need any instance. First, use a cached element from a previous query. Second, search the page for one. Third, create a temporary one. Cached elements expire in one second so that they can be GC'd or removed.
Source:
Returns:
Type
HTMLMediaElement

chromeVersion() → {number}

Returns a major version number for Chrome, or Chromium-based browsers. For example: - Chrome 106.0.5249.61 returns 106. - Edge 106.0.1370.34 returns 106 (since this is based on Chromium). - Safari returns null (since this is independent of Chromium).
Source:
Returns:
A major version number or null if not Chromium-based.
Type
number

detectMaxHardwareResolution() → {Promise.<shaka.extern.Resolution>}

Detect the maximum resolution that the platform's hardware can handle.
Source:
Returns:
Type
Promise.<shaka.extern.Resolution>

isAmazonFireTV() → {boolean}

Check if the current platform is Amazon Fire TV. https://developer.amazon.com/docs/fire-tv/identify-amazon-fire-tv-devices.html
Source:
Returns:
Type
boolean

isAndroid() → {boolean}

Return true if the platform is a Android, regardless of the browser.
Source:
Returns:
Type
boolean

isAndroidCastDevice() → {boolean}

Check if the current platform is a Google Chromecast with Android (i.e. Chromecast with GoogleTV).
Source:
Returns:
Type
boolean

isAPL() → {boolean}

Check if the current platform is an APL set-top box.
Source:
Returns:
Type
boolean

isApple() → {boolean}

Check if the current platform is from Apple. Returns true on all iOS browsers and on desktop Safari. Returns false for non-Safari browsers on macOS, which are independent of Apple.
Source:
Returns:
Type
boolean

isChrome() → {boolean}

Check if the current platform is Google Chrome.
Source:
Returns:
Type
boolean

isChromecast() → {boolean}

Check if the current platform is a Google Chromecast.
Source:
Returns:
Type
boolean

isEdge() → {boolean}

Check if the current platform is MS Edge.
Source:
Returns:
Type
boolean

isEOS() → {boolean}

Check if the current platform is an EOS set-top box.
Source:
Returns:
Type
boolean

isFirefox() → {boolean}

Check if the current platform is Firefox.
Source:
Returns:
Type
boolean

isFuchsia() → {boolean}

Return true if the platform is a Fuchsia, regardless of the browser.
Source:
Returns:
Type
boolean

isFuchsiaCastDevice() → {boolean}

Check if the current platform is a Google Chromecast with Fuchsia (i.e. Google Nest Hub).
Source:
Returns:
Type
boolean

isHisense()

Check if the current platform is Hisense.
Source:

isIE() → {boolean}

Check if the current platform is MS IE.
Source:
Returns:
Type
boolean

isLegacyEdge() → {boolean}

Check if the current platform is Legacy Edge.
Source:
Returns:
Type
boolean

isMac() → {boolean}

Return true if the platform is a Mac, regardless of the browser.
Source:
Returns:
Type
boolean

isMediaKeysPolyfilled(polyfillTypeopt) → {boolean}

Returns true if MediaKeys is polyfilled
Parameters:
Name Type Attributes Description
polyfillType string <optional>
Source:
Returns:
Type
boolean

isMobile() → {boolean}

Guesses if the platform is a mobile one (iOS or Android).
Source:
Returns:
Type
boolean

isOrange()

Check if the current platform is Orange.
Source:

isPS4()

Check if the current platform is Playstation 4.
Source:

isPS5() → {boolean}

Check if the current platform is Playstation 5. Returns true on Playstation 5 browsers. Returns false for Playstation 5 browsers
Source:
Returns:
Type
boolean

isSafari() → {boolean}

Check if the current platform is Apple Safari or Safari-based iOS browsers.
Source:
Returns:
Type
boolean

isSeekingSlow() → {boolean}

On some platforms, such as v1 Chromecasts, the act of seeking can take a significant amount of time.
Source:
Returns:
Type
boolean

isSkyQ()

Check if the current platform is SkyQ STB.
Source:

isSmartTV() → {boolean}

Return true if the platform is controlled by a remote control.
Source:
Returns:
Type
boolean

isTizen() → {boolean}

Check if the current platform is a Tizen TV.
Source:
Returns:
Type
boolean

isTizen2() → {boolean}

Check if the current platform is a Tizen 2 TV.
Source:
Returns:
Type
boolean

isTizen3() → {boolean}

Check if the current platform is a Tizen 3 TV.
Source:
Returns:
Type
boolean

isTizen4() → {boolean}

Check if the current platform is a Tizen 4 TV.
Source:
Returns:
Type
boolean

isTizen5() → {boolean}

Check if the current platform is a Tizen 5 TV.
Source:
Returns:
Type
boolean

isTizen5_0() → {boolean}

Check if the current platform is a Tizen 5.0 TV.
Source:
Returns:
Type
boolean

isTizen6() → {boolean}

Check if the current platform is a Tizen 6 TV.
Source:
Returns:
Type
boolean

isVirginMedia()

Check if the current platform is Virgin Media device.
Source:

isWebOS() → {boolean}

Check if the current platform is a WebOS.
Source:
Returns:
Type
boolean

isWebOS3() → {boolean}

Check if the current platform is a WebOS 3.
Source:
Returns:
Type
boolean

isWebOS4() → {boolean}

Check if the current platform is a WebOS 4.
Source:
Returns:
Type
boolean

isWebOS5() → {boolean}

Check if the current platform is a WebOS 5.
Source:
Returns:
Type
boolean

isWindows() → {boolean}

Return true if the platform is a Windows, regardless of the browser.
Source:
Returns:
Type
boolean

isWPE() → {boolean}

Check if the current platform is Comcast X1.
Source:
Returns:
Type
boolean

isXboxOne() → {boolean}

Check if the current platform is an Xbox One.
Source:
Returns:
Type
boolean

isZenterio() → {boolean}

Check if the current platform is Deutsche Telecom Zenterio STB.
Source:
Returns:
Type
boolean

requiresEncryptionInfoInAllInitSegments(keySystemnullable) → {boolean}

Returns true if the platform requires encryption information in all init segments. For such platforms, MediaSourceEngine will attempt to work around a lack of such info by inserting fake encryption information into initialization segments.
Parameters:
Name Type Attributes Description
keySystem string <nullable>
Source:
See:
Returns:
Type
boolean

safariVersion() → {number}

Returns a major version number for Safari, or Safari-based iOS browsers. For example: - Safari 13.0.4 on macOS returns 13. - Safari on iOS 13.3.1 returns 13. - Chrome on iOS 13.3.1 returns 13 (since this is based on Safari/WebKit). - Chrome on macOS returns null (since this is independent of Apple). Returns null on Firefox on iOS, where this version information is not available.
Source:
Returns:
A major version number or null if not iOS.
Type
number

supportsMediaSource() → {boolean}

Check if the current platform supports media source. We assume that if the current platform supports media source, then we can use media source as per its design.
Source:
Returns:
Type
boolean

supportsMediaType(mimeType) → {boolean}

Returns true if the media type is supported natively by the platform.
Parameters:
Name Type Description
mimeType string
Source:
Returns:
Type
boolean

supportsSequenceMode() → {boolean}

Returns true if the platform supports SourceBuffer "sequence mode".
Source:
Returns:
Type
boolean

supportsSmoothCodecSwitching() → {boolean}

Returns if codec switching SMOOTH is known reliable device support. Some devices are known not to support `MediaSource.changeType` well. These devices should use the reload strategy. If a device reports that it supports `changeType` but support it unreliably it should be added to this list.
Source:
Returns:
Type
boolean

userAgentContains_(key) → {boolean}

Check if the user agent contains a key. This is the best way we know of right now to detect platforms. If there is a better way, please send a PR.
Parameters:
Name Type Description
key string
Source:
Returns:
Type
boolean