Contents

AVPlayerItemMetadataCollector

An object used to capture the date range metadata defined for an HTTP Live Streaming asset.

Declaration

class AVPlayerItemMetadataCollector

Overview

You can use the HLS #EXT-X-DATERANGE tag to define date range metadata in a media playlist. This tag is useful for defining timed metadata for interstitial regions such as advertisements, but can be used to define any timed metadata needed by your stream. To access this metadata when the stream is played using an AVPlayer, you create an instance of AVPlayerItemMetadataCollector, configure its delegate object (see AVPlayerItemMetadataCollectorPushDelegate), and add it as a media data collector to the AVPlayerItem (see example).

Creating an AVPlayerItemMetadataCollector as shown in the example, will capture all #EXT-X-DATERANGE metadata defined in your stream. If you would like to filter the output to only the metadata of interest, you can create an instance to filter by identifier and/or classifying labels using the init(identifiers:classifyingLabels:) initializer.

Topics

Creating a metadata collector

Accessing the delegate and callback queue

See Also

Timed metadata