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

Prerequisites

Before you begin to modify your code to play adaptive content on the Shaka 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.
  • Review the Shaka Player documentation for a full list of dependencies.
  • Make the following additional updates to enable the Shaka Player:
    • Open the package.json in your app folder. In the dependencies section, include the following dependencies.

Configure the Shaka Player for Vega

  1. Download the Shaka Player for Vega to a known location. Vega supports the following Shaka Player versions. For information about what each version contains, refer to the release notes:
    • For information about what the source versions contain, read the 4.16.13 release notes
      • 4.16.13-r1.2 - Migrated deprecated xmldom to @xmldom/xmldom.
      • 4.16.13-r1.1 - Updates setup.sh to use python3, fixes native tracks integration, adds MPEG1 video mime, and handles mime types without codec info.
    • For information about what the source versions contain, read the 4.8.5 release notes
      • 4.8.5-r1.7 - Migrated deprecated xmldom to @xmldom/xmldom.
      • 4.8.5-r1.6 - Updates setup.sh to use python3, fixes native tracks integration, adds MPEG1 video mime, and handles mime types without codec info.
      • 4.8.5-r1.3 - Bug fix related to playback failure during some codec switch use cases and fixes for AV sync issues on seek and variant switch.
      • 4.8.5-r1.2 - Performance and stability improvements implemented across multiple playback scenarios. Enhanced media handling by preventing unnecessary MediaSource resets for identical MIME types. Resolved an issue with infinite manifest update delays. Improved HLS subtitle timing accuracy when X-TIMESTAMP-MAP is present without discontinuity markers. Added functionality for key system access cloning for more robust DRM functionality. Scope for the npm packages updated to @amazon-devices.
    • 4.6.18 release notes
      • 4.6.18-r2.16 - Bug fix related to playback failure during some codec switch use cases.
      • 4.6.18-r2.15 - Performance and stability improvements implemented across multiple playback scenarios. Enhanced media handling by preventing unnecessary MediaSource resets for identical MIME types. Resolved an issue with infinite manifest update delays and bug fixes in DASH nativization.
    • 4.3.6 release notes
      • 4.3.6-r2.5 - Updated polyfills to support Headless JS playback. Changed imports from @amzn/react-native-w3cmedia to @amazon-devices/react-native-w3cmedia/dist/headless. Scope for the npm packages updated to @amazon-devices.
  2. Expand the Shaka Player package. For example. tar -xzf shaka-rel-v4.6.18-r2.12.tar.gz
  3. Navigate to the /shaka-rel/scripts directory.
  4. Run the setup.sh helper script. ./setup.sh
The setup.sh script performs a build which generates a folder in the scripts directory named shaka-player. If there are any build issues, see Troubleshooting Shaka Player build for possible solutions.
  1. From the generated shaka-player directory, copy the contents of the shaka-rel/src/* directory to <app root>/src/*.
  2. From the generated shaka-player directory, copy the dist folder to the <app root>/src/shakaplayer directory.

Play adaptive content

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

To play adaptive content with Shaka Player

  • Open your src/App.tsx and replace the contents with the following code.
To build the app, run it on a device or the simulator, and then collect the logs, run the following command.
For more details about building and running apps on the simulator, see Create a Vega App and Vega Virtual Device.
  • If you need to enable sequence mode for HLS adaptive streams with MPEGTS content in your app, set manifest.hls.sequenceMode to true as shown in the following example.
With this function, you can use Sequence Mode for HLS streams. Sequence mode supports playback of adjacent segments independent of the segments’ timestamps. This is useful where media segment timestamps are out of order and can cause a stall in the media pipeline.

To integrate the Shaka Player manually

  1. Clone the Shaka package from https://github.com/shaka-project/shaka-player.
  2. Check out the git branch based on the version of Shaka Player that you are using to a local branch named v<x.y.z>-kepler. Replace the x.y.z with the major, minor, and patch version numbers of the version that you are checking out.
  3. Download a Vega Shaka Player package that matches the version of Shaka Player you are using to a known location where you will expand the file.
  4. Expand the file. For example. tar -xzf shaka-rel-v4.6.18-r2.12.tar.gz
  5. Apply the Shaka patches.
  6. Build Shaka Player by running build/all.py.

Troubleshooting Shaka Player build

glibc not found error

If you receive the following error, set up node 16.20.2 as shown in the following example.
Set up nvm 16.20.2

ESLint error

Make sure that no parent directory has a .eslintrc.js file present.

Build doesn’t complete

Edit the package-lock.json file and replace all instances of string ‘git+ssh’ with ‘https’.
Last modified on June 3, 2026