这就是我正在做的事情:
self.iPodController = [MPMusicPlayerController applicationMusicPlayer];
MPMediaPlaylist* playlist = [self lookupSavedPlaylist];
[self.iPodController setQueueWithItemCollection:playlist];
[self.iPodController skipToNextItem];
[self.iPodController play];
这导致第一首歌曲播放,而不是第二首歌曲。这种类是有道理的,但它很烦人,我希望有一个解决办法。
答案 0 :(得分:3)
嗯,事实证明,如果您明确设置nowPlayingItem
,则不会出现此问题。这是修改后的代码:
self.iPodController = [MPMusicPlayerController applicationMusicPlayer];
MPMediaPlaylist* playlist = [self lookupSavedPlaylist];
[self.iPodController setQueueWithItemCollection:playlist];
self.iPodController.nowPlayingItem = [playlist.items objectAtIndex:0]; // explicitly set to track 1 to start
[self.iPodController skipToNextItem]; // will now skip to track 2!
[self.iPodController play]; // will now play track 2