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
dependenciessection, include the following dependencies.
-
Open the package.json in your app folder. In the
Configure the Shaka Player for Vega
-
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-w3cmediato@amazon-devices/react-native-w3cmedia/dist/headless. Scope for the npm packages updated to@amazon-devices.
- 4.3.6-r2.5 - Updated polyfills to support Headless JS playback. Changed imports from
- For information about what the source versions contain, read the 4.16.13 release notes
-
Expand the Shaka Player package.
For example.
tar -xzf shaka-rel-v4.6.18-r2.12.tar.gz - Navigate to the /shaka-rel/scripts directory.
-
Run the setup.sh helper script.
./setup.sh
- From the generated shaka-player directory, copy the contents of the shaka-rel/src/* directory to <app root>/src/*.
- 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.
-
If you need to enable sequence mode for HLS adaptive streams with MPEGTS content in your app, set
manifest.hls.sequenceModetotrueas shown in the following example.
To integrate the Shaka Player manually
-
Clone the Shaka package from https://github.com/shaka-project/shaka-player.
-
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.
- 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.
-
Expand the file.
For example.
tar -xzf shaka-rel-v4.6.18-r2.12.tar.gz -
Apply the Shaka patches.
-
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.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’.Related topics
- W3C Media Player Overview
- Play adaptive content using Dash.js Player
- Play adaptive content using Hls.js Player
- Media Player playlist playback

