Instance Method


Returns an array of chapters with a given title locale and containing specified keys.


func chapterMetadataGroups(withTitleLocale locale: Locale, containingItemsWithCommonKeys commonKeys: [AVMetadataKey]?) -> [AVTimedMetadataGroup]



The locale of the metadata items carrying chapter titles to be returned (the method supports the IETF BCP 47 specification of locales).


An array of common keys of AVMetadataItem to include in the returned array. AVMetadataCommonKeyArtwork is the only supported key.

Return Value

An array of AVTimedMetadataGroup objects.


Each object in the returned array contains an AVMetadataItem object representing the chapter title, and the time range property of the AVTimedMetadataGroup object is equal to the time range of the chapter title item.

An AVMetadataItem with the specified common key is added to an existing AVTimedMetadataGroup object if the time range (timestamp and duration) of the metadata item and the metadata group overlap.

The locale of items not carrying chapter titles need not match the specified locale parameter. You can filter the returned items based on locale using metadataItems(from:with:).

See Also

Using Chapter Metadata

Presenting Chapter Markers

Add chapter markers to enable users to quickly navigate your content.

var availableChapterLocales: [Locale]

The locales available for chapter metadata in the asset.

func chapterMetadataGroups(bestMatchingPreferredLanguages: [String]) -> [AVTimedMetadataGroup]

Returns an array of chapters whose locale best matches the list of preferred languages.