Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support
Skip to main content
Media Source Extensions (MSE) players such as Shaka Player, Hls.js, and Bitmovin perform CPU-intensive tasks in JavaScript. These include parsing multiple HLS media manifests, which can impact UI responsiveness and fluidity of the application. This impact is particularly noticeable during Live TV playback with large DVR windows that has large manifest sizes. This documentation explains how to optimize performance by leveraging the native implementation of HLS playlist parser. Moving to native parsing offers a significant performance improvement, but not all applications are required to switch to native HLS parser support. These optimizations are particularly beneficial for apps handling Live TV playback with large DVR windows as frequent refresh and parsing of large manifest resulting in frequent JS thread blockages, Key events and UI processing getting delayed. Apps can also use this optimization to improve video startup latencies.

React Native for Vega APIs

You can offload HLS manifest parsing to the native layer using the following functions:

Step 1: Enable native parsing

To enable native parsing, the app must register the native functions by calling registerNativePlayerUtils(). If the device supports native functions, the call returns true, otherwise false. The call registers the app and enables calls to the native HLS parser.

Step 2: Checks availability of native support for HLS playlist parsing

To check whether native support for HLS playlist parsing is available for a specific player and player version call isNativeHlsParserSupported() and pass the following parameters:
  • playerName: Name of the player. Supported values are “shaka” and “hlsjs”.
  • playerVersion: Version of the player. For “shaka” “4.6.18” or “4.3.6”. For “hlsjs” “1.5.11”.
Supported player versions:
  • The native HLS parser is currently supported for ShakaPlayer version “4.6.18” and “4.3.6”.
  • The native HLS parser is currently supported for Hls.js version “1.5.11”.

Step 3: Call the manifest parsing function

The global.parseHlsManifest function implements the HLS manifest parsing. The app must first register itself and then call the parsing function.
To parse the manifest call parseHlsManifest() and pass the following parameters:
  • playerName: String that contains the player name “shaka”.
  • playerVersion: String that contains the player version: “4.6.18” or “4.3.6”.
  • absoluteUri: String that contains the absolute URI of the manifest.
  • manifest: And ArrayBuffer that contains the downloaded manifest.
  • shaka: For ShakaPlayer only, pass the Shaka object as shown in the next section.
The following section provides additional details on the usage of these.

Integration Changes

The following section provides additional details on the usage of the functions shown in the previous steps.
The native HLS parser is supported for the 4.6.18 and 4.3.6 versions of Shaka player. For information about using the Shaka Player in your app with all the required patches applied, see Play adaptive content (HLS/DASH) with Shaka Player.Note: Before building the player, make sure that the Shaka Player release tarball contains the Shaka-Player-optimizations.patch file and that it is applied. This enables the hook to register the HLS parsing function. This patch is included starting with the following versions:
  • ShakaPlayer v4.6.18: shaka-rel-v4.6.18-r2.9.tar.gz
  • ShakaPlayer v4.3.6: shaka-rel-v4.3.6-r2.2.tar.gz
To use this functionality, make the following changes in your apps src/shakaplayer/ShakaPlayer.ts file:
  1. Define the Shaka Player version in src/shakaplayer/ShakaPlayer.ts.
  2. You can also define flag to enable or disable native parsing. As an example, the following flag is used in Step 4 to enable native parsing.
  3. Add the call to parseHlsManifest().
  4. Register your implementation of the parseHlsManifest() function before loading Shaka Player. The setNativeFunctions() function allows the app to pass the implementation to the native parseHlsManifest function. It accepts a function as an argument which is called from Shaka Player during HLS Parsing.
    These integration changes are also present in ShakaPlayer.ts which is available as part of externalized release tarball which you can be use as a reference.

Supported tags

Shaka Player
  • ShakaPlayer v4.6.18: All tag supported by Shakaplayer version v4.6.18.
  • ShakaPlayer v4.3.6: All tag supported by Shakaplayer version v4.3.6.
Hls.js Player The following lists contain the supported tags: Media Playlist
  • EXT_X_VERSION
  • EXT_X_TARGETDURATION
  • EXT_X_MEDIA_SEQUENCE
  • EXT_X_DISCONTINUITY_SEQUENCE
  • EXT_X_PLAYLIST_TYPE
  • EXT_X_ENDLIST
Media Segment
  • EXTINF
  • EXT_X_BYTERANGE
  • EXT_X_DISCONTINUITY
  • EXT_X_PROGRAM_DATE_TIME
  • EXT_X_KEY
  • EXT_X_MAP
For the description of these tags, see RFC 8216.

TroubleShooting

  • After integrating changes, if the following log entry is observed, nativization is not enabled. To enable it, set the nativization enablement flag. For an example of setting the flag, see step 2 of the ShakePlayer integration. hlsjs: native playlist parsing is disabled
  • After integrating changes, if the following log entry is observed, nativization is not enabled. The most likely cause is that the Vega OS release version is not compatible and doesn’t have the required nativization changes. Make sure that your are using a version that is OS 1.1 (201010432050) or higher. hlsjs: native offload not enabled!

Last modified on January 27, 2026