Class

AVMetadataItem

A metadata item associated with an audiovisual asset or one of its tracks.

Declaration

@interface AVMetadataItem : NSObject

Overview

To effectively use AVMetadataItem, you need to understand how AVFoundation organizes metadata. To simplify finding and filtering metadata items, the framework groups related metadata into key spaces:

  • Format-specific key spaces. The framework defines a number of format-specific key spaces. They roughly correlate to a particular container or file format, such as QuickTime (Quicktime Metadata and User Data) or MP3 (ID3). However, a single asset may contain metadata values across multiple key spaces. To retrieve an asset's complete collection of format-specific metadata, you use its metadata property.

  • Common key space. There are a number of common metadata values, such as a movie’s creation date or description, that can exist across multiple key spaces. To help normalize access to this common metadata, the framework provides a common key space that gives access to a limited set of metadata values common to several key spaces. This makes it easy to retrieve commonly used metadata without concern for the specific format. To retrieve an asset’s collection of common metadata, you use its commonMetadata property.

Metadata items have keys that accord with the specification of the container format from which they’re drawn. Full details of the metadata formats, metadata keys, and metadata key spaces supported by AVFoundation are available in AVMetadataKeySpace and AVMetadataKey.

To load values of a metadata item “lazily,” you use the methods from the AVAsynchronousKeyValueLoading protocol (see Asynchronous Loading). The AVAsset class and other classes in turn provide their metadata lazily so that you can obtain objects from those arrays without incurring overhead for items you don’t ultimately inspect.

To filter arrays of metadata items, you use the methods of this class. For example, you can filter by key and key space, by locale, and by preferred language.

Topics

Creating Metadata Items

+ metadataItemWithPropertiesOfMetadataItem:valueLoadingHandler:

Creates a metadata item intended for optional display purposes.

Getting Keys and Key Spaces

key

The key of the metadata item.

keySpace

The key space for the metadata item’s key.

AVMetadataKeySpace

A value that defines a metadata key space.

commonKey

The common key of the metadata item.

AVMetadataKey

A value that specifies a type of metadata

Asynchronous Loading

- loadValuesAsynchronouslyForKeys:completionHandler:

Tells the receiver to load the values of any of the specified keys that are not already loaded.

- statusOfValueForKey:error:

Reports whether the value for a given key is immediately available without blocking.

Accessing Metadata Values

value

The value of the metadata item.

time

The timestamp of the metadata item.

duration

The duration of the metadata item.

locale

The locale of the metadata item.

dataValue

The raw bytes of the value for the metadata item.

extraAttributes

The additional attributes supplied by the metadata item.

AVMetadataExtraAttributeKey

A value that defines extra attribute keys.

dataType

The data type of the metadata item's value.

extendedLanguageTag

The IETF BCP 47 (RFC 4646) language identifier of the metadata item.

startDate

The start date of the timed metadata.

+ identifierForKey:keySpace:

Provides the metadata identifier that’s equivalent to a key and key space.

AVMetadataKeySpace

A value that defines a metadata key space.

identifier

The identifier of the metadata item.

+ keyForIdentifier:

Returns the metadata key associated with the identifier.

+ keySpaceForIdentifier:

Returns the metadata key space associated with the identifier.

AVMetadataIdentifier

A value that defines the metadata identifiers for different file formats.

Retrieving Formatted Metadata

stringValue

The value of the metadata item formatted as a string.

numberValue

The value of the metadata item formatted as a number.

dateValue

The value of the metadata item formatted as a date.

Filtering Arrays of Metadata Items

+ metadataItemsFromArray:withKey:keySpace:

Provides an array of metadata items that match a specified key or key space.

AVMetadataKeySpace

A value that defines a metadata key space.

+ metadataItemsFromArray:withLocale:

Provides an array of metadata items that match a specified locale.

+ metadataItemsFromArray:filteredAndSortedAccordingToPreferredLanguages:

Provides the subset of metadata items whose locales match one of the specified language identifiers.

+ metadataItemsFromArray:filteredByMetadataItemFilter:

Filters an array of metadata items using the metadata item filter.

+ metadataItemsFromArray:filteredByIdentifier:

Filters an array of metadata items according to the supplied identifier.

AVMetadataIdentifier

A value that defines the metadata identifiers for different file formats.

Relationships

Inherits From

See Also

Metadata Manipulation

Finding Metadata Values

Retrieve and filter all of the metadata associated with an asset.

JavaScript Object Notation (JSON) Chapter Format for HTTP Live Streaming

Understand the JSON chapter formatting required for HTTP Live Streaming.

AVMetadataGroup

A collection of metadata items associated with a timeline segment.

AVMetadataItemFilter

An object that filters selected information from a metadata item.

AVMetadataItemValueRequest

An object used to respond to a request to load the value of a metadata item.

AVMutableMetadataItem

A mutable metadata item associated with an audiovisual asset or with one of its tracks.

AVDateRangeMetadataGroup

A collection of metadata items that are valid for use within a specific date range.

AVMutableDateRangeMetadataGroup

A mutable collection of metadata items that are valid for use within a specific range of dates.

AVTimedMetadataGroup

A collection of metadata items that are valid for use during a specific time range.

AVMutableTimedMetadataGroup

A mutable collection of metadata items that are valid for use during a specific time range.

AVMetadataFormat

A value that defines a metadata format.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software