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
In this article, you’ll implement an engaging toast notification system that alerts users to available content and allows them to hold the play/pause button to start streaming directly. This solution demonstrates how to modify the Vega Video Sample App with a TV-optimized interactive toast that promotes in-app content discovery without disrupting the viewing experience.

Prerequisites

Install the required dependency

Add the toast message library to your project.

Create the custom toast component

Create a new file for the TV-optimized toast component that displays a progress bar during user interaction. Create src/components/ProgressToast.tsx with the following implementation.
This component creates a rectangular toast positioned on the right side of the screen with real-time progress feedback. The progress bar changes from blue to green when the user actively holds the button.

Create the long press hook

Create a custom hook that manages the complete lifecycle of play/pause button interactions and toast visibility. Create src/hooks/useLongPressToast.tsx with the following implementation.
This hook manages automatic toast display timing, smooth progress animations, completion detection with callbacks, and proper cleanup of all timers and intervals using Vega’s TVEventHandler.

Register the toast component

Update your main App component to register the custom toast configuration. Add the following imports to src/App.tsx.
Add the Toast component inside your App return statement.

Integrate the toast in your screen

To add the long press toast hook to your HomeScreen component with screen focus tracking, add the following imports to src/screens/HomeScreen.tsx.
Add the hook inside your HomeScreen component.
The isScreenFocused parameter makes sure the toast only appears when the HomeScreen is visible, preventing it from showing on other screens.

Test the implementation

Build and run your app on a Fire TV device or emulator:
  1. Navigate to the Home Screen.
  2. Wait five seconds for the toast to appear automatically.
  3. Press and hold the play/pause button on your remote.
  4. Observe the progress bar filling over two seconds.
  5. Release early to cancel, or hold for the full duration to trigger navigation.

Last modified on March 10, 2026