AVMediaSelectionOption Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/AVFoundation.framework
Availability
Available in iOS 5.0 and later.
Companion guide
Declared in
AVMediaSelectionGroup.h

Overview

An AVMediaSelectionOption object represents a specific option for the presentation of media within a group of options.

Tasks

Managing Media Types

Managing Metadata

Selection Playable Status

Language and Locale Settings

Property List Serialization

Getting the Associated Media Selection Option

Properties

availableMetadataFormats

The metadata formats that contains metadata associated with the option. (read-only)

@property(nonatomic, readonly) NSArray *availableMetadataFormats
Discussion

The array contains NSString objects, each representing a metadata format that contains metadata associated with the option (for example, ID3, iTunes metadata, and so on).

Availability
  • Available in iOS 5.0 and later.
Declared In
AVMediaSelectionGroup.h

commonMetadata

An array of metadata items for each common metadata key for which a value is available. (read-only)

@property(nonatomic, readonly) NSArray *commonMetadata
Discussion

You can filter the array of AVMetadataItem objects according to locale using metadataItemsFromArray:withLocale:, key using metadataItemsFromArray:withKey:keySpace:, or language using metadataItemsFromArray:filteredAndSortedAccordingToPreferredLanguages:.

Clients that are filtering media selection options by language should be prepared to handle cases in which the extendedLanguageTag property value is nil. Further, they should be prepared to handle cases in which an extendedLanguageTag is present but indicates that the language is “undetermined” (a language value of @"und", as defined in ISO 639-2).

Availability
  • Available in iOS 5.0 and later.
Declared In
AVMediaSelectionGroup.h

displayName

A string suitable for display using the current system locale. (read-only)

@property(nonatomic, readonly) NSString *displayName
Discussion

The string will take into account this option's common metadata, media characteristics and locale properties in addition to the provided locale to formulate a stringintended for display

Availability
  • Available in iOS 7.0 and later.
Declared In
AVMediaSelectionGroup.h

extendedLanguageTag

The IETF BCP 47 language tag associated with the option (read-only)

@property(nonatomic, readonly) NSString *extendedLanguageTag
Discussion

This property may be nil indicating that the underlying media presented when the option is selected carries no language information. This can occur with media formats for which language information is optional, such as HTTP Live Streaming playlists, or that do not accommodate language information in machine-readable form.

Clients that are filtering media selection options by language should be prepared to handle cases in which this value is nil. Further, they should be prepared to handle cases in which an extendedLanguageTag is present but indicates that the language is “undetermined” (a language value of @"und", as defined in ISO 639-2).

Availability
  • Available in iOS 7.0 and later.
Declared In
AVMediaSelectionGroup.h

locale

The locale for which the media option was authored. (read-only)

@property(nonatomic, readonly) NSLocale *locale
Availability
  • Available in iOS 5.0 and later.
Declared In
AVMediaSelectionGroup.h

mediaSubTypes

The media sub-types of the media data associated with the option. (read-only)

@property(nonatomic, readonly) NSArray *mediaSubTypes
Discussion

The value is an array of NSNumber objects carrying four character codes (of type FourCharCode) as defined in CoreAudioTypes.h for audio media and in CMFormatDescription.h for video media.

Also see CMFormatDescriptionGetMediaSubType for more information about media subtypes.

Availability
  • Available in iOS 5.0 and later.
Declared In
AVMediaSelectionGroup.h

mediaType

The media type of the media data. (read-only)

@property(nonatomic, readonly) NSString *mediaType
Discussion

The value of the property might be, for example, AVMediaTypeAudio or AVMediaTypeSubtitle.

Availability
  • Available in iOS 5.0 and later.
Declared In
AVMediaSelectionGroup.h

playable

Indicates whether the media selection option is playable. (read-only)

@property(nonatomic, readonly, getter=isPlayable) BOOL playable
Discussion

If the media data associated with the option cannot be decoded or otherwise rendered, the value of this property is NO.

Availability
  • Available in iOS 5.0 and later.
Declared In
AVMediaSelectionGroup.h

Instance Methods

associatedMediaSelectionOptionInMediaSelectionGroup:

Returns a media selection option associated with the receiver in a given group.

- (AVMediaSelectionOption *)associatedMediaSelectionOptionInMediaSelectionGroup:(AVMediaSelectionGroup *)mediaSelectionGroup
Parameters
mediaSelectionGroup

A media selection group in which an associated option is to be sought.

Return Value

A media selection option associated with the receiver in mediaSelectionGroup, or nil if none were found.

Discussion

Audible media selection options often have associated legible media selection options; in particular, audible options are typically associated with forced-only subtitle options with the same locale. See AVMediaCharacteristicContainsOnlyForcedSubtitles for a discussion of forced-only subtitles.

Availability
  • Available in iOS 5.0 and later.
Declared In
AVMediaSelectionGroup.h

displayNameWithLocale:

A string suitable for display using the specified locale.

- (NSString *)displayNameWithLocale:(NSLocale *)locale
Parameters
locale

The locale to use in generating the display name.

Return Value

A string containing the localized display name.

Discussion

The string will take into account this option's common metadata, media characteristics and locale properties in addition to the provided locale to formulate a stringintended for display

Availability
  • Available in iOS 7.0 and later.
Declared In
AVMediaSelectionGroup.h

hasMediaCharacteristic:

Returns a Boolean that indicates whether the receiver has media a given media characteristic.

- (BOOL)hasMediaCharacteristic:(NSString *)mediaCharacteristic
Parameters
mediaCharacteristic

The media characteristic of interest, for example, AVMediaCharacteristicVisual, AVMediaCharacteristicAudible, or AVMediaCharacteristicLegible.

Return Value

YES if the media selection option has media with mediaCharacteristic, otherwise NO.

Availability
  • Available in iOS 5.0 and later.
Declared In
AVMediaSelectionGroup.h

metadataForFormat:

Returns an array of AVMetadataItem objects, one for each metadata item in the container of a given format.

- (NSArray *)metadataForFormat:(NSString *)format
Parameters
format

The metadata format for which items are requested.

Return Value

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

Availability
  • Available in iOS 5.0 and later.
Declared In
AVMediaSelectionGroup.h

propertyList

Returns a serializable property list that’s sufficient to identify the option within its group.

- (id)propertyList
Return Value

A serializable property list that you can use to obtain an instance of AVMediaSelectionOption representing the same option as the receiver using mediaSelectionOptionWithPropertyList:.

Discussion

You can serialize the returned property list using NSPropertyListSerialization.

Availability
  • Available in iOS 5.0 and later.
Declared In
AVMediaSelectionGroup.h