我玩用的MPMoviePlayerController一個音頻流的URL,它工作得很好,是他們的任何方式來獲得當前播放的細節跟蹤..我的意思是歌名,歌手名等提前MPMoviePlayerController當前正在播放的項目詳細信息?
感謝
我玩用的MPMoviePlayerController一個音頻流的URL,它工作得很好,是他們的任何方式來獲得當前播放的細節跟蹤..我的意思是歌名,歌手名等提前MPMoviePlayerController當前正在播放的項目詳細信息?
感謝
ADDT此烏爾.h文件中
@property (nonatomic, retain) MPMusicPlayerController *musicPlayer;
@property (nonatomic, retain) IBOutlet UILabel *songLabel;
@property (nonatomic, retain) IBOutlet UILabel *artistLabel;
@property (nonatomic, retain) IBOutlet UILabel *albumLabel;
- (void)handleNowPlayingItemChanged:(id)notification
{
// Ask the music player for the current song.
MPMediaItem *currentItem = self.musicPlayer.nowPlayingItem;
// Display the artist, album, and song name for the now-playing media item.
// These are all UILabels.
self.songLabel.text = [currentItem valueForProperty:MPMediaItemPropertyTitle];
self.artistLabel.text = [currentItem valueForProperty:MPMediaItemPropertyArtist];
self.albumLabel.text = [currentItem valueForProperty:MPMediaItemPropertyAlbumTitle];
// Display album artwork. self.artworkImageView is a UIImageView.
CGSize artworkImageViewSize = self.artworkImageView.bounds.size;
MPMediaItemArtwork *artwork = [currentItem valueForProperty:MPMediaItemPropertyArtwork];
if (artwork != nil)
{
self.artworkImageView.image = [artwork imageWithSize:artworkImageViewSize];
}
else
{
self.artworkImageView.image = nil;
}
}
MPMediaItem * currentItem = self.musicPlayer.nowPlayingItem;那musicPlayer是MPMoviePlayerController對象嗎? – 2012-04-12 06:54:38
是的,MPMusicPlayerController * musicPlayer; – akk 2012-04-12 07:00:46
但是當我訪問此方法內的MPMoviePlayerController對象時,我得到了錯誤 「在'firstViewController'類型的對象上找不到屬性'musicPlayer'」...我已經給MPMoviePlayerController對象作爲靜態,靜態MPMoviePlayerController * musicplayer = nil; – 2012-04-12 07:12:33
MPMoviePlayerController
不支持獲取基於ID3元數據從播放流的。您必須使用MPMusicPlayerController
(本地內容)或可能使用AVPlayer
(流式內容)才能完成此功能。雖然我必須承認,我不完全確定AVPlayer
/AVPlayerItem
是否能夠完成工作 - 我從未嘗試過。
但我有一個使用MPMoviePlayerController的在線http音頻流,是MPMusicPlayerController支持在線流?是他們的任何其他方式來實現這... – 2012-04-13 03:58:41
@NeerajNeeru看到我的編輯 – Till 2012-04-13 11:45:54
好吧然後我將如何訪問AVPlayer當前播放項目的詳細信息 – 2012-04-17 07:41:03
@Parth Bhatt helow,請你幫我 – 2012-04-12 08:05:31