Bug 460771 - Media player: share data with a global singleton
Summary: Media player: share data with a global singleton
Status: CONFIRMED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Media Player (show other bugs)
Version: 5.26.0
Platform: Other Linux
: NOR task
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks: 469085
  Show dependency treegraph
 
Reported: 2022-10-20 16:23 UTC by Riccardo Robecchi
Modified: 2023-04-28 13:52 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Riccardo Robecchi 2022-10-20 16:23:24 UTC
SUMMARY
This may be related to bug 455046 or bug 451393, but I think it is different enough to be its own distinct thing. Before the update to Plasma 5.26.0, selecting a media player in the widget would keep it selected as long as the application was open. After 5.26.0, pausing playback means that the selection is not respected any more and other media players can become the active ones.
To give a practical example, if I am listening to music with Strawberry and pause it, and then I watch a video on YouTube using Firefox, the media player widget will show Firefox as the active application, so I can no longer control Strawberry even if I had manually selected it earlier.

STEPS TO REPRODUCE
1. Select a media player manually in the widget and use it to play media content
2. Pause playback
3. Start playback of media content with another application

OBSERVED RESULT
The other application hijacks control and is the one that actually receives commands e.g. from media keys.

EXPECTED RESULT
The selected application stays selected so that it received input e.g. from media keys.

SOFTWARE/OS VERSIONS
Linux: KDE neon
KDE Plasma Version: 5.26.0
KDE Frameworks Version: 5.98.0
Qt Version: 5.15.6

ADDITIONAL INFORMATION
Comment 1 Nate Graham 2022-10-20 20:02:49 UTC
I think I can reproduce this. When I manually set the media player to Elisa and then play a YouTube video in Firefox, the global play/pause shortcuts target Firefox, not Elisa. However the widget still shows Elisa.
Comment 2 Riccardo Robecchi 2022-10-20 21:08:27 UTC
(In reply to Nate Graham from comment #1)
> I think I can reproduce this. When I manually set the media player to Elisa
> and then play a YouTube video in Firefox, the global play/pause shortcuts
> target Firefox, not Elisa. However the widget still shows Elisa.

In my case, the widget shows Firefox as the active application, which is why I had set the title to be more general (and why I am reverting it back to the original).
Comment 3 Fushan Wen 2022-10-21 11:18:24 UTC
There was no real change in mpris2 https://invent.kde.org/plasma/plasma-workspace/-/commits/master/dataengines/mpris2

And I remember the mediacontroller will always switch to the current active player regardless of the previous selection, so I think this is a feature request?
Comment 4 Riccardo Robecchi 2022-10-21 11:48:49 UTC
(In reply to Fushan Wen from comment #3)
> There was no real change in mpris2
> https://invent.kde.org/plasma/plasma-workspace/-/commits/master/dataengines/
> mpris2
> 
> And I remember the mediacontroller will always switch to the current active
> player regardless of the previous selection, so I think this is a feature
> request?

I don't know if this is related to mpris2 so I trust you on that, but in previous Plasma versions I used to select a player and it would remain the active one until I selected another one. I am sure of this as I used to use this feature daily, which is why I noticed the regression.
Comment 5 Riccardo Robecchi 2023-02-19 21:59:16 UTC
With 5.27, the widget shows the selected media player, but media keys ignore that. As an example (formatting as a list for better readability): 
- I listen to music using Strawberry and pause it
- then watch a video on YouTube with Firefox and pause it
- then click on the Media Player widget and select Strawberry as the active player
- then use media keys to resume playback with Strawberry
the YouTube video is the one that actually receives the input. The only way for Strawberry to be controlled again through media keys is to resume playback manually (either from the program itself or using the button in the widget) so that it becomes the active media player again.
Comment 6 Fushan Wen 2023-02-20 16:01:01 UTC
Don't have media keys but I seem to know the cause. Will look into it.
Comment 7 Fushan Wen 2023-02-20 17:06:42 UTC
Unfortunately it's not easily fixable. There can be more than one media controller widget, so the global media shortcuts can only operate on the default media player, otherwise the logic will be confusing.
Comment 8 Riccardo Robecchi 2023-02-21 15:24:57 UTC
(In reply to Fushan Wen from comment #7)
> Unfortunately it's not easily fixable. There can be more than one media
> controller widget, so the global media shortcuts can only operate on the
> default media player, otherwise the logic will be confusing.

The "easy" solution would then be to synchronise the user's selection across the widgets, but I guess that is not technically easy to implement.
Comment 9 Nate Graham 2023-02-21 20:49:38 UTC

*** This bug has been marked as a duplicate of bug 409190 ***