maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   Stopping music/media player when headset unplugged (https://talk.maemo.org/showthread.php?t=33215)

qwerty12 2010-07-16 20:44

Re: Stopping music/media player when headset unplugged
 
Quote:

Originally Posted by thp (Post 754262)
This might be possible - if the call state can be queried via D-Bus or if at least something like "call started" and "call ended" is sent as D-Bus signal.

Both are possible.

thp 2010-07-16 21:13

Re: Stopping music/media player when headset unplugged
 
Quote:

Originally Posted by qwerty12 (Post 754283)

Code:

#!/usr/bin/python

import dbus
import gtk
import sys

from dbus.mainloop.glib import DBusGMainLoop

DBusGMainLoop(set_as_default=True)

def callback(state, emergency_state):
    print 'new state is', state
    print '-'*30
    sys.stdout.flush()

bus = dbus.SystemBus()
bus.add_signal_receiver(callback, 'sig_call_state_ind', \
                        'com.nokia.mce.signal', None, \
                        '/com/nokia/mce/signal')

gtk.main()

PoC script to check for the call state (still has to be translated to C and integrated into headphone, with state tracking). I suppose we can enable this by default in headphoned without bad consequences?

qwerty12 2010-07-16 21:24

Re: Stopping music/media player when headset unplugged
 
Quote:

Originally Posted by thp (Post 754323)
PoC script to check for the call state (still has to be translated to C and integrated into headphone, with state tracking). I suppose we can enable this by default in headphoned without bad consequences?

Sounds good :)

Though the real test would be if the player pauses whilst Media Player is open - if it's closed, the state changing via libplayback is enough for the applet...

Shame you didn't use DBus-GLib, you could've taken the stuff from here instead of the nasty D-Bus signal rule you have to make (mind, I lose points on glib-genmarshal :\) :p

thp 2010-07-16 21:40

Re: Stopping music/media player when headset unplugged
 
Quote:

Originally Posted by qwerty12 (Post 754339)
Sounds good :)

Though the real test would be if the player pauses whilst Media Player is open - if it's closed, the state changing via libplayback is enough for the applet...

Shame you didn't use DBus-GLib, you could've taken the stuff from here instead of the nasty D-Bus signal rule you have to make (mind, I lose points on glib-genmarshal :\) :p

Well, I implemented it now with another rule. The patch is here locally, and I don't have access to my Maemo SDK VM, so I can't test it. If anybody wants to build it from source and try it out, I can send you the patch.

thp 2010-07-20 13:48

Re: Stopping music/media player when headset unplugged
 
Now that I have access to my SDK VM and the N900, I've fixed up the patch and merged it into the repository:

http://repo.or.cz/w/headphoned.git/c...ff/3077ae9b0fc

It works fine for me during testing with Skype's echo123 lady, and I assume it works also for incoming ("ringing") calls. It did not work when I sent the "pause" signal immediately when the call was disconnected, so I now send it 500ms after the call has been disconnected. It works reliable now for me, but you can hear ~ 400ms worth of your music between the time the call is disconnected and the time the signal is sent by headphoned and processed by the media player. Still better than pausing it manually in my opinion (although I can anticipate some bug reports complaining about this behaviour.. hehe).

This feature will be part of the upcoming headphoned release. Thanks for your valuable input, Surstroemming and Faheem :)

Milhouse 2010-07-20 14:08

Re: Stopping music/media player when headset unplugged
 
I loved headphoned but can't use it as it triggers the bug in the audio subsystem which disables system sounds (new text/email/IM notification etc.)... Does anyone know if there has been any progress on this bug or is it being ignored (seems so)?

It's a shame, as it's not headphoned's fault.

thp 2010-07-30 17:27

Re: Stopping music/media player when headset unplugged
 
headphoned 1.9 will soon be available in Extras-Testing. Please test and vote for it:

http://maemo.org/packages/view/headphoned/

jacktanner 2010-08-03 16:59

Re: Stopping music/media player when headset unplugged
 
A feature request - sorry if this is out of scope

It'd be nice if headphoned could detect an audio cable being plugged in, and then to run a user-configurable application, e.g., media player.

thp 2010-08-05 13:37

Re: Stopping music/media player when headset unplugged
 
Quote:

Originally Posted by jacktanner (Post 774489)
It'd be nice if headphoned could detect an audio cable being plugged in, and then to run a user-configurable application, e.g., media player.

Theoretically yes, although I believe that this belongs to a different application. If you send a patch with that feature (headphoned is open source and the repository is openly available for anyone to look), I might consider adding this.

jacktanner 2010-08-05 13:47

Re: Stopping music/media player when headset unplugged
 
If not headphoned, do you know of a different existing application where this would be a better fit?


All times are GMT. The time now is 00:59.

vBulletin® Version 3.8.8