If You are specifically looking for starting your service when music player starts, take a look at AndroidManager API. You can register for callbacks using
registerAudioPlaybackCallback
Also there is method from same AudioManager which tells you if Music isActive
isActive – Stackoverflow
solved How to start a service when another app gets active?