iOS Developer Library

Developer

AVFoundation Framework Reference AVMediaSelectionOption Class Reference

Options
Deployment Target:

On This Page
Language:

AVMediaSelectionOption

Inheritance


Conforms To


Import Statement


Swift

import AVFoundation

Objective-C

@import AVFoundation;

Availability


Available in iOS 5.0 and later.

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

  • mediaType mediaType Property

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

    Declaration

    Swift

    var mediaType: String! { get }

    Objective-C

    @property(nonatomic, readonly) NSString *mediaType

    Discussion

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

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 5.0 and later.

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

    Declaration

    Swift

    var mediaSubTypes: [AnyObject]! { get }

    Objective-C

    @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.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 5.0 and later.

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

    Declaration

    Swift

    func hasMediaCharacteristic(_ mediaCharacteristic: String!) -> Bool

    Objective-C

    - (BOOL)hasMediaCharacteristic:(NSString *)mediaCharacteristic

    Parameters

    mediaCharacteristic

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

    Return Value

    YEStrue if the media selection option has media with mediaCharacteristic, otherwise NOfalse.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 5.0 and later.

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

    Declaration

    Swift

    var commonMetadata: [AnyObject]! { get }

    Objective-C

    @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).

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 5.0 and later.

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

    Declaration

    Swift

    var availableMetadataFormats: [AnyObject]! { get }

    Objective-C

    @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).

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 5.0 and later.

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

    Declaration

    Swift

    func metadataForFormat(_ format: String!) -> [AnyObject]!

    Objective-C

    - (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.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 5.0 and later.

  • playable playable Property

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

    Declaration

    Swift

    var playable: Bool { get }

    Objective-C

    @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 NOfalse.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 5.0 and later.

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

    Declaration

    Swift

    var displayName: String! { get }

    Objective-C

    @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

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 7.0 and later.

  • A string suitable for display using the specified locale.

    Declaration

    Swift

    func displayNameWithLocale(_ locale: NSLocale!) -> String!

    Objective-C

    - (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

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 7.0 and later.

    See Also

    displayName

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

    Declaration

    Swift

    var extendedLanguageTag: String! { get }

    Objective-C

    @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).

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 7.0 and later.

  • locale locale Property

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

    Declaration

    Swift

    var locale: NSLocale! { get }

    Objective-C

    @property(nonatomic, readonly) NSLocale *locale

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 5.0 and later.

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

    Declaration

    Swift

    func propertyList() -> AnyObject!

    Objective-C

    - (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.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 5.0 and later.

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

    Declaration

    Swift

    func associatedMediaSelectionOptionInMediaSelectionGroup(_ mediaSelectionGroup: AVMediaSelectionGroup!) -> AVMediaSelectionOption!

    Objective-C

    - (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.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 5.0 and later.