decodeInfo()from the W3C standard, recommended for apps using Shaka Player or other web-based players- Vega Graphics API, recommended for custom players that don’t use W3C APIs
Prerequisites
- Vega development environment set up
- React Native app running on Vega OS
- Fire TV Stick 4K Select for testing
@amazon-devices/react-native-w3cmediapackage installed (for thedecodeInfo()approach)
Define the decodeInfo() polyfill
If you use Shaka Player with Amazon’s patches, skip this step. The polyfill is already included.
For other players, define the polyfill for decodeInfo(). Reference the polyfill code in the media capabilities documentation.
In the Vega Sports Sample App, the build scripts place a file called W3CMediaPolyfill.ts under the <app-root>/w3media/polyfills/ folder. This file includes the implementation of decodeInfo().
Install the polyfill
After defining the polyfill in your app, install it so the app can access media capabilities. In the Vega Sports Sample App, the polyfill is installed during app initialization.Query resolution support with decodeInfo()
If you use Shaka Player or another W3C-based player that calls decodingInfo() directly, skip this step.
For custom player code, use decodeInfo() to check which resolutions the connected display supports. The following example demonstrates HD and Ultra High Definition (UHD) decoding support for Advanced Video Coding (AVC) streams.
decodingInfoImpl() returns configuration_4k as not supported, while it returns the lower resolution configuration as supported.
Use the Vega Graphics API as an alternative
The Vega Graphics API provides a way to retrieve information about the Fire TV device and its connected display, including height, width, and features such as High Dynamic Range (HDR). This approach works best for custom players that don’t use W3C APIs. The height value returned reflects the correct resolution for the combination of device and display:- HD TVs connected to the Fire TV Stick 4K Select return 1080
- 4K TVs connected to the Fire TV Stick 4K Select return 2160
Test the implementation
Build and run your app on a Fire TV device:- Connect the Fire TV Stick 4K Select to an HD (1080p) TV.
- Run your app and verify it requests HD streams only.
- Connect the Fire TV Stick 4K Select to a 4K TV.
- Run your app and verify it requests 4K streams.

