as

Settings
Sign out
Notifications
Alexa
亚马逊应用商店
Ring
AWS
文档
Support
Contact Us
My Cases
新手入门
设计和开发
应用发布
参考
支持
跳转到主要内容
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
最后修改于 2026年1月27日