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

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

isAndroidCastDevice() → {boolean}

Check if the current platform is a Android-based Cast devices.
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

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

isMediaKeysPolyfilled() → {boolean}

Returns true if MediaKeys is polyfilled
Source:
Returns:
Type
boolean

isMobile() → {boolean}

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

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

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

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

isXboxOne() → {boolean}

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

requiresEncryptionInfoInAllInitSegments() → {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.
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

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