Skip to content

Commit

Permalink
feat!(hls): HLS disabled in old browsers/platforms due to incompatibi…
Browse files Browse the repository at this point in the history
…lities (#3964)

In Tizen 2/3 and WebOS 3.x there is no support for SourceBuffer.mode=sequence so as a result of change #2337, it necessary disable support for the HLS parser so that the user can at least use the native one with src= .
  • Loading branch information
Álvaro Velad Galván committed Feb 18, 2022
1 parent c482e81 commit 0daa00f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -112,6 +112,8 @@ DASH features **not** supported:

## HLS features

**Only supported on browsers with SourceBuffer.mode=sequence support**

HLS features supported:
- VOD, Live, and Event types
- Low-latency streaming with partial segments, preload hints, and delta updates
Expand Down
17 changes: 10 additions & 7 deletions lib/hls/hls_parser.js
Expand Up @@ -2497,10 +2497,13 @@ shaka.hls.HlsParser.PresentationType_ = {
LIVE: 'LIVE',
};


shaka.media.ManifestParser.registerParserByExtension(
'm3u8', () => new shaka.hls.HlsParser());
shaka.media.ManifestParser.registerParserByMime(
'application/x-mpegurl', () => new shaka.hls.HlsParser());
shaka.media.ManifestParser.registerParserByMime(
'application/vnd.apple.mpegurl', () => new shaka.hls.HlsParser());
if (!shaka.util.Platform.isTizen3() &&
!shaka.util.Platform.isTizen2() &&
!shaka.util.Platform.isWebOS3()) {
shaka.media.ManifestParser.registerParserByExtension(
'm3u8', () => new shaka.hls.HlsParser());
shaka.media.ManifestParser.registerParserByMime(
'application/x-mpegurl', () => new shaka.hls.HlsParser());
shaka.media.ManifestParser.registerParserByMime(
'application/vnd.apple.mpegurl', () => new shaka.hls.HlsParser());
}
12 changes: 12 additions & 0 deletions lib/util/platform.js
Expand Up @@ -142,6 +142,18 @@ shaka.util.Platform = class {
return shaka.util.Platform.userAgentContains_('Web0S');
}

/**
* Check if the current platform is a WebOS 3.
*
* @return {boolean}
*/
static isWebOS3() {
// See: http://webostv.developer.lge.com/discover/specifications/web-engine/
return shaka.util.Platform.userAgentContains_('Web0S') &&
shaka.util.Platform.userAgentContains_(
'Chrome/38.0.2125.122 Safari/537.36');
}

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

0 comments on commit 0daa00f

Please sign in to comment.