Prerequisites
Before you begin to modify your code to play adaptive content on the Dash.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
dependenciessection, include the following dependencies.
-
Open the package.json in your app folder. In the
Configure the Dash.js player for Vega
-
Download the Dash.js Player for Vega to a known location.
To download the Vega Media Player patch for a specific Dash.js version, click the corresponding version number in the following list.
- dash-rel-v5.0.0-r1.9 - Fixes an issue where live playback stalled on streams that have no track-switch events. In that case the loop in Stream.js never ran, so the processor remained undefined.
- dash-rel-v5.0.0-r1.8 - Migrated deprecated xmldom to @xmldom/xmldom.
- dash-rel-v5.0.0-r1.7 - Fixes an issue where the
MediaErrortype was not imported and used globally in the DASH reference application. Previously, when a media error occurred, the application would remain on a black screen indefinitely instead of surfacing the appropriate error state to the user.
-
Expand the Dash.js Player package.
For example.
- Navigate to the /dash-rel/scripts directory.
- Run the setup.sh helper script.
./setup.sh
The setup.sh script performs a build which generates a directory named dash.js:
- From the generated dash.js directory, copy the contents of the dash-rel/src/* directory to <app root>/src/*.
- From the generated dash.js directory, copy the dist directory to <app root>/src/dashjsplayer/dist.
Play adaptive content
Complete the following steps to load the Dash.js Player when the Video component is mounted.To play adaptive content with Dash.js player
-
Open your src/App.tsx and replace the contents with the following code.
-
Use the Vega SDK to build the app, run it on a device or simulator, and collect logs. For more details about building and running apps on the simulator or device, see Create a Vega App, Vega Virtual Device, and Run your app on Fire TV Stick.
To integrate the Dash.js player manually
-
Clone the Dash.js package from https://github.com/Dash-Industry-Forum/dash.js.
-
Reset hard to a specific commit.
-
Check out the git branch based on v5.0.0 to a local branch named v5.0.0-kepler:.
- Download the Vega Dash.js Player package to a known location where you will expand the file.
-
Expand the file.
-
Apply the Dash.js patches:
-
Install the Dash.js dependencies by running npm install.
-
Build the Dash.js Player by running npm run build.
Related topics
- W3C Media Player Overview
- Play adaptive content using Hls.js Player
- Play adaptive content (HLS/DASH) with Shaka Player
- Media Player playlist playback

