iOS Developer Library

Developer

AVFoundation Framework Reference AVPlayerItemLegibleOutput Class Reference

Options
Deployment Target:

On This Page
Language:

AVPlayerItemLegibleOutput

Inheritance


Conforms To


Import Statement


Swift

import AVFoundation

Objective-C

@import AVFoundation;

Availability


Available in iOS 7.0 and later.

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: [AnyObject]!)

    Objective-C

    - (instancetype)initWithMediaSubtypesForNativeRepresentation:(NSArray *)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:

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

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

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

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 7.0 and later.

  • delegate delegate Property

    The delegate of the output class. (read-only)

    Declaration

    Swift

    var delegate: AVPlayerItemLegibleOutputPushDelegate! { get }

    Objective-C

    @property(nonatomic, readonly) id< AVPlayerItemLegibleOutputPushDelegate > delegate

    Discussion

    Because the delegate is held using a zeroing-weak reference, this property has a value of nil after a delegate that was previously set has been deallocated.

    This property does not support Key-value observing.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 7.0 and later.

  • Causes advance invocation of an assocated delegate

    Declaration

    Swift

    var advanceIntervalForDelegateInvocation: NSTimeInterval

    Objective-C

    @property(nonatomic, readwrite) NSTimeInterval advanceIntervalForDelegateInvocation

    Discussion

    If possible, an AVPlayerItemLegibleOutput instance messages its delegate advanceIntervalForDelegateInvocation seconds earlier than it otherwise would.

    If the value provided is large, the delegate methods are invoked as soon as possible.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 7.0 and later.

  • The dispatch queue on which the delegate is called. (read-only)

    Declaration

    Swift

    var delegateQueue: dispatch_queue_t! { get }

    Objective-C

    @property(nonatomic, readonly) dispatch_queue_t delegateQueue

    Discussion

    This property does not support Key-value observing.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 7.0 and later.

  • Sets the receiver's delegate and a dispatch queue on which the delegate is called.

    Declaration

    Swift

    func setDelegate(_ delegate: AVPlayerItemLegibleOutputPushDelegate!, queue delegateQueue: dispatch_queue_t!)

    Objective-C

    - (void)setDelegate:(id<AVPlayerItemLegibleOutputPushDelegate>)delegate queue:(dispatch_queue_t)delegateQueue

    Parameters

    delegate

    An object conforming to the AVPlayerItemLegibleOutputPushDelegate protocol.

    delegateQueue

    A dispatch queue on which all delegate methods will be called.

    Discussion

    Because the delegate is held using a zeroing-weak reference, it is safe to deallocate the delegate while the receiver still has a reference to it.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    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.