The usual cause is a faulty wire somewhere between the earphone itself and the phone. Try using another earphone that you know works properly. If that cures the problem - you know your original earphone needs replacing. If not, the fault is in the phone itself.