D.Khan D.Khan - 1 year ago 142
Objective-C Question

Objective-C: How to use AVPictureInPictureController

I am trying to set up picture in picture for my iPad app and I have a custom video player so I am following the sample code from: https://developer.apple.com/library/ios/samplecode/AVFoundationPiPPlayer/Introduction/Intro.html

I am implementing this in Objective-C and the second line of code below gives the error that "Property isPictureInPictureSupported not found on object of type AVPictureInPictureController.

AVPictureInPictureController *controller = [[AVPictureInPictureController alloc]init];

if (controller.isPictureInPictureSupported) {

Answer Source

isPictureInPictureSupported is a class method on AVPictureInPictureController, not an instance property. So you call it like this:

if ([AVPictureInPictureController isPictureInPictureSupported]) {