Create VideoPlaybackScreen
The next functionality that we want to add to the app, is the ability to launch a video player. For this tutorial, you’ll create a dedicated VideoPlaybackScreen that can host your preferred video player component. We recommend using the W3C Media API for its cross-platform compatibility and standardized interface, though you’re free to integrate any supported player that meets your requirements.- Create a new file called
VideoPlaybackScreen.tsxin thescreensfolder.
- Open the
VideoPlaybackScreen.tsxand add our import statements for React, View, and StyleSheet from ‘react-native’, and the Vega VideoPlayer component.
- Create the VideoPlaybackScreen component which returns a placeholder text element wrapped in a View.
- Export the VideoPlaybackScreen.
- Create a StyleSheet called
stylesafter the VideoPlaybackScreen arrow function. - Add a style called
playerContainerandplayerPlaceholderand assign the style props to theViewandTextresectively.
Exiting the VideoPlaybackScreen
We need to provide a way to get back to the LandingScreen from the VideoPlaybackScreen. In reality, a customer will be able to use the “back” button on their remote to go back (or go “up” on the D-Pad and then choose to go back). However for now, we will create a basic “Back” button on-screen.- Add a View that contains a Button called “Back”
- Set the Button’s
onPressprop to be an arrow function that callsnavigation.goBack().
- Give the View a style prop of
buttonContainer - Add the
buttonContainerto the StyleSheet with the following values:
Export VideoPlaybackScreen
- Dont forget to export the VideoPlaybackScreen in the index.ts
VideoPlaybackScreen.tsx code should look like this:

