I'm playing a silent music with AVAudioPlayer when user locks the screen, so that my timers won't stop.
However, when I play an iPod music with [MPMusicPlayerController applicationMusicPlayer]
, AVAudioPlayer
stops,without receiving any call back.
Is there any way so that I can start [MPMusicPlayerController applicationMusicPlayer]
playing without stoping AVAudioPlayer
playing?
EDIT: Thanks guys, this is the app I'm working on:
It is an Alarm app, this app allows user to lock screen while app is running,and when it is the time of the alarm, app can play iPod music to wake the user.Local notification can not use iPod music as alert sound, so I have to keep the app running while screen is locked.
If user quit the app, it will use local notification as alarm, whose sound is limited to files in bundle.
I can't use UILocalNotification as timer since when in screen locked status(in UIApplicationStatusInactive), app can't receive local notification generated by the system.
I figured it out myself.
It is not calling [MPMusicPlayerController +applicationMusicPlayer]
that stops AVAudioPlayer, but calling [MPMusicPlayerController -setShuffleMode:]
, I don't know why calling this would stop AVAudioPlayer, but it is where the problem lies in.
Thanks everyone, I think I should paste my complete code next time.