0
我無法從HTTP實時流(使用m3u,m3u8播放列表文件)獲取iPhone上的歌曲名稱和作曲家姓名。我試過從這個網站得到tempomix radio。這是鏈接流 - http://stream21.group-network.net:9012在iPhone上從流上獲取ID3標籤
我嘗試使用下面的代碼:
AVPlayerItem *playerItem = [AVPlayerItem playerItemWithURL:url];
_player = [[AVPlayer playerWithPlayerItem:playerItem] retain];
_player.actionAtItemEnd = AVPlayerActionAtItemEndNone;
[_player addObserver:self forKeyPath:@"status" options:NSKeyValueObservingOptionNew context:NULL];
[_player addObserver:self forKeyPath:@"currentItem" options:NSKeyValueObservingOptionNew context:NULL];
[_player addObserver:self forKeyPath:@"timedMetadata" options:NSKeyValueObservingOptionNew context:NULL];
然後等待回調位置:
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
回調時說到 - 我檢查AVPlayerStatus和運行遊戲。 收音機播放良好 - 但從來沒有來觀察ValueForKeyPath。
我知道這個問題看起來類似this question,但描述的方法不適合我。
任何想法?謝謝。
謝謝你的回答!對於這個流,我可以看到標題(在RAW數據中)。但這個鏈接http://fms.broadcast.quantumart.ru/hls-live/adaptive-dfm/_definst_/dfm/livestream.m3u8?此列表僅提供少量.st文件 - 但內部沒有ICY標籤... – 2012-07-31 18:50:10
@Sergey,您剛剛鏈接的那些流是完全不同的,並且不由SHOUTcast/Icecast提供服務。如果有元數據,則需要將其從MPEG流中提取出來。 http://en.wikipedia.org/wiki/MPEG_transport_stream – Brad 2012-07-31 18:56:46