iOS Developer Library — Prerelease

Developer

AV Foundation Framework Reference AVPlayerItemLegibleOutput Class Reference

Options
Deployment Target:

On This Page
Language:

AVPlayerItemLegibleOutput

The AVPlayerItemLegibleOutput class is a subclass of AVPlayerItemOutput that can vend media with a legible characteristic as an attributed string.

  • Returns an initialized legible output object.

    Declaration

    Objective-C

    init

    Return Value

    An initialized instance of AVPlayerItemLegibleOutput.

    Discussion

    This method will create a properly configured legible output instance.

  • Returns an initialized legible output object.

    Declaration

    Swift

    init(mediaSubtypesForNativeRepresentation subtypes: [NSNumber])

    Objective-C

    - (instancetype _Nonnull)initWithMediaSubtypesForNativeRepresentation:(NSArray<NSNumber *> * _Nonnull)subtypes

    Parameters

    subtypes

    An NSArray of NSNumber FourCC codes.

    Return Value

    An initialized instance of AVPlayerItemLegibleOutput.

    Discussion

    When creating an instance you add media subtype FourCC codes as NSNumber objects to the subtypes array to elect to receive that type as a CMSampleBufferRef instead of an attributed string. FourCC codes are converted to NSNumber objects as shown:

    1. @[ [NSNumber numberWithUnsignedInt:'tx3g'] ]

    Initializing an AVPlayerItemLegibleOutput using the init method (which is preferred) is equivalent to calling this method with an empty subtypes array, which means that all legible data, regardless of media subtype, is delivered using NSAttributedString instances in a common format.

    If a media subtype for which there is no legible data in the current player item is included in the media subtypes array, no error occurs. An AVPlayerItemLegibleOutput instance doesn’t vend closed caption data as a CMSampleBufferRef, so it is an error to include 'c608' in the media subtypes array.

    Availability

    Available in iOS 7.0 and later.

    See Also

    – init

  • A string identifier indicating the degree of text styling to be applied to attributed strings vended by the object.

    Declaration

    Swift

    var textStylingResolution: String

    Objective-C

    @property(nonatomic, copy, nonnull) NSString *textStylingResolution

    Discussion

    Valid values are described in Text Style Settings. An exception (NSInvalidArgumentException) is raised if this property is set to any other value.

    The default value is AVPlayerItemLegibleOutputTextStylingResolutionDefault, which indicates that attributed strings vended by the receiver includes the same level of styling information that would be used if the text was rendered by an instance of AVPlayerLayer.

    Availability

    Available in iOS 7.0 and later.

  • The text styling resolution to use when creating attributed strings.

    Declaration

    Swift

    let AVPlayerItemLegibleOutputTextStylingResolutionDefault: String let AVPlayerItemLegibleOutputTextStylingResolutionSourceAndRulesOnly: String

    Objective-C

    NSString *const AVPlayerItemLegibleOutputTextStylingResolutionDefault; NSString *const AVPlayerItemLegibleOutputTextStylingResolutionSourceAndRulesOnly;

    Constants

    • AVPlayerItemLegibleOutputTextStylingResolutionDefault

      AVPlayerItemLegibleOutputTextStylingResolutionDefault

      Specify this level of text styling resolution to receive attributed strings from an AVPlayerItemLegibleOutput that include the same level of styling information that AVFoundation would use itself to render text within an AVPlayerLayer. The text styling will accommodate user-level Media Accessibility settings.

      Available in iOS 7.0 and later.

    • AVPlayerItemLegibleOutputTextStylingResolutionSourceAndRulesOnly

      AVPlayerItemLegibleOutputTextStylingResolutionSourceAndRulesOnly

      This level of resolution excludes styling provided by the user-level Media Accessibility settings. You would typically use it if you wish to override the styling specified in source media. If you do this, you are strongly encouraged to allow your custom styling in turn to be overridden by user preferences for text styling that are available as Media Accessibility settings. See Media Accessibility Function Reference for more information.

      Available in iOS 7.0 and later.