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
This topic provides an example of implementing JavaScript logic on the onEnded property to automatically start playback of a second video after the first video completes.

Prerequisites

Set up your app to use the W3C Media Player. For more information, see Media Player Setup.

Integrating the playlist

In App.tsx, modify as shown in the code examples. It converts the content to an array of contents and adds another media item entry. It then registers an onEnded prop, unloads the current content, and starts playback of next content when the onEnded event is triggered. The highlighted steps below are relevant to playing back a content playlist

Code examples

The following code examples show two ways to play non-adaptive content:

VideoPlayer API

Open your src/App.tsx and replace the contents with the following code block. 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.

Video component

Open your src/App.tsx and replace the contents with the following code block. 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.

See Also

Media Player API
Last modified on January 27, 2026