如果在播放则停止,如没有播放则播放
MPMusicPlayerController *musicPlayer = [MPMusicPlayerController iPodMusicPlayer]; MPMusicPlaybackState playbackState = musicPlayer.playbackState; if (playbackState == MPMusicPlaybackStateStopped || playbackState == MPMusicPlaybackStatePaused) { [musicPlayer play]; } else if (playbackState == MPMusicPlaybackStatePlaying) { [musicPlayer pause]; }