Getting metadata form Shoutcast audio stream - swift

I'm asking here because I got no answer on stackOverflow and I really want this to work.

I have a URL for Shoutcast audio stream. I used AVFoundationAVAsset to enclose URL and AVPlayer to play it. That works.

I cannot however access any metadata from that stream.

I tried:
Code Block swift
playerItem!.observe(\AVPlayerItem.timedMetadata, options: .new) {
(player, change) in print(change)
}
got nothingI'd appreciate any help form an experience developer, because this is my first iOS app. :D

Answered by Media Engineer in 614418022
AVPlayerItem.timedMetadata (deprecated) or AVPlayerItemMetadataOutput should return valid metadata if it is available in the Shoutcast stream. Please note that prior to iOS 14, you would only get StreamTitle and StreamUrl metadata, we recently added support for more icy-metadata. If you are not seeing metadata present in the stream, please file a report through Feedback Assistant.

For Shoutcast streams AVAsset.availableMediaFormats won't work, since they can be used only for statically available metadata.
Accepted Answer
AVPlayerItem.timedMetadata (deprecated) or AVPlayerItemMetadataOutput should return valid metadata if it is available in the Shoutcast stream. Please note that prior to iOS 14, you would only get StreamTitle and StreamUrl metadata, we recently added support for more icy-metadata. If you are not seeing metadata present in the stream, please file a report through Feedback Assistant.

For Shoutcast streams AVAsset.availableMediaFormats won't work, since they can be used only for statically available metadata.
Getting metadata form Shoutcast audio stream - swift
 
 
Q