I'm using AVAudioPlayer
to play music
I want to control playing from remote controls which are part of using headphones.
I've already this:
override func remoteControlReceivedWithEvent(event: UIEvent?) {
let rc = event!.subtype
print(rc.rawValue)
//rc.rawValue: 101 = pause, 100 = play
switch rc {
case .RemoteControlPlay:
playButtonClicked("")
case .RemoteControlPause:
pauseButtonClicked("")
default:break
}
}
It's working great from this menu
But clicks on headphones are ignored. How can I fix it?