Objective-C: 如何使用AVPictureInPictureController

Objective-C: How to use AVPictureInPictureController

我正在尝试为我的 iPad 应用程序设置画中画,并且我有一个自定义视频播放器,所以我遵循以下示例代码:https://developer.apple.com/library/ios/samplecode/AVFoundationPiPPlayer/Introduction/Intro.html

我在 Objective-C 中实现了这个,下面的第二行代码给出了错误“属性 isPictureInPictureSupported not found on object of type AVPictureInPictureController.

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

if (controller.isPictureInPictureSupported) {

isPictureInPictureSupportedAVPictureInPictureController 上的 class 方法 ,而不是实例 属性。所以你这样称呼它:

if ([AVPictureInPictureController isPictureInPictureSupported]) {