An object used to synchronize with a specific player item.


class AVSynchronizedLayer : CALayer


You can create an arbitrary number of synchronized layers from the same AVPlayerItem object.

A synchronized layer is similar to a CATransformLayer object in that it doesn't display anything itself, it just confers state upon its layer subtree. AVSynchronizedLayer confers its timing state, synchronizing the timing of layers in its subtree with that of a player item.

Any CoreAnimation layer with animation property set that is added as a sublayer of AVSynchronizedLayer should set the animation's beginTime property to a non-zero positive value so animations will be interpreted on the player item's timeline. CoreAnimation replaces the default beginTime of 0.0 with CACurrentMediaTime(). To start the animation from time 0, use a small positive value like AVCoreAnimationBeginTimeAtZero.

You might use a layer as shown in the following example:

AVPlayerItem *playerItem = <#Get a player item#>;
CALayer *superLayer =  <#Get a layer#>;
// Set up a synchronized layer to sync the layer timing of its subtree
// with the playback of the playerItem/
AVSynchronizedLayer *syncLayer = [AVSynchronizedLayer synchronizedLayerWithPlayerItem:playerItem];
[syncLayer addSublayer:<#Another layer#>];    // These sublayers will be synchronized.
[superLayer addSublayer:syncLayer];


Creating a Synchronized Layer

init(playerItem: AVPlayerItem)

Creates a new synchronized layer with timing synchronized with a given player item.

Managing the Player Item

var playerItem: AVPlayerItem?

The player item to which the timing of the layer is synchronized.

Supporting Types

let AVCoreAnimationBeginTimeAtZero: CFTimeInterval

A value that sets an animation begin time to 0.


Inherits From

Conforms To

See Also

Media Playback

class AVPlayer

An object that provides the interface to control the player’s transport behavior.

class AVQueuePlayer

A player used to play a number of items in sequence.

class AVPlayerLayer

An object that manages a player's visual output.

class AVPlayerItem

An object used to model the timing and presentation state of an asset played by the player.

class AVPlayerItemMetadataCollector

An object used to capture the date range metadata defined for an HTTP Live Streaming asset.

class AVPlayerItemTrack

An object used to modify the presentation state of an asset track being presented by a player.

class AVPlayerMediaSelectionCriteria

An object that specifies the preferred languages and media characteristics for a player.

class AVSampleBufferAudioRenderer

An object used to decompress audio and play compressed or uncompressed audio.

class AVSampleBufferDisplayLayer

An object that displays compressed or uncompressed video frames.

class AVSampleBufferRenderSynchronizer

An object used to synchronize multiple queued sample buffers to a single timeline.

class AVRouteDetector

An object that detects the presences of media playback routes.