DISCLAIMER: I AM NOT RESPONSIBLE FOR ANYTHING THAT HAPPENS TO YOUR PHONE.
I know this is my first post and this might even belong in a different thread, but I think that this thread will help so many people that I am writing a new thread. This is one thing that has really annoyed me on the epic (as a previous iPhone user and a heavy music listener).
If you follow these instructions, the headset button will play/pause and skip tracks. I am running the leaked froyo and it does answer and hang up calls (long press rejects call) but my friends running 2.1 report that in a call it only mutes the microphone and unmutes. Some of my friends on 2.1 also tell me that while this works for pausing it doesn't seem to play after that. More on that later.
YOU MUST BE ROOTED FOR THIS TO WORK!
(Sorry for those of you who are not)
1. If you're not rooted, root. (This will void your warranty, do this at your own risk.)
2. You will need some kind of root file explorer with a text editor (I personally use "root explorer" off the market, very simple and great interface).
3. From the root directory, go to system/usr/keylayout and you will see a file called sec_jack.kl. You need to open this file in a text editor. Don't forget to mount R/W. In root explorer, hold down the file and scroll down to "open in text editor."
4. It will show something like this: "Key 248 SEND_END".
You want to change this to "Key 248 HEADSETHOOK WAKE_DROPPED"
(The amount of spaces you use doesn't matter, but use at least one and make sure you use underscores where specified.) (Additionally, if you are running 2.1, you may want to change this to "Key 248 MEDIA_PLAY_PAUSE WAKE_DROPPED" instead; scroll down to the bottom of this post to see why.)
5. Save changes. I would delete the backup file it creates, but this is not necessary (I like to keep my root directory clean).
6. You probably should remount the directory as read only again.
7. Reboot your phone. Changes only take effect then.
Now there are some things you need to keep in mind:
Different Media Players:
There are only 2 media players this works on so far (along with those that have some kind of "override headset controls" feature, more on that later) and those media players are the stock one, and music mod (free from the market). If you are using a media player that has a override headset button (like PlayerPro, TuneWiki, PowerAmp) the button will only control that application and in calls it will play music if you hit it.
This is why I recommend Music Mod - better than stock player but doesn't interfere with controlling calls like other media players, and if the headphones accidentally come out of your phone while you're listening to music, Music Mod will pause your music, while the stock music player has no option of the sort.
Those of you running android 2.1
This doesn't work on Eclair as well as it does on froyo, and I heard that it will only pause, not play music. Additionally, it only mutes/unmutes in calls, doesn't answer/reject/end them.
A workaround for this on 2.1 is to change the file to "Key 248 MEDIA_PLAY_PAUSE WAKE_DROPPED" instead of HEADSETHOOK. This will play/pause in 2.1 properly but still won't help you with calls.
If you are worried that upgrading to froyo may kill your gps, use this link (gps on froyo is actually much more accurate, I get like 2-4 meter locks): http://androidforums.com/samsung-epic-4g/235908-video-epic-froyo-flash-patch-tether-functioning-gps.html
I hope this helps all of you out there.