Implement XML parsing
You can offload XML parsing to the native parser using the following functions.registerNativePlayerUtils()
To use native parsing, the app must register the native functions. The registerNativePlayerUtils() function registers the app and allows it to call the Native XML parser. If the current platform supports native parsing the function returns true, otherwise false.
boolean isNativeXmlParserSupported(playerName: string, playerVersion: string)
- playerName: Specifies the name of the player. The supported value is “shaka”.
- playerVersion: Version of the player. For Shaka Player, only
4.6.18and4.3.6support native XML parsing. Later versions don’t need it.
nativeParseFromString (manifest, expectedRoot)
The following arguments must be passed for shakaPlayer:
- manifest: An
ArrayBufferthat contains the downloaded manifest. - expectedRoot: The expected root element of the parsed XML.
global.nativeParseFromString() function provides the native implementation for XML parsing and the player calls it after registration.
unloadNativeXmlParser()
The unloadNativeXmlParser() function unloads the native parser cache. Call it when the app is done using the player. You typically make this call as part of Player’s unload() function.
Integration Changes
Shaka Player
Versions4.6.18 and 4.3.6 of Shaka Player support the native XML Parser. For information on using the Shaka Player in your app with all the required patches applied, see Play adaptive content (HLS/DASH) with Shaka Player.
Both of these versions are superseded. Shaka Player 4.16.13 replaces 4.6.18, and the Vega port of 4.3.6 reached end-of-life on September 1, 2025. Shaka Player 4.8.5 and later parse DASH manifests with TXml, which handles large manifests efficiently, so those versions don’t need the native XML parser. The integration steps in this section apply only to 4.6.18 and 4.3.6.
To successfully integrate the XML Parser:
- Make sure that the Shaka Player build has Shaka-Player-changes-for-Dash-nativization.patch that enables the hook to register the XML parsing function.
- As part of the nativization release drop, we are also making a polyfill addition:
DOMParserPolyfill. Make sure that you pick DOMParserPolyfill.ts as part of your app polyfills. - Make sure that you pick the updated release of the MiscPolyfill.ts file as part of your app polyfills. This polyfill has updates to remove reliance on the base
DomParserobject.
4.6.18 and 4.3.6. For the download links and the release notes for each revision, see Play adaptive content (HLS/DASH) with Shaka Player.
Changes that you must make in src/shakaplayer/ShakaPlayer.ts of your app:
-
If not already defined, define the Shaka Player name and version in src/shakaplayer/ShakaPlayer.ts:
-
Optionally, you can define a flag to enable and disable native XML parsing. As an example, the fifth step to enable native parsing use the following flag.
-
Import and install
DOMParserPolyfill. -
Call
nativeParseFromString(). -
In your ShakaPlayer.ts file, add a
load()function to validate whether the required functionality is available for native XML parsing. After it validates the functionality, it callssetNativeFunctions()to pass the implementation from Shaka Player to the native XML parser by callingnativeParseFromString(). ThesetNativeFunctions()accepts a function as an argument that Shaka Player calls during XML Parsing. -
In your ShakaPlayer.ts file, add an
unload()function to check whether native XML parsing is enabled. If it is, callunloadNativeXmlParserto unload the parser.

