Step 2: Integrate with MediaSession (VSK Fire TV)
Integrate your app with Android MediaSession to enable transport controls such as play, pause, rewind, and fast-forward.
The sample app uses the
PlaybackController
interface rather than Android MediaSession for transport controls. If you're exploring the sample app, you can skip this step.MediaSession Integration
Although the VSK supports playback controls (e.g., Play, Pause, Fast-forward, Rewind, etc.) through the PlaybackController
and SeekController
interfaces, Android MediaSession provides the same features with less latency and a more consistent customer experience. As a result, Android MediaSession is the preferred method for integrating playback control in your experience.
After you integrate MediaSession into your Fire TV app and add the appropriate permissions, your app will receive support for voice commands — both near-field and far-field voice commands. Near-field commands refer to speaking through the microphone on your remote (your voice is near the microphone), while far-field refers to speaking to an Alexa-enabled device paired with Fire TV, such as an Echo Dot on the far side of the room.
Follow the instruction in Voice-enabling Transport Controls with MediaSession API to integrate your app with Android Media Session.
Next Steps
Go to the next step: Step 3: Set Up the Sample App.