Giter Club home page Giter Club logo

Comments (12)

eonpatapon avatar eonpatapon commented on August 20, 2024

Hi,

I can't reproduce with 2.0.1-0-gf432547

Don't know how it can happen. You may install d-feet and check that there is only one 'org.mpris.MediaPlayer2.vlc' bus name.

from gnome-shell-extensions-mediaplayer.

DouglasMeyer avatar DouglasMeyer commented on August 20, 2024

Thanks for looking into this.

I'm seeing two entries org.mpris.MediaPlayer2.vlc and org.mpris.MediaPlayer2.vlc-14568. It looks like 144568 is the PID of the process.

Not sure if this is helpful, but I've gone through VLC's advanced settings and tried toggling things that looked like it had to do with notifications or "D-Bus control interface". I've also tried running cvlc from the command line. But I'm still seeing VLC listed twice.

from gnome-shell-extensions-mediaplayer.

eonpatapon avatar eonpatapon commented on August 20, 2024

Ah funny :)

Your vlc owns two bus for MPRIS and that is not normal, this why it is listed twice. Seems you've found a VLC bug ;)

from gnome-shell-extensions-mediaplayer.

grawity avatar grawity commented on August 20, 2024

It is actually part of the spec to claim multiple bus names, although VLC doesn't implement it correctly (despite the spec being written by VLC team...)

In the case where the media player allows multiple instances running simultaneously, each additional instance should request a unique bus name, adding a dot and a unique identifier to its usual bus name, such as one based on a UNIX process id. For example, this could be:

org.mpris.MediaPlayer2.vlc.instance7389

The extension could deal with this by comparing the owner PIDs, or if possible the "unique names" of the name owners. (There might be several processes queued up for the "main" ...MediaPlayer2.vlc name, however; this may need to be handled by the NameOwnerChanged signal.)

from gnome-shell-extensions-mediaplayer.

eonpatapon avatar eonpatapon commented on August 20, 2024

Yes but if I understand correctly Douglas is running only one instance of vlc so there should be only one bus name for the instance not two

from gnome-shell-extensions-mediaplayer.

grawity avatar grawity commented on August 20, 2024

No; a multi-instance program would claim both a "master" name (.vlc) and an "instance" name (.vlc.instance7389).

from gnome-shell-extensions-mediaplayer.

eonpatapon avatar eonpatapon commented on August 20, 2024

Hmm you're right

So I guess a bug must be open for VLC cause they should have .vlc and .vlc.instance14568 (not .vlc-14568)

And we should update the player detection code to handle multiple payer instances

from gnome-shell-extensions-mediaplayer.

grawity avatar grawity commented on August 20, 2024

Personally, I would go the simplest way – only show the "master" name, which usually corresponds to the first instance launched, and discard all "instance" names.

Proper multi-instance support could be implemented later, although I can't figure out a good way to detect duplicates... Either way, VLC needs to be fixed to use correct instance names.

from gnome-shell-extensions-mediaplayer.

eonpatapon avatar eonpatapon commented on August 20, 2024

Don't know in which order instances are discovered but if the master (vlc) is found first then the instance (vlc-14568) I would just try to see if any bus name already in the _players object matches the new instance. If yes, don't add the new instance

Could be done here in the addPlayer function https://github.com/eonpatapon/gnome-shell-extensions-mediaplayer/blob/master/src/extension.js#L633 I guess

from gnome-shell-extensions-mediaplayer.

grawity avatar grawity commented on August 20, 2024

That is the largest problem – the player can register its names in any order it wants, and if the master name is registered first, then the extension cannot immediately know whether a player supports multiple instances or not.

However, every DBus client also has "unique name" in the form of :id (e.g. :1.7); these would be very reliable for duplicate checks. I tried playing around with this in grawity/gnome-shell-extensions-mediaplayer@37b5529 and grawity/gnome-shell-extensions-mediaplayer@3b636c7 in the grawity/multi-instance branch – although I hadn't had a chance to test it.

(The current code uses the term "owner" for the player's well-known name, but the term actually means the unique name in DBus itself. This is going to cause some confusion, since the multi-instance additions deal with both names at once.)

from gnome-shell-extensions-mediaplayer.

eonpatapon avatar eonpatapon commented on August 20, 2024

Tried VLC version 2.1.0-git Rincewind (1.3.0-git-2431-g7f9b3ef) today

Seems the instances names are now correct (I got something like org.mpris.MediaPlayer2.vlc.instance12961) but when starting VLC the org.mpris.MediaPlayer2.vlc.instance12961 busname is taken before org.mpris.MediaPlayer2.vlc so my patch doesn't work at all ;)

If vlc is already started and then the extension is enabled the busname org.mpris.MediaPlayer2.vlc is discovered first

from gnome-shell-extensions-mediaplayer.

eonpatapon avatar eonpatapon commented on August 20, 2024

@grawity your branch + 03974e02 work fine with multiple vlc instances

from gnome-shell-extensions-mediaplayer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.