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
The following steps show you how to use Hls.js Player with MSE mode to play adaptive streaming content. Even though the Hls.js Player patches provided by Amazon are for a specific version of the player, you can port them to any version of Hls.js Player that you want to use. Amazon doesn’t prescribe any specific version of Hls.js Player that you must use. You can decide which version of Hls.js Player is most suitable for your requirement. For issues related to Hls.js Player’s ability to handle your content, engage with the open source community. For more details about the Hls.js Player and the different configurations it supports, see Hls.js Player.

Prerequisites

Before you begin to modify your code to play adaptive content on the Hls.js Player, complete the following prerequisites to set up your app and the player:
  • Set up your app to use the W3C Media Player. For more information, see Media Player Setup.
  • Make the following additional updates to enable the Adaptive Playback:
    • Open the package.json in your app folder. In the dependencies section, include the following dependencies.

Configure the Hls.js player for Vega

  1. Download the Hls.js Player for Vega to a known location. To download the Vega Media Player patch for a specific Hls.js version, click the corresponding version number in the following list.
    • v1.5.11-r1.7 - Migrated deprecated xmldom to @xmldom/xmldom.
    • v1.5.11-r1.6 - Fixes for Captions rendering.
    • v1.5.11-r1.5 - Updated polyfills to support Headless JS playback. Changed imports from @amazon-devices/react-native-w3cmedia to @amazon-devices/react-native-w3cmedia/dist/headless.
  2. Expand the Hls.js Player package. For example. tar -xzf hls-rel-v1.5.11-r1.5.tar.gz
  3. Navigate to the /hls-rel/scripts directory.
  4. Run the setup.sh helper script. ./setup.sh The setup.sh script performs a build which generates a directory named hls.js.
    • From the generated hls.js directory, copy the contents of the hls-rel/src/* directory to <app root>/src/*.
    • From the generated hls.js directory, copy the dist directory to <app root>/src/hlsjsplayer/dist.
    • From the generated hls.js directory, copy the hls-rel/polyfills directory to <app root>/src/hlsjsplayer/.

Play adaptive content

Complete the following steps to load the Hls.js Player when the Video component is mounted.

To play adaptive content with Hls.js player

  • Open your src/App.tsx and replace the contents with following code.
  • Use the Vega SDK to build the app, run it on device or simulator and collect logs. For more details about building and running apps on the simulator, see Create a Vega App and Vega Virtual Device.

To integrate the Hls.js player manually

  1. Clone the Hls.js package from https://github.com/video-dev/hls.js.
  2. Checkout the git branch based on v1.5.11 to a local branch named v1.5.11-kepler.
  3. Download the Vega Hls.js Player package to a known location where you will expand the file.
  4. Expand the file.
  5. Apply the Hls.js patches:
  6. Install Hls.js dependencies by running npm install:
  7. Build Hls.js Player by running npm run build
    If you receive error in which the build is unable to resolve the base-64 and xmldom node modules, run the following commands to install them.

Last modified on June 3, 2026