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
-
mediaTypeproperty -
mediaSubTypesproperty -
– hasMediaCharacteristic:
Managing Metadata
-
commonMetadataproperty -
availableMetadataFormatsproperty -
– metadataForFormat:
New Methods
-
playableproperty -
localeproperty -
– associatedMediaSelectionOptionInMediaSelectionGroup: -
– propertyList
Properties
availableMetadataFormats
The metadata formats that contains metadata associated with the option. (read-only)
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.hcommonMetadata
An array of metadata items for each common metadata key for which a value is available. (read-only)
Discussion
You can filter the array of AVMetadataItem objects according to locale using metadataItemsFromArray:withLocale: or according to key using metadataItemsFromArray:withKey:keySpace:.
The following example illustrates how to obtain the name (or title) of a media selection option in the current locale.
NSArray *titles = [AVMetadataItem metadataItemsFromArray:[mediaSelectionOption commonMetadata] |
withKey:AVMetadataCommonKeyTitle keySpace:AVMetadataKeySpaceCommon]; |
if ([titles count] > 0) { |
// Try to get a title that matches one of the user's preferred languages. |
NSArray *preferredLanguages = [NSLocale preferredLanguages]; |
for (NSString *thisLanguage in preferredLanguages) { |
NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:thisLanguage]; |
NSArray *titlesForLocale = [AVMetadataItem metadataItemsFromArray:titles withLocale:locale]; |
[locale release]; |
if ([titlesForLocale count] > 0) { |
title = [[titlesForLocale objectAtIndex:0] stringValue]; |
break; |
} |
} |
// No matches in any of the preferred languages. Just use the primary title metadata we find. |
if (title == nil) { |
title = [[titles objectAtIndex:0] stringValue]; |
} |
} |
Availability
- Available in iOS 5.0 and later.
Declared In
AVMediaSelectionGroup.hlocale
The locale for which the media option was authored. (read-only)
Availability
- Available in iOS 5.0 and later.
Declared In
AVMediaSelectionGroup.hmediaSubTypes
The media sub-types of the media data associated with the option. (read-only)
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.hmediaType
The media type of the media data. (read-only)
Discussion
The value of the property might be, for example, AVMediaTypeAudio or AVMediaTypeSubtitle.
Availability
- Available in iOS 5.0 and later.
Declared In
AVMediaSelectionGroup.hplayable
Indicates whether the media selection option is playable. (read-only)
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.hInstance Methods
associatedMediaSelectionOptionInMediaSelectionGroup:
Returns a media selection option associated with the receiver in a given group.
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 in AVMediaFormat.h for a discussion of forced-only subtitles.
Availability
- Available in iOS 5.0 and later.
Declared In
AVMediaSelectionGroup.hhasMediaCharacteristic:
Returns a Boolean that indicates whether the receiver includes media a given media characteristic.
Parameters
- mediaCharacteristic
The media characteristic of interest, for example,
AVMediaCharacteristicVisual,AVMediaCharacteristicAudible, orAVMediaCharacteristicLegible.
Return Value
YES if the media selection option includes media with mediaCharacteristic, otherwise NO.
Availability
- Available in iOS 5.0 and later.
Declared In
AVMediaSelectionGroup.hmetadataForFormat:
Returns an array of AVMetadataItem objects, one for each metadata item in the container of a given 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.hpropertyList
Returns a serializable property list that’s sufficient to identify the option within its group.
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© 2011 Apple Inc. All Rights Reserved. (Last updated: 2011-10-12)