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 callingregisterNativePlayerUtils(). 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: Check 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, callisNativeHlsParserSupported() 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”.
- ShakaPlayer version “4.6.18” and “4.3.6”
- Hls.js version “1.5.11”
Step 3: Call the manifest parsing function
Theglobal.parseHlsManifest function implements the HLS manifest parsing. The app must first register itself and then call the parsing function.
- ShakaPlayer
- Hls.js
parseHlsManifest() and pass the following parameters:-
playerName: A string that contains the player name “shaka”. -
playerVersion: A string that contains the player version: “4.6.18” or “4.3.6”. -
absoluteUri: A string that contains the absolute URI of the manifest. -
manifest: An ArrayBuffer that contains the downloaded manifest. -
shaka: For ShakaPlayer only, pass the Shaka object as shown in the next section.
Integration Changes
The following section provides additional details on the usage of the functions shown in the previous steps.- ShakaPlayer
- Hls.js
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 you have applied it. 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
-
Define the Shaka Player version in src/shakaplayer/ShakaPlayer.ts.
-
You can define a flag to enable or disable native parsing. As an example, Step 4 to enable native parsing uses the following flag.
-
Add the call to
parseHlsManifest(). -
Register your implementation of the
parseHlsManifest()function before loading Shaka Player. ThesetNativeFunctions()function allows the app to pass the implementation to the nativeparseHlsManifest()function. It accepts a function as an argument that Shaka Player calls during HLS Parsing.These integration changes are also present in ShakaPlayer.ts that is available as part of externalized release tarball that you can use as a reference.
Supported tags
Shaka Player- ShakaPlayer v4.6.18: All tags supported by Shaka Player version v4.6.18.
- ShakaPlayer v4.3.6: All tags supported by Shaka Player version v4.3.6.
- EXT_X_VERSION
- EXT_X_TARGETDURATION
- EXT_X_MEDIA_SEQUENCE
- EXT_X_DISCONTINUITY_SEQUENCE
- EXT_X_PLAYLIST_TYPE
- EXT_X_ENDLIST
- EXTINF
- EXT_X_BYTERANGE
- EXT_X_DISCONTINUITY
- EXT_X_PROGRAM_DATE_TIME
- EXT_X_KEY
- EXT_X_MAP
Troubleshooting
-
After integrating changes, if you see the following log entry, nativization is not enabled. To enable it, set the nativization enablement flag. For an example of setting the flag, see step 2 of the ShakaPlayer integration.
hlsjs: native playlist parsing is disabled -
After integrating changes, if you see the following log entry, 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 you are using a version that is
OS 1.1 (201010432050)or higher.hlsjs: native offload not enabled!

