Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Support full Bluetooth controll on Android #598

Open
MSchabel opened this issue Mar 30, 2024 · 4 comments
Open

[Feature Request] Support full Bluetooth controll on Android #598

MSchabel opened this issue Mar 30, 2024 · 4 comments
Assignees

Comments

@MSchabel
Copy link

MSchabel commented Mar 30, 2024

Describe the solution you'd like
When using the player on my android phone, the player only reacts to play/pause Bluetooth commands. E.g. skipping to the previous/next song is not supported. I would like to see this functionality added.

Additional context

  • I am using Firefox as a browser on my Android.
  • When I try controlling the player running in Firefox on a computer/Laptop, all Bluetooth commands work.

💡 Without being familiar with these topics, googling about this turned up this API: https://developer.mozilla.org/en-US/docs/Web/API/Media_Session_API. Maybe this is what needs to be adopted here?

Edit: Just realized you are already using the nexttrack and previoustrack API here, and according to this list they should work on Firefox Android. So not really sure what the issue is... 🤔

@Rello
Copy link
Owner

Rello commented Mar 31, 2024

Hello,
yes. thank you for referring to the code. I was just about to post the same. mediasessions were already implemented while back.
But are you sure that FF on Android is able to process any commands? does it continue playing more than one song?
Issue is, that Audio Player is a JS player. And mobile devices do not process JS when the screen is locked.

@Rello Rello self-assigned this Mar 31, 2024
@MSchabel
Copy link
Author

MSchabel commented Apr 3, 2024

On running FF in the background

Your question about FF being usable with locked screen surprised me a bit, since I already had listened full albums with locked screen. So I did some experimenting with different phones and this is what I found out:

  • Apparently you need to exclude Firefox from battery saving modes and then it stays alive/handles media session commands even with a locked screen. This already was the case for me on my main phone, so I did not encounter any issues there.

Firefox vs Chrome

Regarding the media session commands in Firefox it is still weird though. When I use your player with Firefox, then the media panel in the notification bar looks like this:
grafik
👉 not much information and the only Button available (which can be triggered via bluetooth input) is play/pause.

When I run it with Chrome, the panel looks like this:
grafik
👉 more infos, displaying the album cover, additional buttons to skip back/forth in the track list which also work via bluetooth

Thoughts on the discrepancy

Looking at this Media Session API compatibility table, it seems to me like what you implemented should already work though. There is just one remark saying Firefox exposes the API, but does not provide a corresponding user-facing media control interface., so maybe this is the issue... I will try to get some clarification on this from the Mozilla Community and update here.

@Rello
Copy link
Owner

Rello commented Apr 4, 2024

thank you for the ongoing input

@MSchabel
Copy link
Author

MSchabel commented Apr 7, 2024

@Rello I raised this with the Firefox Android team and it turned out that this is simply not fully implemented yet. Apparently they have an abandoned MR for it that they might pick up again.

So to my understanding your implementation would support this out of the box as soon as this is implemented on their side. Your call if you want to close this issue or leave it open as a reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants