It’s most probably a fractured cable.
Plug the cable into a music source (mobile phone) and listen to the audio.
If there is audio, or even if there isn’t, hold the plug where it enters the socket, and then gently, stress gently move the cable back and forth, where it exits the plug and listen if it affects the audio at all.
If it doesn’t then try the same where the cable enters the earphones. If it does affect the audio when moving it there and if they are the in ear type it will be difficult (if not impossible) to repair as most likely the cable is molded to the earphones
If it does then the wires in the cable are fractured where it exits the plug. This is usually caused by removing the plug from the socket by pulling on the cable and not removing it by grabbing it by the plug.
This can be repaired by cutting the cable back a few inches and re-terminating the wires on a new plug.
Before cutting the cable, remove the insulation (as best as you can) from the plug to expose the wiring connection. Note what colour wire goes where. Write it down! This will make it easier when it comes to connecting a new plug to the cable.
Depending on whether the plug is a 3 or 4 pole plug depends on what plug you have to look for.
If it is a 3 pole plug, search for a 3.5mm TRS cable mount plug
If it is a 4 pole plug, search for a 3.5mm TRRS cable mount plug.
There are videos on YouTube that show how to terminate the plugs.