Hi,
i'm trying to get Metadata from an Shoutcast Stream. The Code below shows the Things i've done to get some Metadata. I only get the Artist und the Album.
But the Server sends other Metadata on the initial Response like icy-br and icy-url.
But AVPlayer seems to ignore them.
func foo()
{
let asset = AVAsset(url: url)
playerItem = AVPlayerItem(asset: asset)
item.addObserver(self, forKeyPath: "timedMetadata", options: NSKeyValueObservingOptions.new, context: nil)
player = AVPlayer()
player.replaceCurrentItem(with: item)
}
override open func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
{
....
switch keyPath
{
case "timedMetadata":
let rawValue = item.timedMetadata?.first?.value as? String
handleTimedMetadata(rawValue: rawValue)
}
}
I also registered to the Notificationcenter to receive AccessLogEntry. But on ICY Streams the method is not called, only on HLS Streams!
There i can readout some bitrate informations.
notificationCenter.addObserver(self, selector:#selector(handleNewAccessLogEntry), name: .AVPlayerItemNewAccessLogEntry, object: nil)
The easiest way i think is getting the DataTask behind AVURLAsset. But this is only possible when using AVAssetDownloadURLSession. But i dont want any data to be downloaded to a file on the device.
Probaly i missed something or is AVPlayer buggy or still work in progress?
Any Suggestions how to get the ICY-Metadata?