as

Settings
Sign out
Notifications
Alexa
亚马逊应用商店
AWS
文档
Support
Contact Us
My Cases
新手入门
设计和开发
应用发布
参考
支持
感谢您的访问。此页面目前仅提供英语版本。我们正在开发中文版本。谢谢您的理解。

Media Player Set up

This topic specifies the core project settings and updates needed to incorporate the W3C Media Player into a React Native for Vega app.

Create a Vega App. For more details about creating an app, see Create a Vega App.

  • Open the package.json in your app folder. In the dependencies section, include the react-native-w3cmedia package.

    Copied to clipboard.

    "@amazon-devices/react-native-w3cmedia": "~2.1.80"
    
  • Open a terminal window and navigate to your app folder. Run npm to install the package in your app,

    Copied to clipboard.

      npm install
    
  • Update your babel.config.js file, otherwise the app throws a "ReferenceError: Property 'React' doesn't exist" exception during runtime.

    Copied to clipboard.

    module.exports = {
        presets: [ ['module:metro-react-native-babel-preset', { useTransformReactJSXExperimental: true }] ],
        plugins: [
          [
            '@babel/plugin-transform-react-jsx',
            {
              runtime: 'automatic',
            },
          ],
        ]
      };
    
  • Add the following permissions to the app manifest in the mainfest.toml file.

    Copied to clipboard.

    [wants]
    [[wants.service]]
    id = "com.amazon.mediametrics.service" # Required for metrics service
    
    [[wants.service]]
    id = "com.amazon.media.server"
    
    [[wants.service]]
    id = "com.amazon.gipc.uuid.*"
    
    [[wants.service]]
    id = "com.amazon.media.playersession.service"
    
    [[wants.privilege]]
    id = "com.amazon.devconf.privilege.accessibility" # Required for captions
    
    [[wants.service]]
    id = "com.amazon.mediabuffer.service"
    
    [[wants.service]]
    id = "com.amazon.mediatransform.service"
    
    [[wants.service]]
    id = "com.amazon.audio.stream"
    
    [[wants.service]]
    id = "com.amazon.audio.control"
    
    [offers]
    [[offers.service]]
    id = "com.amazon.gipc.uuid.*"
    

To play systemd sounds, you must add the following audio management service name:

  • com.amazon.audio.system - for all AudioManager API clients

Add the following entries to the mainfest.toml file:

Copied to clipboard.

[[wants.service]]
id = "com.amazon.audio.system"

Last updated: Sep 30, 2025