Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Builds media playback UIs with AVKit, covering AVPlayerViewController, SwiftUI VideoPlayer, Picture-in-Picture, AirPlay, and captions.
87% 96%+9 ptsof test cases passed
Passed 22 of 23 test cases with the skill, and 20 of 23 without it.
When a user taps the restore button in a floating Picture-in-Picture window, the floating window dismisses but my main app UI doesn't restore the player view, causing the player state to hang. What delegate method must be implemented and what must be called in its completion block?
Implements playerViewController(_:restoreUserInterfaceForPictureInPictureStopWithCompletionHandler:)
3 of 3 safety checks passed
High-level media playback UI built on AVFoundation. Provides system-standard video players, Picture-in-Picture, AirPlay routing, transport controls, and subtitle/caption display. Targets Swift 6.3 / iOS 26+.
Playback apps need an audio session category and the matching background mode when they support background audio, AirPlay, or PiP.
audio value in UIBackgroundModes).playbacksetActive(true) until playback begins so you do not interrupt other
audio prematurelyimport AVFoundation
func configureAudioSessionForPlayback() {
let session = AVAudioSession.sharedInstance()
do {
try session.setCategory(.playback, mode: .moviePlayback)
} catch {
Next to this one in the catalogue, plus more from the same author.