"I had the same problem yesterday. The headset worked fine but I could get no sound of my speakers on my iPad 3. I searched all over and there are a variety of answers to this from the absurd to the logical. Needless to say I tried them all.
What worked for me was blowing very hard into the power connector just below the speakers. I had tried compressed air in all the openings and the only place where the speakers worked intermittently was when I was pushing air in to the power connector. I happen to have a dog that sheds a lot of very fine hair. My guess is that one or more of those went inside that slot and insulated some connection. By blowing hard inside I seemed to have cleared the problem but not totally. The sound is still a little bit scratchy."
"I had the same problem with my new iPad. I sent it in and they sent me a new one back and guess what? Same problem.
After speaking with tech support again, one guy suggested that I restore as a new iPad rather than restore from my backup, suggesting it was one of my apps.
So I did this and it worked. One of the keys to this being the culprit for me was that the system sounds still worked fine! By system sounds, I mean the basic alerts, mail swoosh, keypad tones, etc."
I had the same problem. There is a switch that switches the sound to the head phones when the head phones are pluged in. This switch can get stuck in head phone mode. Get a head phone jack (plug) push it in and out till the switch releases.
Clean the charging dock. It has dust in it or it is a little corrosion on it. Take a tooth pick and scrape it out a little bit. The iPad thinks it is connected to a speaker dock.