iOS Developer Library

Developer

AVFoundation Framework Reference AVSynchronizedLayer Class Reference

Options
Deployment Target:

On This Page
Language:

AVSynchronizedLayer

Inheritance


Conforms To


Import Statement


Swift

import AVFoundation

Objective-C

@import AVFoundation;

Availability


Available in iOS 4.0 and later.

AVSynchronizedLayer a subclass of CALayer with layer timing that synchronizes with a specific AVPlayerItem.

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.

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];
  • Returns a new synchronized layer with timing synchronized with a given player item.

    Declaration

    Swift

    init!(playerItem playerItem: AVPlayerItem!) -> AVSynchronizedLayer

    Objective-C

    + (AVSynchronizedLayer *)synchronizedLayerWithPlayerItem:(AVPlayerItem *)playerItem

    Parameters

    playerItem

    A player item.

    Return Value

    A new synchronized layer with timing synchronized with playerItem.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 4.0 and later.

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

    Declaration

    Swift

    var playerItem: AVPlayerItem!

    Objective-C

    @property(nonatomic, retain) AVPlayerItem *playerItem

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 4.0 and later.