---
title: "init(playerLayer:)"
framework: avkit
role: symbol
role_heading: Initializer
path: "avkit/avpictureinpicturecontroller/init(playerlayer:)"
---

# init(playerLayer:)

Creates a Picture in Picture controller with a player layer.

## Declaration

```swift
convenience init?(playerLayer: AVPlayerLayer)
```

## Parameters

- `playerLayer`: The player layer from which to source the media content for the Picture in Picture controller.

## Discussion

Discussion For Picture in Picture to work correctly, maintain a strong reference to this object whether your app is running in the foreground or background. important: Before attempting to create a controller instance, verify that the current device supports Picture in Picture by calling the isPictureInPictureSupported() class method. Attempting to create a Picture in Picture controller on an unsupported device returns nil.

## See Also

### Creating a Controller

- [init(contentSource:)](avkit/avpictureinpicturecontroller/init(contentsource:).md)
