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)

thp 2010-02-05 10:33

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

Originally Posted by DaSilva (Post 511539)
I had a strange issue a few days ago but I don't know if it is related to headphoned: I unplugged my headset while playing music, the music stopped as expected. After a few days and a few restarts I plugged in my headset again and it began to play from the last active source in the default media player which was not what I wanted (maybe this behaviour could be useful for a short time after unplugging but not after a few days + restarts).
Can it be related to headphoned?

headphoned sends a "pause" signal via D-Bus to the default media player (and some others, if available). At least in my tests when the media player was running, sending a "pause" signal twice does not result in pause/unpause, but rather pause/pause (meaning that the signal does not seem to "toggle" the pause state).

This would suggest that a behaviour like this cannot come from headphoned. Feel free to try to reproduce this bug (basically by restarting your device, waiting until everything has loaded and then plugging in the headphones - the Media Player widget on your desktop might help check out the situation). If you can reliably reproduce this bug, try uninstalling headphoned and see if it still happens.

ruskie 2010-02-05 10:38

Re: Stopping music/media player when headset unplugged
 
Hmm is it possible to launch an arbitrary command nstiead of sending a pause signal on dbus?

Reason is I ues xmms2 and that has a simple xmms2 togglepause command. No messing about with dbus and stuff.

thp 2010-02-05 11:14

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

Originally Posted by ruskie (Post 511608)
Reason is I ues xmms2 and that has a simple xmms2 togglepause command. No messing about with dbus and stuff.

Sure. We do this already for MPlayer using a named pipe (gitweb link). Ideally, the player should have a simple "pause" and not a "togglepause" signal, otherwise playback would start if it's paused and you unplug your headphones.

What I can offer is a directory like /etc/headphoned.d/ where other packages can install scripts that are executed when the headphones are unplugged. Would this be a workable solution for you?

neboja 2010-02-05 11:46

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

Originally Posted by ruskie (Post 511608)
Hmm is it possible to launch an arbitrary command nstiead of sending a pause signal on dbus?

Reason is I ues xmms2 and that has a simple xmms2 togglepause command. No messing about with dbus and stuff.

PLEASE: from where can i download xmms???????????
ar could you give me the link to the deb... thx!

thp 2010-02-05 12:03

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

Originally Posted by neboja (Post 511689)
PLEASE: from where can i download xmms???????????
ar could you give me the link to the deb... thx!

http://lmgtfy.com/?q=maemo+xmms

neboja 2010-02-05 12:07

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

ruskie 2010-02-05 12:12

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

Originally Posted by neboja (Post 511689)
PLEASE: from where can i download xmms???????????
ar could you give me the link to the deb... thx!

See my signature :) IT's not like it's hidden... and note this isn't xmms but XMMS2

ruskie 2010-02-05 12:13

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

Originally Posted by thp (Post 511648)
Sure. We do this already for MPlayer using a named pipe (gitweb link). Ideally, the player should have a simple "pause" and not a "togglepause" signal, otherwise playback would start if it's paused and you unplug your headphones.

What I can offer is a directory like /etc/headphoned.d/ where other packages can install scripts that are executed when the headphones are unplugged. Would this be a workable solution for you?


Yes it has a simple pause as well. And yes the solution would be more than workable. Probably the best all around.

thp 2010-02-05 12:14

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

Originally Posted by neboja (Post 511725)
:confused:

See that search box in the upper right corner? Typing "xmms" there will quickly reveal the "xmms now available" and "XMMS for N900?" threads. Even if you don't see the box, googling for "xmms maemo" will quickly yield results.

Please don't waste other people's time by being too lazy to search for things. And if you don't find something, just create another thread. Thanks :) (Please don't feel offended by this post, I'm just trying to help.)

neboja 2010-02-05 12:44

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

Originally Posted by thp (Post 511732)
See that search box in the upper right corner? Typing "xmms" there will quickly reveal the "xmms now available" and "XMMS for N900?" threads. Even if you don't see the box, googling for "xmms maemo" will quickly yield results.

Please don't waste other people's time by being too lazy to search for things. And if you don't find something, just create another thread. Thanks :) (Please don't feel offended by this post, I'm just trying to help.)

i have been searchig... but to dumb to realise where and how to install.... but anyhow, i will figure it out ! ;)

mike2k4 2010-02-05 14:23

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

Originally Posted by thp (Post 511599)
headphoned sends a "pause" signal via D-Bus to the default media player (and some others, if available). At least in my tests when the media player was running, sending a "pause" signal twice does not result in pause/unpause, but rather pause/pause (meaning that the signal does not seem to "toggle" the pause state).

This would suggest that a behaviour like this cannot come from headphoned. Feel free to try to reproduce this bug (basically by restarting your device, waiting until everything has loaded and then plugging in the headphones - the Media Player widget on your desktop might help check out the situation). If you can reliably reproduce this bug, try uninstalling headphoned and see if it still happens.

I can confirm that this issue has occurred long before I installed headphoned.

oldpmaguy 2010-02-05 14:27

Re: Stopping music/media player when headset unplugged
 
Has this app stopped being updated in relation to other media players? Because it hasn't been working lately, and all I've done differently is installed a few new media players/updated older ones. Thanks for the info.

Milhouse 2010-02-17 14:58

Re: Stopping music/media player when headset unplugged
 
I've noticed a problem when using headphoned - the tones for incoming SMS and email messages are no longer played when the headphones are removed and the media player is paused...

I've had this with headphoned 1.5 and 1.6 on 2.2009-51-1 and there is no change to this behaviour with 3.2010.02-8.

When a call is received the ringtone plays as expected, it's just SMS and email tones that are muted, and it's only been this way since installing headphoned. I wonder if there is some sort of priority within the sound system (SMS/Email being at a priority different to ringtones) and headphoned is somehow interfering with this?

thp 2010-02-17 15:03

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

Originally Posted by Milhouse (Post 532274)
When a call is received the ringtone plays as expected, it's just SMS and email tones that are muted, and it's only been this way since installing headphoned. I wonder if there is some sort of priority within the sound system (SMS/Email being at a priority different to ringtones) and headphoned is somehow interfering with this?

This is highly unlikely. headphoned does nothing more than sending a "pause" signal to the list of known media players. See the source code if you want be sure :)

Milhouse 2010-02-17 16:15

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

Originally Posted by thp (Post 532283)
This is highly unlikely. headphoned does nothing more than sending a "pause" signal to the list of known media players. See the source code if you want be sure :)

I'm not suggesting it's a bug in the headphoned code - there are so many problems with the N900's behaviour with respect to audio routing that I'd put money on the problem residing within the N900 firmware, and it's a problem that is being triggered inadvertently by headphoned.

Unfortunately I haven't had the time to nail down a reproducible test case but hopefully I can do that this weekend, just wondered ahead of time if anyone had noticed anything similar. As I say it's only been a noticeable problem since the installation of headphoned, the functionality of which I absolutely love btw (thanks!)

I'll update this thread with more details, or can headphoned be added to b.m.o.?

rash.m2k 2010-02-17 16:35

Re: Stopping music/media player when headset unplugged
 
It's not muted - you can't hear it too well because of the music.

There's also the problem that if you received a phone call and you then remove the headphones the media player is not paused! Which can be embarassing at times!

Milhouse 2010-02-17 16:41

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

Originally Posted by rash.m2k (Post 532495)
It's not muted - you can't hear it too well because of the music.

Not sure what you're referring to - the lack of SMS/Email tones happens when the media player is either paused or not even active so no music playing. I do hear the new email tone when music is playing and I'm listening on headphones, though the tone is very quiet. It's when I'm not listening to music and headphones removed that I don't hear the tones... why I'm not entirely sure. :)


Quote:

Originally Posted by rash.m2k (Post 532495)
There's also the problem that if you received a phone call and you then remove the headphones the media player is not paused! Which can be embarassing at times!

Yeah, would be nice if that could be fixed but probably requires changes outside of headphoned. The N900 should only restart the media player at the end of a call if the media player was actually playing something when the call was answered (and not just when the call was received).

tjjalava 2010-03-11 18:01

Re: Stopping music/media player when headset unplugged
 
I can confirm the muted SMS/Email tones after unplugging the headphones. Receiving SMS after unplugging only causes the phone to vibrate and sound a little beep, the same I would hear if I still had the headphones plugged in. If I pause the media player before unplugging, the SMS/Email tones work as they should.

Otherwise great app, it has saved me from many embarrasing situations when I accidentially unplug the headphones. But this problem forces me to remember to manually pause the player when I finish listening.. :(

Milhouse 2010-03-11 18:55

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

Originally Posted by tjjalava (Post 564097)
I can confirm the muted SMS/Email tones after unplugging the headphones. Receiving SMS after unplugging only causes the phone to vibrate and sound a little beep, the same I would hear if I still had the headphones plugged in. If I pause the media player before unplugging, the SMS/Email tones work as they should.

Otherwise great app, it has saved me from many embarrasing situations when I accidentially unplug the headphones. But this problem forces me to remember to manually pause the player when I finish listening.. :(

Thanks for confirming I'm not going mad! :) Unfortunately I've been too busy these last few weeks to sit down and diagnose this further. :(

Typically I just pull the headphones out of the device as I walk into work - which automagically pauses the media player but leaves it running - and from that point onwards I get no SMS/Email tones, just vibrations.

I'll try pausing it before unplugging next time to see if that makes a difference for me too.

Milhouse 2010-03-11 20:06

Re: Stopping music/media player when headset unplugged
 
OK, pretty much confirmed this and it's as tjjalava says: hit pause before unplugging the headphones and SMS/Email tones work correctly, but pull the headphones out of the device while the media player is playing audio and you then get no SMS/EMail tones.

Firmware 3.2010.02-8 and headphoned 1.7.

Anyone else able to reproduce? If so I'm happy to file a bug (though against what I'm not exactly sure - headphoned or the audio subsystem?)

thp 2010-03-12 12:26

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

Originally Posted by Milhouse (Post 564248)
Anyone else able to reproduce? If so I'm happy to file a bug (though against what I'm not exactly sure - headphoned or the audio subsystem?)

Audio subsystem. All headphoned does is send the "pause" signal to the media player ;) If that results in the bug, then it's a bug in MAFW or the audio policy.

Milhouse 2010-03-14 19:10

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

Originally Posted by thp (Post 564975)
Audio subsystem. All headphoned does is send the "pause" signal to the media player ;) If that results in the bug, then it's a bug in MAFW or the audio policy.

Were you able to reproduce? I wonder if MAFW does more than just pause when the button is pressed (ie. the UI does something more than the equivalent dbus event).

If you (or anyone else other than me and tjjalava can reproduce) I'll open a bug against MAFW in b.m.o. Would also be nice if you could get headphoned in b.m.o. too! :)

qwerty12 2010-03-16 11:13

Re: Stopping music/media player when headset unplugged
 
I've managed to get it to not play music again if you take out the headset during a call but only if the Media Player application is not running - i.e. you just have the applet running. I've got what the applet does to pause the track sorted, but not what the Media Player application does itself to pause the track.

I'd like to figure out what the Media Player app does but if worst comes to worst (e.g. an internal setting which I cannot modify from the outside) , "killall -9 mediaplayer" springs to mind...

My current improvement over having it not play tracks again upon the ending of a call if the headphones are taken out during a call (provided the Media Player application is not running) requires headphoned to be added to the policy file. If I get it set up correctly (support for dpkg's triggers come to mind), would you be interested, thp?

thp 2010-03-16 11:35

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

Originally Posted by qwerty12 (Post 568984)
If I get it set up correctly (support for dpkg's triggers come to mind), would you be interested, thp?

Yep, sure :)

qwerty12 2010-03-16 15:13

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

Originally Posted by thp (Post 569005)
Yep, sure :)

http://slexy.org/view/s2T84KR5Mc

Still not perfect, but at least it's less likely to start randomly blasting tracks... I'm not sure on whether to classify headphoned as a "player" or just leave it as "alwayson". Oh, and sorry for adding profanity to headphoned.c (although, if you look at the output of apt-cache rdepends libplayback-1-0, you'll see an application from the Ovi Store has been linked against it so Nokia don't mind giving support in certain circumstances it seems...)... :)

I'll try and look into the Media Player application itself after I've finished strangling Vala :)

debian/triggers:
Code:

interest /usr/share/policy/etc/rx51/pulse

Morphic 2010-03-17 14:21

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

Originally Posted by Milhouse (Post 564248)
OK, pretty much confirmed this and it's as tjjalava says: hit pause before unplugging the headphones and SMS/Email tones work correctly, but pull the headphones out of the device while the media player is playing audio and you then get no SMS/EMail tones.

Firmware 3.2010.02-8 and headphoned 1.7.

Anyone else able to reproduce? If so I'm happy to file a bug (though against what I'm not exactly sure - headphoned or the audio subsystem?)

Yup I'm having same problem. It also happens if you pause media player with the widget and it's not reponding as in bug 5894.
This is obviously a bug with media player and I don't think it's been reported as yet. I started a new thread here.

Milhouse 2010-03-17 14:49

Re: Stopping music/media player when headset unplugged
 
I've opened bug #9597 to address this wierd headphoned/MAFW pausing issue - would be really great if some technical comments could be added as I'm half expecting it to be closed invalid due to the involvement of headphoned.

Votes would be good too. :)

Morphic 2010-03-17 15:37

Re: Stopping music/media player when headset unplugged
 
I'll have a look...

Morphic 2010-03-17 16:31

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

Originally Posted by Morphic (Post 570506)
Yup I'm having same problem. It also happens if you pause media player with the widget and it's not reponding as in bug 5894.
This is obviously a bug with media player and I don't think it's been reported as yet. I started a new thread here.

It actually happens irrelevant of Bug 5894, if you pause media player with widget once it's been played from main app the system sounds will stop.

Milhouse 2010-03-17 17:26

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

Originally Posted by Morphic (Post 570698)
It actually happens irrelevant of Bug 5894, if you pause media player with widget once it's been played from main app the system sounds will stop.

Perhaps the widget uses the same mechanism as headphoned to pause the main Media Player application/framework.

thp 2010-03-18 21:14

Re: Stopping music/media player when headset unplugged
 
In the mean time, headphoned 1.8 has been uploaded to Extras-Devel today, and it adds support for stopping the FM Radio application in addition to Media Player, Panucci and MPlayer. Go vote for it once it enters Extras-Testing!

The D-Bus API for FM Radio has only recently been added by Martin (pycage), so this might not work immediately with the current version in the Maemo repositories, but will work with a future version.

No merging of qwerty12's patch for now, but maybe in a future release (it would be very helpful if you could somewhere post your patches as complete git patchset against the current git master branch on repo.or.cz - obviously I'm very lazy today.. ;).

qwerty12 2010-03-20 08:28

Re: Stopping music/media player when headset unplugged
 
1 Attachment(s)
Quote:

Originally Posted by thp (Post 572449)
No merging of qwerty12's patch for now, but maybe in a future release (it would be very helpful if you could somewhere post your patches as complete git patchset against the current git master branch on repo.or.cz - obviously I'm very lazy today.. ;).

I know, I know; attaching to a forum isn't the best way to send you patches... :\

thp 2010-03-20 10:01

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

Originally Posted by qwerty12 (Post 574445)
I know, I know; attaching to a forum isn't the best way to send you patches... :\

Thanks, looks good - applied locally here. Just one question: is the file debian/triggers created somewhere or did you forget to add it? If so, please include it (preferably with another Git patch, so I can easily apply it, and you get credited in the git changelog with your name).

qwerty12 2010-03-20 10:10

Re: Stopping music/media player when headset unplugged
 
1 Attachment(s)
Quote:

Originally Posted by thp (Post 574504)
Thanks, looks good - applied locally here. Just one question: is the file debian/triggers created somewhere or did you forget to add it? If so, please include it (preferably with another Git patch, so I can easily apply it, and you get credited in the git changelog with your name).

Bollocks! Thanks! (As you will have guessed, my lack of knowledge generally has me avoiding SCMs...)

thp 2010-03-20 11:52

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

Originally Posted by qwerty12 (Post 574516)
Bollocks!

Thanks, I've merged your patches now: http://repo.or.cz/w/headphoned.git

Strutten 2010-04-27 14:30

Re: Stopping music/media player when headset unplugged
 
Would it be possible for headphoned to work on nQaap?

thp 2010-04-27 14:35

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

Originally Posted by Strutten (Post 629945)
Would it be possible for headphoned to work on nQaap?

Sure. Just provide a D-Bus interface with a "pause" method that headphoned can call, and I'll add support for it to the next headphoned release. What is needed for this:
  • D-Bus Service Name (e.g. org.example.nqaap)
  • D-Bus Object Path (e.g. /org/example/nqaap)
  • D-Bus Interface (e.g. org.example.nqaap)
  • Name of the method ("pause" is a good name here ;))

(Of course, the author has to implement the D-Bus interface in nQaap)

Strutten 2010-04-27 15:35

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

Originally Posted by thp (Post 629953)
Sure. Just provide a D-Bus interface with a "pause" method that headphoned can call, and I'll add support for it to the next headphoned release. What is needed for this:
  • D-Bus Service Name (e.g. org.example.nqaap)
  • D-Bus Object Path (e.g. /org/example/nqaap)
  • D-Bus Interface (e.g. org.example.nqaap)
  • Name of the method ("pause" is a good name here ;))

(Of course, the author has to implement the D-Bus interface in nQaap)

Since a D-Bus sounds like a Bus on the D-line to me, I'll just link to this post in the nQaap-thread!

slobodsky 2010-05-31 17:27

Re: Stopping music/media player when headset unplugged
 
The problem with muted sounds isn't headphoned related. I have it in my application too. If I send "pause" command through D-Bus or libmafw it happens too. It can be the media player's bug.

thp 2010-07-16 20:20

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

Originally Posted by Surstroemming (Post 753285)
I guess the deamon currently is only "aware" of the state of the headphone jack, is it possible to make it register the state of calls happening or the trigger that starts the audio again after a call?

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. In this case, headphoned could listen to these signals, and maintain an internal "currently on a call" flag. If this flag is on when headphoned sends the "pause" signal (if it senses "headphones unplugged"), it will send another "pause" signal when the "call ended" signal is seen on D-Bus. The "pause" signal is idempotent for most media players, anyway, so sending it again after the call should do no harm.


All times are GMT. The time now is 01:04.

vBulletin® Version 3.8.8