The Google Assistant is available on all phones, speakers, Android TV and more.
And it can help users to do more throughout their day – where they need to add
something to a list of things to do, turn on the lights, or play a song.

With music in particular, the assistant has a lot to offer. He can understand
multimedia controls on devices (“play rock music”) and supports multimedia controls
(like to pause, jump, fast forward, thumbs up). And users can also control Android
multimedia playback via the Google Assistant. For example, you can pause reading
by asking the Google Assistant to “pause the reading” without lifting a finger. Or
play music saying “play rock on Universal Music Player”.

For the user to control playback in your Android Media application via the
Google Assistant, you can use the MediaSession
API to get there. We recommend using MediaSession on the intentions as
you create the integration of your application with the Google Assistant.

How to use MediaSession in your application?

Your application must implement a MediaSession session that handles a prescribed set of actions
as described in Interacting
with the Google assistant .

Here are some examples of projects that can help you get started using MediaSession
in your multimedia applications:

MediaBrowserService
sample
Universal
Sample of music player
Assistant
Integration with the Leanback Sample

To learn more about MediaSession, here are some good resources:

Comprehension
MediaSession
Working
with a MediaSession session
Video
Reading with the Google Assistant on Android TV

How does the Google Assistant use MediaSession?

The Google assistant uses MediaSession in the same way as the others
controllers like Android Wear do. Each of these controllers causes a state
changes in your application, and there must be a way to respond to these
changes. That’s where MediaSession comes in.

By using MediaSession, the Google Assistant can control the media in your application
reading, as well as stay synchronized with its current state.

How to test my application with MediaSession?

Once you implement MediaSession, you will probably want to test how reading can
be controlled outside of your application. The Media
The Controller Test Tool was created to emulate the external control of your media
reading. You can check that when other applications (like the Google Assistant) interact
with your application, it works as expected.

Posted by Nazmul Idris, Android Devices and Media Developer Advocate

The Google Assistant is available on all phones, speakers, Android TV and more.
And it can help users to do more throughout their day – where they need to add
something to a list of things to do, turn on the lights, or play a song.

With music in particular, the assistant has a lot to offer. He can understand
multimedia controls on devices (“play rock music”) and supports multimedia controls
(like to pause, jump, fast forward, thumbs up). And users can also control Android
multimedia playback via the Google Assistant. For example, you can pause reading
by asking the Google Assistant to “pause the reading” without lifting a finger. Or
play music saying “play rock on Universal Music Player”.

For the user to control playback in your Android Media application via the
Google Assistant, you can use the MediaSession
API to get there. We recommend using MediaSession on the intentions as
you create the integration of your application with the Google Assistant.

How to use MediaSession in your application?

Your application must implement a MediaSession session that handles a prescribed set of actions
as described in Interacting
with the Google assistant .

Here are some examples of projects that can help you get started using MediaSession
in your multimedia applications:

MediaBrowserService
sample
Universal
Sample of music player
Assistant
Integration with the Leanback Sample

To learn more about MediaSession, here are some good resources:

Comprehension
MediaSession
Working
with a MediaSession session
Video
Reading with the Google Assistant on Android TV

How does the Google Assistant use MediaSession?

The Google assistant uses MediaSession in the same way as the others
controllers like Android Wear do. Each of these controllers causes a state
changes in your application, and there must be a way to respond to these
changes. That’s where MediaSession comes in.

By using MediaSession, the Google Assistant can control the media in your application
reading, as well as stay synchronized with its current state.

How to test my application with MediaSession?

Once you implement MediaSession, you will probably want to test how reading can
be controlled outside of your application. The Media
The Controller Test Tool was created to emulate the external control of your media
reading. You can check that when other applications (like the Google Assistant) interact
with your application, it works as expected.



Source link

LEAVE A REPLY

Please enter your comment!
Please enter your name here