Pauses music when receiving ACTION_AUDIO_BECOMING_NOISY intent which signals "audio is about to become 'noisy' due to a change in audio outputs."
Pause music on loss of audio focus.