MPRIS support for multiple media players
Categories
(Core :: Audio/Video: Playback, enhancement, P3)
Tracking
()
People
(Reporter: necauqua, Assigned: razzeee+mozilla)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 4 obsolete files)
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0
Steps to reproduce:
Open two YouTube videos in separate tabs etc.
Actual results:
One of them can be controlled via MPRIS interface, usually the latest one that had its state changed or from the latest focused tab, exact conditions are unknown, but it looks spotty.
Expected results:
Each media source should get a separate MPRIS object so that separate playbacks can be controlled independently.
Comment 1•4 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Audio/Video: Playback' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.
| Assignee | ||
Comment 2•2 years ago
|
||
From reading the MPRIS spec (https://specifications.freedesktop.org/mpris-spec/latest/) , looking at the d-bus behavior and the code, as far as I can tell, it "just" needs to open new d-dbus connections per active tab.
So widget/gtk/MPRISServiceHandler.cpp needs a change to the two times SprintfLiteral(serviceName, DBUS_MPRIS_SERVICE_NAME ".instance%d", getpid()); is used. I would append the id of the tab that's sending that audio.
I would guess a tabId would be best, but I have no idea of firefox internals. I also can't see a straight forward way to get that in that file, but I haven't done cpp in a few years.
| Assignee | ||
Comment 3•2 years ago
|
||
Having looked a bit more at the structure, it might not be as simple, as I think the MPRISServiceHandler is depending on the media control buttons - which probably only can handle one instance.
| Assignee | ||
Comment 4•3 months ago
|
||
| Assignee | ||
Comment 5•3 months ago
|
||
| Assignee | ||
Updated•3 months ago
|
Updated•3 months ago
|
Updated•3 months ago
|
Updated•3 months ago
|
Updated•3 months ago
|
Updated•3 months ago
|
Comment 6•3 months ago
|
||
Hi Kolja,
Thank you for your patch! I’ve taken a quick look at your changes and would like to ask a few questions first:
-
Since different Linux distributions can use D-Bus connections to create virtual interfaces, I think controlling it via a virtual control button is fine. However, when there are multiple D-Bus connections, which connections will be controlled when pressing a physical control key (e.g., keyboard, Bluetooth headset)? Have you tested different scenarios yet? We’ll likely need new tests as well if we plan to support this.
-
Do any other browsers currently support multiple D-Bus connections?
-
Have you run the automated tests yet? We need to ensure that adding a new feature doesn’t break existing functionality. You can use
mach try fuzzy --preset media-fullto run media related tests. In order to push to try, you need to ensure you have the level 1 access. -
I still need to think carefully about supporting multiple control interfaces, especially since Firefox is a cross-platform application. We’d like the behavior to be consistent across platforms as much as possible.
I’ll provide more detailed feedback next week — I’m attending a conference this week, so I don’t have much time to dive deeply into this right now. Thanks!
Updated•3 months ago
|
| Assignee | ||
Comment 7•3 months ago
|
||
(In reply to Alastor Wu [:alwu] from comment #6)
Hi Kolja,
Thank you for your patch! I’ve taken a quick look at your changes and would like to ask a few questions first:
Since different Linux distributions can use D-Bus connections to create virtual interfaces, I think controlling it via a virtual control button is fine. However, when there are multiple D-Bus connections, which connections will be controlled when pressing a physical control key (e.g., keyboard, Bluetooth headset)? Have you tested different scenarios yet? We’ll likely need new tests as well if we plan to support this.
Do any other browsers currently support multiple D-Bus connections?
Have you run the automated tests yet? We need to ensure that adding a new feature doesn’t break existing functionality. You can use
mach try fuzzy --preset media-fullto run media related tests. In order to push to try, you need to ensure you have the level 1 access.I still need to think carefully about supporting multiple control interfaces, especially since Firefox is a cross-platform application. We’d like the behavior to be consistent across platforms as much as possible.
I’ll provide more detailed feedback next week — I’m attending a conference this week, so I don’t have much time to dive deeply into this right now. Thanks!
Hey,
thanks for checking in and the questions:
- I've only tested this via media keys on my laptop. And it seems to control the first one, that started playback and even keep that tab in focus, when playback is stopped, but there is more to play, so that you can resume.
I'm a little bit unsure, if that's the behavior we want - I've looked a bit at the focus following you and basically sticking with the last media tab you've opened, but haven't figured that out.
-
I'm not aware of a browser doing that. It's clearly supported from the POV of the mpris docs https://specifications.freedesktop.org/mpris/latest/#Bus-Name-Policy - those only leave to question, what their definition of an instance is.
-
I haven't. But I can hopefully spend some time on that.
-
Understandable, but at least to me (and some other users), this behavior has been pretty annoying. E.g. having google music open listening to music, then you find a youtube video and by mistake start it before stopping the music. Now you need to find the music tab, and can't stop it from the mpris dialogue.
Cheers
Comment 8•3 months ago
|
||
Understandable, but at least to me (and some other users), this behavior has been pretty annoying. E.g. having google music open listening to music, then you find a youtube video and by mistake start it before stopping the music. Now you need to find the music tab, and can't stop it from the mpris dialogue.
For this scenario, you could try to enable the pref media.audioFocus.management which will help you automatically pause music tab when you start the youtube video. That pref is about enabling the audio competing so that only one audio tab can be played at a time, it's currently enabled on Android only.
| Assignee | ||
Comment 9•3 months ago
|
||
| Assignee | ||
Comment 10•3 months ago
|
||
| Assignee | ||
Comment 11•3 months ago
|
||
Updated•3 months ago
|
Updated•3 months ago
|
Updated•3 months ago
|
Comment 13•2 months ago
|
||
I have made a plugin for firefox for this
Soundtabs it is pending approval. Should help bridge some of this gap.
Updated•2 months ago
|
Comment 14•2 months ago
|
||
Sorry had to reupload, also wanted to make the name more easy to find (less crowded)
Media Bridge
Description
•