How to fix my iphone 4s speaker?

My iphone 4s has a problem with speaker i don't know wat the problem is, sometimes you can't hear any sound you can't hear music or movie sound but you can receive phone calls and massages and be able to hear the sound it happens at least once a day either at night time or morning there's no volume bar when
playing music and the buttons don't work but after 1 hour the sound us back so help

There's a separate category strictly for cell/mobile phones ( HINT: it's in the consumer electronics section ).

Your question belongs there, not in the CARS & TRANSPORTATION section.