gnome-shell-extension-gsconnect icon indicating copy to clipboard operation
gnome-shell-extension-gsconnect copied to clipboard

Multimedia Control gives an additional "Unknown" media player

Open fhteagle opened this issue 4 years ago • 16 comments

With: Arch Linux (fully updated with yay -Syyu today) Gnome 3.36.2 GSConnect 38 installed from Gnome Extensions web portal panel

Paired device: OnePlus 7T running Android 10.0.8 KDE Connect App 1.14.2

Current Behavior: KDE Connect app's Multimedia control tab on my Android device has "Chrome", "Unknown", and "VLC Media Player". The Unknown instance in the list has the same track information as what the VLC program on the arch linux laptop is playing. However, pressing play, pause, stop, changing volume, etc on Unknown does not affect the playing VLC instance. What is additionally annoying is that Android KDE Connect app seems to think this "Unknown" instance should be the default, and so the persistent notification tries to affect that instance, not the VLC instance.

Desired Behavior: No phantom / Unknown player instances should be exposed,

Additional Info:

  • The Unknown instance seems to only show up when VLC program is actually opened (even if VLC is not playing media currently)
  • On a separate laptop, with arch linux (fully updated), enlightenment 0.23.1, current kdeconnect and indicator-kdeconnect packages, the "Unknown" instance is not exposed to the app. Seems to be peculiar to gnome/gsconnect.

Support Log

Please generate a support log (Instructions) and paste any messages related to this issue between the two ``` lines below.


GSConnect Version: 38
GSConnect Install: user
GJS: 16402
XDG_SESSION_TYPE: wayland
GDMSESSION: gnome
--------------------------------------------------------------------------------
-- Logs begin at Wed 2020-04-22 12:23:20 MDT, end at Mon 2020-05-25 12:54:56 MDT. --
-- No entries --

fhteagle avatar May 25 '20 19:05 fhteagle

Can you show some logs of GSConnect interacting with eg. VLC and notifications?

andyholmes avatar May 26 '20 02:05 andyholmes

@fhteagle By any chance, is there an Unknown entry showing up in the Notifications area of GNOME Shell, as well? Something like this?

Screenshot from 2020-05-26 00-50-18

That should be my MPD music server, which does in fact have a current artist and song status, but for some reason GNOME Shell in Fedora 32 is showing "Unknown". But that's the shell itself doing that, it's present even if I completely disable GSConnect. So I'm wondering if perhaps GSConnect is just mirroring some broken MPRIS endpoint from GNOME Shell to your phone.

ferdnyc avatar May 26 '20 04:05 ferdnyc

Is this bug still valid? If so can you provide the requested information?

andyholmes avatar Jul 20 '20 04:07 andyholmes

Closing due to lack of activity and requested information. Feel free to reopen if you can still reproduce and provide the requested information.

andyholmes avatar Aug 20 '20 06:08 andyholmes

Hi, sorry to post in an old issue, but I am seeing this.

I don't have VLC installed on this system (Ubuntu 21.10, GNOME 40.4)

I DO have mpd installed, but usually I use mpDris2 to enable MPRIS controls for mpd, this shouldn't change anything with GSConnect. When I turn off GSConnect, the "Unknown artist" notification disappears. Just by accident, I had connected to my VPN, and while connected, the spurious notification didn't show AT FIRST, but after a delay DID show, and would so immediately after I disconnected, so perhaps it has to do with mpd being detected over the network (by GSConnect or KDEconnect on the phone perhaps?)

Screenshot from 2022-01-21 10-19-41

Here is a support log i generated and uploaded during opening mpd and getting the spurious notiication to appear a few times, edit: redacted some private information (text/IM messages) from the log: gsconnect.log

I think I have isolated it and found a workaround.... If you disable controlling your phone's media playback from the computer (on the KDEConnect Android App, Plugin Settings, "Media Player Control" turn off, note that it is different than "Multimedia Controls" which deals with the phone controlling the computer's media), then turn off + on GSConnect.

I don't know if it was the computer trying to control the phone's media which was in turn trying to control the computer, I also noticed that I had a "Now Playing" notification on my phone which was blank, and tapping on it brings up the Google Podcasts app, so I uninstalled it since I don't use it. That might have been the solution as well, not entirely sure.

rdrms avatar Jan 21 '22 17:01 rdrms

The player with "Unknown title" and "Unknown artist" is a player called "Google" being reported by the remote device "gura".

In contrast, your local device is reporting something being played in a Brave web browser to the remote device "gura".

GSConnect doesn't seem to be doing anything wrong here though; it's displaying a player that the remote device "gura" is telling it to.

andyholmes avatar Jan 21 '22 20:01 andyholmes

I should have specified, "gura" is my Pixel 6. I don't know if the "Podcasts" app on the phone was creating the spurious media controls on the desktop, it also created one on the phone - I could swipe on my phone between controlling mpd on the desktop and a spurious one that opened the Podcasts app when tapped.

The YouTube notification on Brave works fine, as does mpd (on the computer) using mpDris2, both unrelated to GSConnect except for exporting them to the phone. But turning off having the desktop controlling the phones media through GSConnect in the KDEConnect app seems to have made it go away. Either that, or removing the Podcasts app from my phone made it go away. I turned "Media Control" back on and am not seeing any spurious media controls on GNOME, so I'm guessing it was some phone app making a media control that was unnecessary that GSConnect doesn't ignore?

rdrms avatar Jan 21 '22 22:01 rdrms

Well, GSConnect just exports MPRIS players for whatever the remote device tells it to. In this case, the "gura" device was telling it to export a player named "Google" with no artist or title data:

// Here is "gura" saying it has a media player called "Google"
Jan 21 10:31:54 org.gnome.Shell.Extensions.GSConnect[47826]: [/service/device.js:_readLoop:338]: gura: {
                                                               "id": 1642786315964,
                                                               "type": "kdeconnect.mpris",
                                                               "body": {
                                                                 "playerList": [
                                                                   "Google"
                                                                 ]
                                                               }
                                                             }

// Here is GSConnect requesting information about the player
Jan 21 10:31:54 org.gnome.Shell.Extensions.GSConnect[47826]: [/service/device.js:sendPacket:446]: gura: {
                                                               "id": 1642786314605,
                                                               "type": "kdeconnect.mpris.request",
                                                               "body": {
                                                                 "player": "Google",
                                                                 "requestNowPlaying": true,
                                                                 "requestVolume": true
                                                               }
                                                             }

// Here is the response
Jan 21 10:32:51 org.gnome.Shell.Extensions.GSConnect[47826]: [/service/device.js:_readLoop:338]: gura: {
                                                               "id": 1642786367548,
                                                               "type": "kdeconnect.mpris",
                                                               "body": {
                                                                 "player": "Google",
                                                                 "nowPlaying": "",
                                                                 "title": "",
                                                                 "artist": "",
                                                                 "album": "",
                                                                 "isPlaying": false,
                                                                 "pos": 0,
                                                                 "length": 0,
                                                                 "canPlay": true,
                                                                 "canPause": true,
                                                                 "canGoPrevious": false,
                                                                 "canGoNext": false,
                                                                 "canSeek": false,
                                                                 "volume": 96
                                                               }
                                                             }

I don't really know what player calls itself "Google", maybe some paused video clip in search results or something? If this were a media player being repeated back to the desktop it should still have track/artist information.

Either way, nothing that can be fixed in GSConnect I'm afraid. We just exports 'em how we sees 'em. :shrug:

andyholmes avatar Jan 21 '22 23:01 andyholmes

Yeah, I didn't see @ryanrms 's first post, but if I had I would've volunteered that I have KDE Connect explicitly excluded from the list of apps that get their notifications mirrored to my desktop, precisely to prevent feedback loops of the sort this appears to be. In my experience it's perfectly willing to create them under the right conditions.

In fact I have all apps that permit media control — all but a select few apps I want to be bothered by, really — excluded in my phone's Notification Sync plugin settings. I also keep the phone's Media Player Control plugin disabled, because I don't use the media players on my phone except when I'm mobile.

(In contrast, I couldn't live without the phone's Multimedia Controls plugin interfacing with GSConnect's Media Players sharing and MPRIS plugin, because a phone that acts as a remote control for my desktop media players is made of awesome.)

ferdnyc avatar Jan 22 '22 01:01 ferdnyc

I was just playing with a KDE neon VM and I think this issue might happen on KDEConnect desktop as well, but it is hidden since KDE only shows a single media player at a time in the Now Playing widget at a time with the other media players showed as tabs which are easy to ignore. An extra tab from "Google" will not be as distracting as an entry in a drop down list.

I was playing around with three (mobile) music players: Youtube Music Apple Music S2 (from Shuttle)

One Google assistant thing: Reuters TV (US)

KDE connect shows the Reuters with a label as such and it is not playing, and the source is "Google" - i.e. the Google app. When the "Google app" is forced to quit, the spurious notification (on GNOME listed as Unknown, on KDE shown as Reuters) instantly disappears. So perhaps blacklisting the Google App from the Now Playing thing or simply doing what I did and turning off desktop controls of mobile media would solve this.

But @andyholmes is right, this isn't an issue with GSConnect but rather is common at least with both KDEConnect Desktop and GSConnect. It's just that GNOME has a more prominent way of showing it (and displays less information).

rdrms avatar Jan 22 '22 01:01 rdrms

@andyholmes

Looking at those messages, the one thing GSConnect maybe could do is use the "player" field in place of the title and/or artist when those fields are sent blank, rather than "Unknown title" / "Unknown artist". Or maybe combine them ("Unknown artist — Google player"?) That'd give the user more information so they can work out where particular message is coming from, and make it clearer that GSConnect is acting on real information received from another device rather than just making stuff up.

ferdnyc avatar Jan 22 '22 01:01 ferdnyc

Hrm. Looking at the spec & code more, I'm not sure that'd really work. The fields in question are exported as track metadata for the current track, which an app name really... isn't. One could argue that if there is no metadata provided, substitutions are fair game, but I'm not sure I buy that argument myself.

The "Unknown ____" doesn't even come from GSConnect, it's the receiving end choosing to display that as a result of GSConnect not including xesam:artist or xesam:title metadata in the information it exports via its MPRIS interface.

*grumble*

ferdnyc avatar Jan 22 '22 01:01 ferdnyc

Looking at those messages, the one thing GSConnect maybe could do is use the "player" field in place of the title and/or artist when those fields are sent blank, rather than "Unknown title" / "Unknown artist".

We could probably do that. IIRC we do correctly set the Identity property on the org.mpris.MediaPlayer2 interface, so it's really GNOME Shell deciding not to display that string.

I usually prefer to avoid working around GNOME Shell's quirks, but if someone wants to figure out the logic there I don't really have a problem with it. I doubt anyone is using GSConnect outside of GNOME Shell after all.

andyholmes avatar Jan 22 '22 01:01 andyholmes

I see this issue too on Fedora 35 with the latest KDE Connect (1.19.1) on my Pixel 6 Pro and GSConnect 47, when playing media on my phone (with headphones).

I actually want to see the playing in the notification and want keyboard support on my laptop, so the suggestion of disabling "Media Player Control" in KDE Connect on my phone completely breaks my main use case of using KDE Connect + GSConnect to control audio (as I sometimes listen with speakers on my computer and other times listen with headphones connected to my phone, but always want to be able to consistently hit the pause and next track buttons on my keyboard regardless). I sometimes use the other features of notification syncing and file related stuff, but I mainly enjoy the remote control from one device on the other.

image

GSConnect: 47 (user)
GJS:       17000
Session:   wayland
OS:        Fedora Linux 35.20220207.0 (Silverblue)

Relevant extract from the logs: gsconnect-log-extract.txt

(I'm currently evaluating both Amazon Music Unlimited and Tidal with their free trials and seeing how they work on the phone and on the Linux desktop. FWIW: Tidal is better on the Linux desktop for what it's worth, as it works well in-browser and Amazon needs a Windows app (which works on Wine) for high quality streams. But anyway, that's why I have multiple media players showing up in the logs, in case you're wondering.)

Inline snippets from the log:

{
    "id" : 1644316763589,
    "type" : "kdeconnect.mpris",
    "body" : {
        "player" : "Google",
        "nowPlaying" : "",
        "title" : "",
        "artist" : "",
        "album" : "",
        "isPlaying" : false,
        "pos" : 0,
        "length" : 0,
        "canPlay" : true,
        "canPause" : true,
        "canGoPrevious" : false,
        "canGoNext" : false,
        "canSeek" : false,
        "volume" : 12
    }
}
{
    "id" : 1644316763596,
    "type" : "kdeconnect.mpris",
    "body" : {
        "player" : "Amazon Music",
        "nowPlaying" : "",
        "title" : "",
        "artist" : "",
        "album" : "",
        "isPlaying" : false,
        "pos" : 0,
        "length" : 0,
        "canPlay" : true,
        "canPause" : true,
        "canGoPrevious" : false,
        "canGoNext" : false,
        "canSeek" : false,
        "volume" : 12
    }
}
{
    "id" : 1644316763598,
    "type" : "kdeconnect.mpris",
    "body" : {
        "player" : "TIDAL",
        "nowPlaying" : "Kodomo - Concept 16",
        "title" : "Concept 16",
        "artist" : "Kodomo",
        "album" : "Still Life",
        "isPlaying" : true,
        "pos" : 442541,
        "length" : 635000,
        "canPlay" : true,
        "canPause" : true,
        "canGoPrevious" : true,
        "canGoNext" : true,
        "canSeek" : true,
        "volume" : 12
    }
}

I'm actively using Tidal at the moment and Amazon Music must be running in the background without playing. (Force closing it makes one of the ghost MPRIS notifications disappear.) Additionally, Google seems to be exposing something too. But neither are playing anything; Tidal is the only thing showing up on the phone and the only thing I care about. When Amazon is playing music, I get a proper notification, not the "Unknown title" & "Uknown artist".

If I play something in both apps (with one paused), both proper notifications show up with artist and title. However, neither are showing cover art and I don't know which is which aside from context of what's playing (which is usually OK, as I usually know what's playing and it's really almost always just one thing at a time. :wink:). In other words, even though Amazon was showing up with bogus info (when I wasn't using it), it does show up properly when being used and paused.

If I search for the "Google" app and force close it, that gets rid of one of the "Unkown" notifications.

If GSConnect would ignore media controls with "Unknown title" and "Unknown artist", it'd fix things for me and probably everyone else here. GSConnect could filter out things with, perhaps, some of these fields with these values:

  • nowPlaying: ""
  • title: ""
  • artist: ""
  • album: ""
  • length: 0
    • (I'm not sure what happens to length when there's a stream with an unknown length. It's worth checking.)

But this also definitely is a bug from a user's point of view and probably should be re-opened and addressed.

garrett avatar Feb 08 '22 11:02 garrett

I tested a stream of YouTube in Firefox and get this:

{
    "id" : 1644323910053,
    "type" : "kdeconnect.mpris",
    "body" : {
        "player" : "Firefox Nightly",
        "nowPlaying" : "https://m.youtube.com/watch?v=5qap5aO4i9A - lofi hip hop radio - beats to relax/study to - YouTube",
        "title" : "lofi hip hop radio - beats to relax/study to - YouTube",
        "artist" : "https://m.youtube.com/watch?v=5qap5aO4i9A",
        "album" : "",
        "isPlaying" : false,
        "pos" : -1,
        "length" : -1,
        "canPlay" : true,
        "canPause" : true,
        "canGoPrevious" : false,
        "canGoNext" : false,
        "canSeek" : false,
        "volume" : 16
    }
}

The YouTube app is a little different... it uses length 0 instead of -1, which means we can't depend on that:

{
    "id" : 1644324102797,
    "type" : "kdeconnect.mpris",
    "body" : {
        "player" : "YouTube",
        "nowPlaying" : "Lofi Girl - lofi hip hop radio - beats to sleep/chill to",
        "title" : "lofi hip hop radio - beats to sleep/chill to",
        "artist" : "Lofi Girl",
        "album" : "",
        "isPlaying" : true,
        "pos" : 0,
        "length" : 0,
        "canPlay" : true,
        "canPause" : true,
        "canGoPrevious" : false,
        "canGoNext" : true,
        "canSeek" : true,
        "volume" : 16
    }
}

However, isPlaying is true or false generally, and the unknowns have an empty string ("") as their isPlaying value.

So something like this would probably work:

// Do not show empty string MPRIS controls ("Unknown" title/artist bug on Android)
if (body.isPlaying !== "") {
  // show MPRIS controls
}

Or it could be something like:

if (body.title && body.artist) {
  // show MPRIS controls
}

But something like this should be sure to only catch this specific issue:

if (body.title && body.artist && body.isPlaying !== "") {
  // show MPRIS controls
}

garrett avatar Feb 08 '22 13:02 garrett

Thanks for the research, I'll re-open the bug.

andyholmes avatar Feb 08 '22 21:02 andyholmes