iOS Reference Library Apple Developer
Search

AVPlayerLayer Class Reference

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

Overview

AVPlayerLayer is a subclass of CALayer to which an AVPlayer object can direct its visual output.

You can create arbitrary numbers of player layers with the same AVPlayer object. You can create a layer as illustrated in the following code fragment:

AVPlayer *player = <#A configured AVPlayer object#>;
 
CALayer *superlayer = <#Get a CALayer#>;
AVPlayerLayer *playerLayer = [AVPlayerLayer playerLayerWithPlayer:player];
[superlayer addSublayer:playerLayer];

The value for the contents key of a player layer is opaque and effectively read-only.

During playback, AVPlayer may compensate for temporal drift between its visual output and its audible output to one or more independently-clocked audio output devices by adjusting the timing of its associated player layers. The effects of these adjustments are usually very small; however, clients that wish to remain entirely unaffected by such adjustments may wish to place other layers for which timing is important into independently timed subtrees of their layer trees.

Tasks

Miscellaneous

Properties

For more about Objective-C properties, see “Properties” in The Objective-C Programming Language.

player

The player for which the player layer displays visual output.

@property(nonatomic, retain) AVPlayer *player

Discussion

Availability
  • Available in iOS 4.0 and later.
Declared In
AVPlayerLayer.h

readyForDisplay

Indicates whether the player is ready to be displayed. (read-only)

@property(nonatomic, readonly, getter=isReadyForDisplay) BOOL readyForDisplay

Discussion

Availability
  • Available in iOS 4.0 and later.
Declared In
AVPlayerLayer.h

videoGravity

Specifies how the video is displayed within a player layer’s bounds.

@property(copy) NSString *videoGravity

Discussion

The default is AVPlayerLayerVideoGravityResizeAspect.

This property is animatable.

Availability
  • Available in iOS 4.0 and later.
Declared In
AVPlayerLayer.h

Class Methods

playerLayerWithPlayer:

Returns a player layer to display the visual output of a specified player.

+ (AVPlayerLayer *)playerLayerWithPlayer:(AVPlayer *)player

Parameters
player

The player for which the player layer displays visual output.

Return Value

A player layer configured to display the visual output of player.

Discussion

Availability
  • Available in iOS 4.0 and later.
Declared In
AVPlayerLayer.h



Last updated: 2010-05-16

Did this document help you? Yes It's good, but... Not helpful...