I had an app which worked correctly in iOS 4.3, after upgrading to iOS 5 it behaves in another way.
After executing these lines on iOS 4.3 mp.playbackState is set to MPMusicPlaybackStatePaused, however in iOS 5 it is still set to MPMusicPlaybackStatePlaying.
MPMusicPlayerController *mp = [MPMusicPlayerController applicationMusicPlayer];
if(mp.playbackState == MPMusicPlaybackStatePlaying)
[mp pause];
I assume that playbackState is not updated within the same event loop, is it ok?
I think the issue is:
MPMusicPlaybackState playbackState = [musicPlayer playbackState];
in iOS5 is not always correct.
This work for me:
if (!isPlay)
{
isPlay = TRUE;
[appPlayer play];
}
else
{
isPlay = FALSE;
[appPlayer pause];
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.