If it works while headphones are plugged in, and rebooting hasn't fixed the problem, there's probably a physical problem in or around the headphone jack itself.
The phones I've had (Moto Droid, Moto Droid 3, Samsung Galaxy S3, iPhone 7) would all pause media playback if wired headphones became disconnected. (Come to think of it, I think my iPod Touch(es) did that too) they would not resume playback on reinsertion, probably because with media paused there was no return current on the ground.
Headphone jacks in most phones either have some form of micro-switch, or a contact that senses voltage flowing on the ground line. The purpose is to detect when you plug in headphones, and mute the internal speaker.
Wired earbud remotes generally alter the resistance of the ground return and the phone interprets different levels of resistance as different buttons.
If some form of conductive debris or corrosion is causing some unintended current to flow, that could be causing the problem.