应用程序无法继续下一首歌在后台

时间:2011-08-30 10:04:37

标签: ios ipad avaudioplayer

我使用AVAudioPlayer为iPad创建了一个简单的音乐App。但问题是,当我按下主页按钮时,它只播放背景中的当前歌曲。应用程序无法在后台继续播放下一首歌曲。

1 个答案:

答案 0 :(得分:0)

这对我有用

    here musicPlayer is MPMusicPlayerController 

    [self setMusicPlayer: [MPMusicPlayerController applicationMusicPlayer]];

    // By default, an application music player takes on the shuffle and repeat modes

    //      of the built-in iPod app. Here they are both turned off.

    [musicPlayer setShuffleMode: MPMusicShuffleModeOff];

    [musicPlayer setRepeatMode: MPMusicRepeatModeNone];