mozilla / geckoview

GeckoView is a set of components for embedding Gecko in Android apps
https://geckoview.dev
412 stars 46 forks source link

How can i setup Notification Bar Music Control widget in Geckoview Android #187

Open ghost opened 2 years ago

ghost commented 2 years ago

How can I setup music player control widget in notification bar on Geckoview Android.

It is possible on chrome browser through Media Session Api

Below is the image from chrome browser android.

enter image description here

How can I achieve similar music control widget on Geckoview

jonalmeida commented 1 year ago

@itsmecom you want to implement the MediaSession.Delegate to add media support.

You can see some examples of how we implemented this feature in our applications with an abstraction in our Android Components here: https://github.com/mozilla-mobile/firefox-android/tree/main/android-components/components/feature/media. If you decide to take this route as well, we have a reference browser implementation that shows you what does integration look like in an application.

jonalmeida commented 1 year ago

The android media component mentioned above is the only example I can think of right now that implements the MediaSession.Delegate. You can still read the kotlin code and write it in Java where needed.