---
title: "playerViewController(_:restoreUserInterfaceForPictureInPictureStopWithCompletionHandler:)"
framework: avkit
role: symbol
role_heading: Instance Method
path: "avkit/avplayerviewcontrollerdelegate/playerviewcontroller(_:restoreuserinterfaceforpictureinpicturestopwithcompletionhandler:)"
---

# playerViewController(_:restoreUserInterfaceForPictureInPictureStopWithCompletionHandler:)

Tells the delegate when Picture in Picture is about to stop so you can restore your app’s user interface.

## Declaration

```swift
optional func playerViewController(_ playerViewController: AVPlayerViewController, restoreUserInterfaceForPictureInPictureStopWithCompletionHandler completionHandler: @escaping @Sendable (Bool) -> Void)
```

```swift
optional func playerViewControllerRestoreUserInterfaceForPictureInPictureStop(_ playerViewController: AVPlayerViewController) async -> Bool
```

## Parameters

- `playerViewController`: The player view controller.
- `completionHandler`: You must call the completion handler with a value of true to allow the system to finish restoring your app’s user interface.

## Mentioned in

Adopting Picture in Picture in a Standard Player

## Discussion

Discussion Implement this method to reestablish your playback user interface when PiP ends. The framework calls this method no matter how PiP ends, whether it’s because the user ended playback, the user tapped the button to return ongoing video playback to your app, or the video finished playing on its own.

## See Also

### Responding to Picture in Picture Life Cycle Events

- [playerViewControllerShouldAutomaticallyDismissAtPictureInPictureStart(_:)](avkit/avplayerviewcontrollerdelegate/playerviewcontrollershouldautomaticallydismissatpictureinpicturestart(_:).md)
- [playerViewControllerWillStartPictureInPicture(_:)](avkit/avplayerviewcontrollerdelegate/playerviewcontrollerwillstartpictureinpicture(_:).md)
- [playerViewControllerDidStartPictureInPicture(_:)](avkit/avplayerviewcontrollerdelegate/playerviewcontrollerdidstartpictureinpicture(_:).md)
- [playerViewController(_:failedToStartPictureInPictureWithError:)](avkit/avplayerviewcontrollerdelegate/playerviewcontroller(_:failedtostartpictureinpicturewitherror:).md)
- [playerViewControllerWillStopPictureInPicture(_:)](avkit/avplayerviewcontrollerdelegate/playerviewcontrollerwillstoppictureinpicture(_:).md)
- [playerViewControllerDidStopPictureInPicture(_:)](avkit/avplayerviewcontrollerdelegate/playerviewcontrollerdidstoppictureinpicture(_:).md)
