2014-05-19 2 views
0

nextItem이라는 다음 노래가 될 MediaItem을 만들고 싶습니다. 다음 노래는 다음에 사용자에게 미리보기로 재생됩니다. 다음 항목을 재생하고 싶지 않고 제목을 가져옵니다.재생할 다음 미디어/노래 항목의 제목 가져 오기?

현재 항목은 다음과 같습니다

MPMediaItem *currentItem = [musicPlayer nowPlayingItem]; 

나는 다음 항목이 될 것입니다 가정 :

MPMediaItem *nextItem = [musicPlayer nowPlayingItem + 1]; 

이나 뭐,하지만이 작동하지 않습니다.

The index of the now playing item in the current playback queue. 

@property (nonatomic, readonly) NSUInteger indexOfNowPlayingItem 

그래서 난 그냥 다음 트랙이 재생 될 나는이 MediaItem nextItem를 선언 얼마나 궁금 다음 Apple docs에서 속성 indexOfNowPlaying 항목이 있습니다. 나는 UILabel에 그 제목을 보여주고 싶지만, 나 자신을 할 수있다.

검색 한 적이 있지만 비슷한 해결책을 찾을 수 없습니다. 어떤 도움을 주시면 감사하겠습니다.

답변

0

당신이 말한 것처럼 nextItem을 가져 오는 기능이 있는지 여부는 알 수 없습니다. 당신이

+1

이 다음 항목의 제목을 얻을 수 있습니까

// MPMusicPlayerController is an iVar variable. MPMusicPlaybackState state = MPMusicPlayerController.playbackState; [MPMusicPlayerController skipToNextItem]; if(MPMusicPlayerController.indexOfNowPlayingItem != NSNotFound) { if(state == MPMusicPlaybackStatePlaying) [MPMusicPlayerController play]; MPMediaItem *currentItem = MPMusicPlayerController.nowPlayingItem; // you get your currentItem and update UI } 

희망이 도움 :

현재 내가 할 다음 항목을 얻을 구현? 다음 항목을 재생하는 것처럼 보입니다. – user3127576