Instance Method

metadata(forFormat:)

Returns an array of metadata items found in the container with the specified format.

Declaration

func metadata(forFormat format: AVMetadataFormat) -> [AVMetadataItem]

Parameters

format

The metadata format for which you want items.

Return Value

An array of AVMetadataItem objects, one for each metadata item in the container of the specified format, or an empty array if there is no metadata for the specified format.

Discussion

You can filter the resulting array to the specific items of interest using the class methods provided by AVMetadataItem, such as metadataItems(from:filteredByIdentifier:) or metadataItems(from:with:).

Special Considerations

This method becomes callable without blocking when the data in the availableMetadataFormats property is already loaded.

See Also

Accessing Metadata

var lyrics: String?

The lyrics of the asset, in a language suitable for the current locale.

var metadata: [AVMetadataItem]

An array of metadata items for all metadata identifiers for which a value is available.

var commonMetadata: [AVMetadataItem]

An array of metadata items for each common metadata key for which a value is available.

var availableMetadataFormats: [AVMetadataFormat]

An array of strings, each representing a metadata format that’s available to the asset.