AVPlayerItemLegibleOutput Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/AVFoundation.framework
Availability
Available in iOS 7.0 and later.
Declared in
AVPlayerItemOutput.h

Overview

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

Tasks

Creating a Player Item Legible Output Instance

Setting and Getting Attributed String Text Styling Settings

Configuring the Delegate

Properties

advanceIntervalForDelegateInvocation

Causes advance invocation of an assocated delegate

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

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

delegate

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

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

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

delegateQueue

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

@property (nonatomic, readonly) dispatch_queue_t delegateQueue
Discussion

This property does not support Key-value observing.

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

textStylingResolution

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

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

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

Instance Methods

init

Returns an initialized legible output object.

- init
Return Value

An initialized instance of AVPlayerItemLegibleOutput.

Discussion

This method will create a properly configured legible output instance.

initWithMediaSubtypesForNativeRepresentation:

Returns an initialized legible output object.

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

Availability
  • Available in iOS 7.0 and later.
See Also
Declared In
AVPlayerItemOutput.h

setDelegate:queue:

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

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

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

Constants

Text Style Settings

The text styling resolution to use when creating attributed strings.

NSString *const AVPlayerItemLegibleOutputTextStylingResolutionDefault;
NSString *const AVPlayerItemLegibleOutputTextStylingResolutionSourceAndRulesOnly;
Constants
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.

Declared in AVPlayerItemOutput.h.

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.

Declared in AVPlayerItemOutput.h.