![]() |
Stopping music/media player when headset unplugged
One thing that i really like about my Zune is that whenever I pull the headset out (which I tend to do a lot by accident) - the player stops. Obviously that makes sense on the Zune (non-HD) as it doesnt have any external speakers.
I would love for there to be an option to have my N810 act in the same way; If playing a movie/music/podcast and the headset is pulled out...then stop the player. If you want to continue to play through your speakers just press play and it continues playing. Happened again today that I stand in line and the headset pulls out and suddenly I'm blasting Cypress Hill from my right pocket.... Thing is...would such an option have to be implemented into each possible media player...or could it somehow be a global, application-independent option...somehow? |
Re: Stopping music/media player when headset unplugged
I like this. This will be a nice feature. Will save many from those little occasional embarrassments.
Pause audio/video when the headset is pulled out. |
Re: Stopping music/media player when headset unplugged
You can detect headphone plug/unplug events via D-Bus, so you could write a service that then notifies the media players.
BTW: On the N900, you can non-headphone and headphone volume independently, so if you set the volume to zero when the headphones are not plugged in, then connect the headphones and set some positive volume, if you accidentally unplug the headphones in a subway or bus, people won't be distracted by whatever fancy music you decided to listen to today. That said, a mini-daemon that listens on D-Bus for headphone unplug changes and sets/remembers/restores the volume for each different mode would probably be easy to do and avoid what I call the "public transport situation" ("waiting in line situation" for you ;) for all media players. |
Re: Stopping music/media player when headset unplugged
Oh, and I just found out (while searching for code) that there have already been several threads about this:
http://talk.maemo.org/showthread.php?t=26925 http://talk.maemo.org/showthread.php?t=24975 ..and the solution (as a package) is here: http://talk.maemo.org/showthread.php?t=21182 ..or if you prefer powerlaunch: http://talk.maemo.org/showpost.php?p...7&postcount=18 |
Re: Stopping music/media player when headset unplugged
Only problem with this is that sometimes the N900 seems to forget that there are headphones plugged in from time to time and the headphones icon disappears from the status bar.
|
Re: Stopping music/media player when headset unplugged
1 Attachment(s)
Here's a quicky hacked together version of what you want. Compiled against Diablo's SDK. Source + Git repository included.
Either compile it yourself in the SDK or trust my binary and copy headphoned-armel-diablo to your N8x0 and then start it. Everytime the headphone is disconnected, headphoned will send a "pause" event (the same as clicking on pause in the Media Player) to the player. |
Re: Stopping music/media player when headset unplugged
Hi and wow thanks for the super quick 'fix' :)
I'm still new to the Linux world so sorry for the follow-up questiom: I downloaded your zipfile to my N810 and unzipped it. I can see the files/directories it created (including the headphoned-armel-diablo file in the main /headphoned folder - but how do I actually open/install it? I tried browsing to it through the application manager but wasn't able to find anything I could install. Man, if this will work this will be awesome :) Edit: I tried apt-get -f install headphoned-armel-diablo in the /headphoned folder (while I was root) but got the error 'Couldnt find package headphoned-armel-diablo' Also tried dpkg -i headphoned-armel-diablo but with no luck |
Re: Stopping music/media player when headset unplugged
Quote:
Code:
chmod +x headphoned-armel-diablo The ampersand [&] will cause it to run in the background. You can use "ps ax | grep headphoned" to check if it's running and you can use "killall headphoned-armel-diablo" to kill it. Here's a nice beginner tutorial for getting used to the command line: http://www.linuxcommand.org/ HTH. |
Re: Stopping music/media player when headset unplugged
Quote:
I wasn't sure if the code you included was supposed to be run as two entries or as one long sentence. I tried both but did not seem to do anything. When executing the first row I don't get any confirmation or error message. When executing the second row I got 'no permission'. I tried checking for active processes using an app i got running in tne status barr but it didnt show there - and i also tried pulling out the cord whilst playing a podcast through gpodder/panucci but the player did not pause. Sorry for being new to all of this and making helping out a lenghty process. (Also..how do I get a 'pipe' as in your example for how to check what processes are active using my N810 keyboard?) |
Re: Stopping music/media player when headset unplugged
Sounds like you are perhaps in the wrong directory when you execute the chmod command. Try moving to the directory you extracted with command "cd" [directory]. To make sure the chmod worked, you can run "ls -la", it should show something like "-r-x------" [filename], where "x" means you can now run the application.
Symbol "|" is called pipe, and it gives the output of first command to the second command. Most usual use case is probably finding some specific string in a long text output, like: "ps aux | grep [name of the program]". Not sure what you need to press to get it out of n810 ;) Oh, and the "ps aux" above lists all the running processes. Quote:
|
Re: Stopping music/media player when headset unplugged
Quote:
Code:
mv /media/mmc2/headphoned-armel-diablo /home/user/ |
Re: Stopping music/media player when headset unplugged
I have now created a proper package with an init script that takes care of starting headphoned when the system starts (and on installation). The package is called "headphoned" ("Headphone daemon" in the Application Manager) and will be available in Extras-Devel right now. Product page and garage project (for hosting the source) are in the works...
|
Re: Stopping music/media player when headset unplugged
I had a "public transit situation" the other day and found myself wishing for just this feature. Awesome.
|
Thanks
Thanks for this useful app.
Installed it from the rep and it works like a charm. |
Re: Stopping music/media player when headset unplugged
Maybe it's me but I don't get this to work.
I downloaded the headphone daemon from the app manager. It says it installed ok. I start up gpodder and launch a podcast so it starts playing through panucci. I pull out the headset and the podcast continues to play through the speakers :( When I look at 'active processes' I see headphoned running (964kb). Help :( |
Re: Stopping music/media player when headset unplugged
Quote:
|
Re: Stopping music/media player when headset unplugged
Quote:
Any chance that 1.3 will allow panucci and Mplayer to be paused as well? :) |
Re: Stopping music/media player when headset unplugged
Once I made a script to pause Panucci. This was the magic line
Maybe this can help in some way Code:
dbus-send --type="method_call" --dest=org.panucci.panucciInterface /panucciInterface org.panucci.panucciInterface.playPause |
Re: Stopping music/media player when headset unplugged
Quote:
|
Re: Stopping music/media player when headset unplugged
I had another 'incident' the other day where panucci started blasting the latest edition of Coverville to all the people on the bus :)
|
Re: Stopping music/media player when headset unplugged
This would indeed be a very useful application - and seems like a well implemented one (no interface, etc - just auto-pause when headset is unplugged) - if it would support more of the media players.
|
Re: Stopping music/media player when headset unplugged
A setting within headsets or media player would be great !
|
Re: Stopping music/media player when headset unplugged
Ok you asked for it.. headphoned 1.3 (currently wandering through the autobuilder) gained support for pausing Panucci in addition to the built-in Media Player. The only other media player that is on my roadmap would be MPlayer, and that will be a bit more tricky :)
|
Re: Stopping music/media player when headset unplugged
headphoned 1.3 is now in Extras-Devel for Chinook and Diablo. Please test this release, and report any issues here. I will push the package to Extras if no bugs surface in the next few days. Thankd for your help!
|
Re: Stopping music/media player when headset unplugged
I installed 1.3 and, playing with panucci it seems to pause the player perfectly.
If I play through the speakers and insert the headphones it continues to play through the headphones without a pause - which I think works great. Thanks, this was much needed! |
Re: Stopping music/media player when headset unplugged
headphoned 1.4 is now in Extras-Devel for Chinook and Diablo, and should support MPlayer in addition to Panucci and Media Player. This should also work for applications that use MPlayer as their backend (e.g. Canola).
|
Re: Stopping music/media player when headset unplugged
Quote:
|
Re: Stopping music/media player when headset unplugged
Quote:
That said, there might be a use case for having headphoned the N900 as well, just have not got around to do it, as the volume feature described above fixes public transport situations for me already ;) |
Re: Stopping music/media player when headset unplugged
Quote:
Is it by the way possible to send other commands besides PAUSE with your program? I have understood that it is for example possible to control Nokia 5800 XpressMusic's music player with Nokia AD-54 remote control. I tested the AD-54 with N900 and it does not work. I was just wondering if this is a hardware limitation or software limitation. Nokia AD-54: http://europe.nokia.com/find-product...ts/hs-45-ad-54 |
Re: Stopping music/media player when headset unplugged
Quote:
|
Re: Stopping music/media player when headset unplugged
No, this only sets the media player volume to 0. It doesn't affect the "master" volume setting, so your phone rings normally.
|
Re: Stopping music/media player when headset unplugged
hi guys.
How about pausing the player when a2dp is disconnected ?? N97 had this detail while the n900 does not, and on the car it really makes a diference. Any ideas ?? thank you. |
Re: Stopping music/media player when headset unplugged
Quote:
If you send me some a2dp hardware, I can try to implement it :p |
Re: Stopping music/media player when headset unplugged
Would libplayback (com.osso.Playback.Manager in particular) help in this instance? From what I gather, it helps facilitate media playback from multiple sources.
I'm not yet familiar with dbus or even the maemo platform for that matter, so I wouldn't be able to submit a patch. However, if I understand correctly, this would at least prevent you from having to write duplicitous code (mplayer, default media player, etc). Also, i don't even know if libplayback is available for maemo 4. I saw reference to it while browsing the maemo 5 documentation, so excuse my ignorance if it doesn't exists ;-) Edit: [Insert Foot In Mouth] Further investigation shows that it is in fact a fremantle-only library: http://maemo.org/packages/view/libplayback-1-0/ [/Insert Foot In Mouth At least this may be the way to go for doing something similar in Maemo 5. Anyways, I do think this is a cool application, even if I can't currently use it. Keep up the good work! |
Re: Stopping music/media player when headset unplugged
Quote:
|
Re: Stopping music/media player when headset unplugged
I think I found a bug.
If you play something in mPlayer (say a movie) and pause it and play something in Gpodder-Panucci and then pull out the headphones...the mPlayer starts playing through the speakers. |
Re: Stopping music/media player when headset unplugged
Quote:
The only application that provides a "Pause if it's playing, do nothing otherwise" command is Panucci (for obvious reasons ;). At least I have not found D-Bus calls for pausing the media player or input commands for MPlayer that do what I want. An alternative would be to have headphoned go check by itself if Media Player / MPlayer are currently playing something back and avoid sending the "Pause" signal in certain cases. Again, the code is open and patches are welcome ;) |
Re: Stopping music/media player when headset unplugged
hi there,
I did some dbus-monitoring on the N900 and found that the following command pauses the media player: dbus-send --dest=com.nokia.mafw.renderer.Mafw-Gst-Renderer-Plugin.gstrenderer /com/nokia/mafw/renderer/gstrenderer com.nokia.mafw.renderer.pause I made (a quick) change in headphoned and it works. I also tried with libplayback, but didn't succeed. I think that library should be used when you are creating your own player and is not really for controlling other players. Anyway, that is just my guess, because I can't get much from the documentation... |
Re: Stopping music/media player when headset unplugged
Quote:
|
Re: Stopping music/media player when headset unplugged
Quote:
So it would be really nice if headphoned could be available for Fremantle, too. |
All times are GMT. The time now is 00:33. |
vBulletin® Version 3.8.8