webOS Nation Forums >  Homebrew >  webOS patches > MusicPlayer: Vibrate on Headset Button Track Advance
MusicPlayer: Vibrate on Headset Button Track Advance

  Reply
 
LinkBack Thread Tools Display Modes
Old 10/27/2009, 01:16 AM   #1 (permalink)
Member

 
Join Date: Apr 2003
Location: Boston-area
Posts: 6,973
Likes Received: 116
Thanks: 418
Thanked 1,252 Times in 710 Posts
Default MusicPlayer: Vibrate on Headset Button Track Advance

Okay, so basically, you can use a quick double press of the headset button to advance tracks in the music player. However, I often am not sure if it's advanced the track or for some reason has paused it.

I started digging and my result is this. The Pre will do a long vibration (750ms) when it advances the track, only if you're using the headset button to do so. I'll be submitting to Preware in a few minutes.

Code:
--- .orig/usr/palm/applications/com.palm.app.musicplayer/scripts/MediaKeyControlHandler.js
+++ /usr/palm/applications/com.palm.app.musicplayer/scripts/MediaKeyControlHandler.js
@@ -23,6 +23,9 @@
 			
 			case "next":
 				// start playing automatically when the song is switched
+				this.serviceRequest = new Mojo.Service.Request("palm://com.palm.vibrate", {
+					method: 'vibrate', parameters: { 'period': 0,'duration': 750 }
+				});
 				this.musicPlayer.setPlayingState(true);
 			
 				this.musicPlayer.nextSong();
Also, I did some playing around, because I don't always feel the vibrate when I have my Pre in my pocket, to do a vibration and a tone. The built in system sounds suck, but I did have a little bit of success:

Code:
--- .orig/usr/palm/applications/com.palm.app.musicplayer/scripts/MediaKeyControlHandler.js
+++ /usr/palm/applications/com.palm.app.musicplayer/scripts/MediaKeyControlHandler.js
@@ -23,6 +23,12 @@
 			
 			case "next":
 				// start playing automatically when the song is switched
+				this.serviceRequest = new Mojo.Service.Request("palm://com.palm.vibrate", {
+					method: 'vibrate', parameters: { 'period': 0,'duration': 750 }
+				});
+				this.serviceRequest = new Mojo.Service.Request("palm://com.palm.audio/systemsounds", {
+					method: 'playFeedback', parameters: { 'name': 'shuffle_03' }, onSuccess: {}, onFailure: {}
+				});
 				this.musicPlayer.setPlayingState(true);
 			
 				this.musicPlayer.nextSong();
The tones version works, you'll hear a click when you move to the next track. However, it will NOT be submitted to Preware, for two reasons. One, it plays at the volume of your "system sounds" slider no matter what. Unlike other tones that play when music is playing, it doesn't lower the volume automatically, so for me it's almost deafening over my Etymotics. Secondly, for some reason it plays the sound over both the headphones and the system speaker.

Patches here are completely open-source, I don't know the differences between any of the licenses, but please feel free to take them and improve them, especially the tones one. I know there are other methods to play sounds that might work better but they're a bit beyond my comprehension.
jhoff80 is offline   Reply With Quote
Thanked By: a dumb cat
Old 10/28/2009, 10:43 PM   #2 (permalink)
Member
 
Join Date: Jun 2009
Location: Los Angeles, CA
Posts: 194
Likes Received: 0
Thanks: 45
Thanked 20 Times in 9 Posts
Default

awesome, man. i have the same problem with pandora, never know if its buffering the next track or if its paused. Can't wait to try this out.
a dumb cat is offline   Reply With Quote
Old 10/28/2009, 11:03 PM   #3 (permalink)
Member

 
Join Date: Apr 2003
Location: Boston-area
Posts: 6,973
Likes Received: 116
Thanks: 418
Thanked 1,252 Times in 710 Posts
Default

Oh, sorry, this will only work with the built-in music player, I think. It's really a per-application thing, not a global one. I'll have to check the Pandora code when I get a chance, see if I can do the same thing.
jhoff80 is offline   Reply With Quote
Old 10/29/2009, 02:32 PM   #4 (permalink)
Member

 
Join Date: Apr 2003
Location: Boston-area
Posts: 6,973
Likes Received: 116
Thanks: 418
Thanked 1,252 Times in 710 Posts
Default

Pandora one:

Code:
--- .orig/var/usr/palm/applications/com.palm.pandora/app/core/device_service.js
+++ /var/usr/palm/applications/com.palm.pandora/app/core/device_service.js
@@ -121,6 +121,9 @@
 		Util.log("media event: " + event.key);
 		switch (event.key) {
 			case "next":
+				this.serviceRequest = new Mojo.Service.Request("palm://com.palm.vibrate", {
+					method: 'vibrate', parameters: { 'period': 0,'duration': 750 }
+				});
 				AppGlobals.station.skip();
 				break;
 
\ No newline at end of file
jhoff80 is offline   Reply With Quote
Old 11/01/2009, 06:16 PM   #5 (permalink)
R_E
Member
 
Join Date: Jul 2009
Posts: 329
Likes Received: 5
Thanks: 29
Thanked 49 Times in 34 Posts
Default

so i was installing the pandora patch from preware and i accidentally pressed back while it was installing. Now i get an error about it ther being a reversed patch already. How can i remove whatever was partially installed?
R_E is offline   Reply With Quote
Old 11/02/2009, 01:10 PM   #6 (permalink)
Member

 
Join Date: Apr 2003
Location: Boston-area
Posts: 6,973
Likes Received: 116
Thanks: 418
Thanked 1,252 Times in 710 Posts
Default

Not sure on that, sorry.

Pandora had an update on 11/1 that seems to be breaking the headset button support entirely though, so I'm going to email them to see if they know about this, and maybe try changing the device_service.js back to how they used to have it.
jhoff80 is offline   Reply With Quote
Old 11/05/2009, 09:31 AM   #7 (permalink)
Member
 
addiarmadar's Avatar
 
Join Date: Oct 2009
Location: USA!!! USA!!! USA!!! USA!!!
Posts: 1,353
Likes Received: 24
Thanks: 36
Thanked 187 Times in 158 Posts
Default

I have the updated pandora fom 11-1 and yep the patch is broke. The bigger problem is i cannot remove the patch right now from preware. Getting the generic error for during the pre-remove script execution. Please tell me that we dont have to run erp for this? Thanks!!
addiarmadar is offline   Reply With Quote
Old 11/05/2009, 09:54 AM   #8 (permalink)
Member
 
addiarmadar's Avatar
 
Join Date: Oct 2009
Location: USA!!! USA!!! USA!!! USA!!!
Posts: 1,353
Likes Received: 24
Thanks: 36
Thanked 187 Times in 158 Posts
Default

I have tried reinstalling Pandora and just delete Pandora and remove the patch with pandora gone and still got the error. How can I manually move the patch??

Last edited by addiarmadar; 11/05/2009 at 10:40 AM.
addiarmadar is offline   Reply With Quote
Old 11/05/2009, 11:35 AM   #9 (permalink)
Member
 
addiarmadar's Avatar
 
Join Date: Oct 2009
Location: USA!!! USA!!! USA!!! USA!!!
Posts: 1,353
Likes Received: 24
Thanks: 36
Thanked 187 Times in 158 Posts
Default

Ok I fixed the issue. Used the webos quick install to remove the patch and not preware is letting me install the patch again, even though ill wait on an update for this patch
addiarmadar is offline   Reply With Quote
Old 11/05/2009, 01:29 PM   #10 (permalink)
Member

 
Join Date: Apr 2003
Location: Boston-area
Posts: 6,973
Likes Received: 116
Thanks: 418
Thanked 1,252 Times in 710 Posts
Default

Sorry, the reason I haven't updated it is because Pandora headset support seems to be broken in general in the newest update. Even without the patch it wouldn't respond to any button presses.
jhoff80 is offline   Reply With Quote
Old 11/14/2009, 02:31 AM   #11 (permalink)
Member

 
Join Date: Apr 2003
Location: Boston-area
Posts: 6,973
Likes Received: 116
Thanks: 418
Thanked 1,252 Times in 710 Posts
Default

Pandora is still not working with the headset button in 1.3.1.

Here's an updated version that appears to be working for me in 1.3.1 for the music player though. There's two different cases in the file now, but this one appears to be working for me.

Code:
--- .orig/usr/palm/applications/com.palm.app.musicplayer/scripts/MediaKeyControlHandler.js
+++ /usr/palm/applications/com.palm.app.musicplayer/scripts/MediaKeyControlHandler.js
@@ -32,6 +32,10 @@
 
 				this.musicPlayer.nextSong();
 
+				this.serviceRequest = new Mojo.Service.Request("palm://com.palm.vibrate", {
+					method: 'vibrate', parameters: { 'period': 0,'duration': 750 }
+				});
+
 				break;
 				
 			case "prev":
jhoff80 is offline   Reply With Quote
Old 11/15/2009, 11:51 AM   #12 (permalink)
Member
 
Join Date: Oct 2009
Posts: 15
Likes Received: 0
Thanks: 0
Thanked 1 Time in 1 Post
Default

The patch works in my Pre with 1.3.1 using Music Player Remix but I am not getting the vibrate. I have not tested in the normal Music player since I have it hidden.
Gamequeen is offline   Reply With Quote
Old 11/15/2009, 12:43 PM   #13 (permalink)
Member

 
Join Date: Apr 2003
Location: Boston-area
Posts: 6,973
Likes Received: 116
Thanks: 418
Thanked 1,252 Times in 710 Posts
Default

Quote:
Originally Posted by Gamequeen View Post
The patch works in my Pre with 1.3.1 using Music Player Remix but I am not getting the vibrate. I have not tested in the normal Music player since I have it hidden.
Yeah, it'll only patch the default music player. It looks for a specific file as part of the application, and so music player remix would stay untouched.
jhoff80 is offline   Reply With Quote
Old 01/27/2010, 01:27 AM   #14 (permalink)
Member

 
Join Date: Apr 2003
Location: Boston-area
Posts: 6,973
Likes Received: 116
Thanks: 418
Thanked 1,252 Times in 710 Posts
Default

So Pandora's latest version was a few months ago, and it broke the headset button control entirely. I was hoping that they'd have fixed it themselves by now, but they haven't, so I just uploaded a patch that used the old method of handling the button (the one that worked) as well as adds a vibrate when you skip to the next track.
jhoff80 is offline   Reply With Quote
Thanked By: a dumb cat
Old 01/27/2010, 11:50 AM   #15 (permalink)
Member

 
Join Date: Apr 2003
Location: Boston-area
Posts: 6,973
Likes Received: 116
Thanks: 418
Thanked 1,252 Times in 710 Posts
Default

Oops, forgot to attach the actual patch file for the Pandora one for those who don't want to wait until it's in Preware.

Edit: No longer works in Pandora 1.0.1, removed attachment.

Last edited by jhoff80; 02/28/2010 at 03:50 PM.
jhoff80 is offline   Reply With Quote
Thanked By: a dumb cat
Old 02/01/2010, 12:48 PM   #16 (permalink)
Member
 
Join Date: Dec 2009
Posts: 85
Likes Received: 1
Thanks: 6
Thanked 0 Times in 0 Posts
Default

does this patch work with wireless headsets and wired?
kra2y is offline   Reply With Quote
Old 02/01/2010, 01:34 PM   #17 (permalink)
Member

 
Join Date: Apr 2003
Location: Boston-area
Posts: 6,973
Likes Received: 116
Thanks: 418
Thanked 1,252 Times in 710 Posts
Default

Quote:
Originally Posted by kra2y View Post
does this patch work with wireless headsets and wired?
Not sure, I only have the wired one. I would think yes, but honestly just don't know.

The updated Pandora one is now in Preware, though.
jhoff80 is offline   Reply With Quote
Thanked By: a dumb cat
Old 02/01/2010, 03:40 PM   #18 (permalink)
Member
 
Join Date: Dec 2009
Posts: 85
Likes Received: 1
Thanks: 6
Thanked 0 Times in 0 Posts
Default

it doesn't work with my wireless headset, but it's not a stereo bluetooth set either. Can't play music, just calls through it. Mayber stereo one would work
kra2y is offline   Reply With Quote
Old 02/02/2010, 04:58 PM   #19 (permalink)
Member
 
Join Date: Jun 2009
Location: Los Angeles, CA
Posts: 194
Likes Received: 0
Thanks: 45
Thanked 20 Times in 9 Posts
Default

OMG this is amazing! Thank you so much for taking the initiative and helping all of us out. I still can't believe Pandora's dev didn't fix this on their own, but this goes to show our community is up to any challenge.

thank you!!!
a dumb cat is offline   Reply With Quote
Old 02/20/2010, 08:17 PM   #20 (permalink)
Member
 
cwgtex's Avatar
 
Join Date: Jul 2009
Posts: 608
Likes Received: 3
Thanks: 141
Thanked 243 Times in 91 Posts
Default

Can you please write a version of this patch that work fully (vibrate) on Music Player Remix?
cwgtex is offline   Reply With Quote
Reply

 

Thread Tools
Display Modes



 


Content Relevant URLs by vBSEO 3.6.0