I flashed CM12.1(unofficial,Android5.1.1) yesterday.Then I flashed SuperSU.
But whatever player I used,Music will only output to speaker.
I want to use my earphone.(BTW,Earphone is Okay,Android4.4 can use it)
I'm facing the same issue. I tried a trick to make its work but you have to do this every time you connect your earphone, first connect your earphone Open the fm radio and switch to speaker output and again to earphone. Thats it
Try following methods and check if it works:
1.Factory reset
-Settings-->Backup & restore--> Factory data reset.
2.Reflash CM12.1 ROM.
-Boot into Recovery and install zip from sdcard.
If it still doesn't works then it must be a bug in that particular build. All you can do is wait for next release or switch to another ROM.