Android phone speaker problem

I have a Samsung Galaxy S, the Samsung Captivate, and for some reason the phones speaker will cut in and out.  One minute I'll be listening to something and then the speaker will just stop working. The music is still playing, but the speaker just dies on me and I have to repeatedly tap the back of the phone to get it to work again. I want to maybe get an iPhone instead of this P.O.S, but I do like Android. Any ideas on how I could fix this?

It's most likely a hardware issue, I need some more specifics and tests before I can come to a sure conclusion. Take better care of your phone and use the warranty when things like this occur. (P.S. If you think switching over to Apple will solve problems with components breaking then you probably shouldn't be on this side of the fence anyway.) (P.P.S Try factory reseting your phone or completely flashing a fresh ROM on it, that should be able to tell if it was a SW or HW issue.) 

Well I've done the research and it turns out it's a global problem. My friends older sister has the same model and everything, and her speaker is messed up too. It's a problem with all Samsung Captivates. And as far as Apple goes, I kinda don't want to get an iPhone, but until Samsung and Android get their shit together and make a decent phone that doesn't freeze, make me force close apps, have a speaker that bugs out, I think I'm going to get a 3GS. At least Apples phones and speakers work. I'll just jailbreak it the phone once I get it.

Bah. No.

Don't get the crap that carriers spew out, buy the Galaxy nexus.

Sorry to start out with such hate, I was tired, but I did some more, proper research(or at least I think) and here's a fix: But, please don't blame HW problems on the Android platform. I've had Anroid since 1.6 and have very little problems with it.(I still use my 1.6 device, works like a charm.) Samsung is cheap, go with a high-end HTC, LG, or Nexus version phone(yes even the Samsung Nexus's are decent.)

i would return the phone since they know it is a hardware issue!!

It's cool dude, I understand. But I took the phone back and got it replaced because of a warranty issue, I can't get a new one until April. I tried the fix you linked to and it worked for a few hours but then just stopped working completely. I'm also having a few other problems that aren't related to hardware, like my phone freezing up or force closing apps. I mean I love Android, would prefer it over Apple anyday, I just don't like how carriers have so many different type of Android devices and don't support most of them. At least with Apple, it's one phone, updates are for the most part for all the models of that one phone, and they work most of the time.

Freezing and force closes are an OS build issue or app incompatibilities. Try getting a custom ROM and checking that apps aren't intefering with each other. I would highly suggest Cyanogenmod.