Inherits from | |
Conforms to | |
Framework | /System/Library/Frameworks/AVFoundation.framework |
Availability | Available in iOS 4.0 and later. |
Declared in | AVPlayerLayer.h |
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.
player
property
+ playerLayerWithPlayer:
readyForDisplay
property
videoGravity
property
For more about Objective-C properties, see “Properties” in The Objective-C Programming Language.
The player for which the player layer displays visual output.
@property(nonatomic, retain) AVPlayer *player
AVPlayerLayer.h
Indicates whether the player is ready to be displayed. (read-only)
@property(nonatomic, readonly, getter=isReadyForDisplay) BOOL readyForDisplay
AVPlayerLayer.h
Specifies how the video is displayed within a player layer’s bounds.
@property(copy) NSString *videoGravity
The default is AVPlayerLayerVideoGravityResizeAspect
.
This property is animatable.
AVPlayerLayer.h
Returns a player layer to display the visual output of a specified player.
+ (AVPlayerLayer *)playerLayerWithPlayer:(AVPlayer *)player
The player for which the player layer displays visual output.
A player layer configured to display the visual output of player.
AVPlayerLayer.h
Last updated: 2010-05-16