回答

1

首先,你需要設置一個NSNotification,這樣你可以在特定的時間間隔獲取數據,就像這樣:

[[NSNotificationCenter defaultCenter] addObserver:self 
             selector:@selector(StreamMeta:) 
             name:MPMoviePlayerTimedMetadataUpdatedNotification 
             object:nil]; 

接下來,創建方法。我將使用streamMPMoviePlayer爲您MPMoviePlayerControllermetaString的名稱作爲NSString將存儲元數據值:

- (void)StreamMeta:(NSNotification*)notification 
{ 
    if ([streamMPMoviePlayer timedMetadata] != nil) { 
     MPTimedMetadata *meta = [[streamMPMoviePlayer timedMetadata] objectAtIndex:0]; 
     metaString = meta.value; // gives the NSString the artist/song information 
    } 
    else { 
    // No metadata available 
    } 
} 
+0

看,這就是對MPMusicPlayer。我要求MPMoviePlayer在線流媒體,即無線網址流媒體。 – user2174560 2013-03-15 15:30:51

+0

@ user2174560檢查我的更新。它有用嗎? – lifetimes 2013-03-15 16:09:31

+1

是的,它的工作thanx ... :) – user2174560 2013-03-18 05:12:19