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

How can I setup music player 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?



Solution 1:[1]

You would have to implement MediaSession.Delegate and then set it on your session using GeckoSession.setMediaSessionDelegate.

The onMetadata method inside Delegate gives you an instance of MediaSession that you can use to respond to Android's media notification controls, e.g. to play the current media element you would just have to call mediaSession.play().

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Agi Sferro