Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I enabled vlc dbus interface:

Is there a way to control VLC from the Sound Menu?

VLC now appears in the sound menu and the controls work.

However, the keyboard shortcuts configured for the media player (System Settings -> Keyboard -> Shortcuts -> Sound and Media) for Play, "Next Track" and "previous track" aren't working. They work fine with banshee.

share|improve this question

2 Answers 2

up vote 0 down vote accepted

Your command in comments seems fine. Best way to set, if using compiz, is in ccsm > Commands. (you also need to have the dbus plugin enabled.

Then for command enter as commented dbus-send --type=method_call --print-reply --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause

Enable it to the media key in the key bindings as seen in screen, here it's run command 2, when going to the set 'key combo', I just used the media play/pause on keyboard, ie. no combo

enter image description here

share|improve this answer
    
Yes. That's an option. Doing so makes it vlc specific, while the system shortcuts don't. I mainly use vlc for audio, video. If I can't make the system shortcuts work, defining custom commands for vlc specific dbus methods is the next best thing. –  Rahul Kumar May 11 '12 at 14:32
    
When I run the command in shell, it says: Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.mpris.MediaPlayer2.vlc was not provided by any .service files What am I doing wrong? –  x-yuri Aug 1 at 14:12
    
Well, first I had to enable Interface > Control Interface > D-Bus control interface, then restart vlc, and now it works. I didn't enable dbus plugin if I understand you correctly. I'm talking about D-Bus (D-Bus Control Backend), the same kind of thing as Commands (Assigns bindings to arbitrary commands). I'm running vlc-2.0.8, if anything. –  x-yuri Aug 1 at 14:31

ASAIT, VLC cannot be bind to System Audio shortcuts like Rhythmbox or Banshee or Totem. It has its own HOTKEYS interface. The only way I found is the Playlist Hotkeys thing:

  • Press N for Next audio/video track
  • Press P for Previous audio/video track
  • Press SPACE to pause/play track
  • Press S to stop track.

Though, the VLC Window should be active in order for the hotkeys to be active too.

And D-BUS triggering:

Play/Pause Track command:

dbus-send --type=method_call --print-reply --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause

Stop Playing command:

dbus-send --type=method_call --print-reply --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Stop

Next Track command:

dbus-send --type=method_call --print-reply --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next

Previous Track command:

dbus-send --type=method_call --print-reply --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous

VlC Dbus commands added as shorcuts in Unity launcher for VLC entry (using Ubuntu Tweak

sudo add-apt-repository ppa:tualatrix/next
sudo apt-get update
sudo apt-get install ubuntu-tweak

)

VLC Custom Shortcuts in Unity Launcher

VLC Hotkeys

VLC Hotkeys

If you try to bind the Multimedia Bios/System keyboard keys to VLC you'd get either a conflict or the latter would be overwritten/lost. That's my case. For the time being, spot some free keyboard shortcuts and bind them to vlc mpris/vlc methods.

share|improve this answer
    
I know about vlc keybindings. I am interested in system keybindings to control vlc. I am still looking into it, so I am not sure either. But considering that banshee is controlled using the dbus interface, and vlc can be controlled using dbus, I think it should be doable and I am missing something. dbus-send --type=method_call --print-reply --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause –  Rahul Kumar May 11 '12 at 8:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.