PLVLivePictureInPictureManager

Objective-C

@interface PLVLivePictureInPictureManager : NSObject

#pragma mark - [ 属性 ]

#pragma mark 可配置项

/// 画中画恢复前的用户界面逻辑代理
@property (nonatomic, weak, nullable) id <PLVLivePictureInPictureRestoreDelegate> restoreDelegate;

/// 设置画中画开启模式,请在创建播放器前设置此属性(默认PLVLivePictureInPictureMode_AVPlayer)
@property (nonatomic, assign) PLVLivePictureInPictureMode pictureInPictureMode;

/// 画中画控件(包括播放/暂停、快进、后退)是否可见(YES 可见,NO不可见 默认 YES 可见)
@property (nonatomic, assign) BOOL pictureInPictureControlsVisible;

/// 是否允许在切换到后台时自动启动画中画,默认NO
@property (nonatomic, assign) BOOL canAutoStartPictureInPicture;

/// 画中画播放器是否正在播放正片
@property (nonatomic, assign, readonly) BOOL pictureInPicturePlayerPlaying;

/// 画中画小窗是否开启
@property (nonatomic, assign, readonly) BOOL pictureInPictureActive;

#pragma mark - [ 方法 ]

/// 单例方法
+ (instancetype)sharedInstance;

/// 停止画中画
- (void)stopPictureInPicture;

/// 检查是否支持开启画中画,ipad需要在9.0以上版本,iPhone需要在14.0以上版本
- (BOOL)checkPictureInPictureSupported;

/// 静音画中画
- (void)mute;

/// 取消静音画中画
- (void)cancelMute;

@end

Swift

class PLVLivePictureInPictureManager : NSObject

Undocumented

可配置项

  • 画中画恢复前的用户界面逻辑代理

    Declaration

    Objective-C

    @property (nonatomic, weak, nullable) id<PLVLivePictureInPictureRestoreDelegate> restoreDelegate;

    Swift

    weak var restoreDelegate: PLVLivePictureInPictureRestoreDelegate? { get set }
  • 设置画中画开启模式,请在创建播放器前设置此属性(默认PLVLivePictureInPictureMode_AVPlayer)

    Declaration

    Objective-C

    @property (nonatomic) PLVLivePictureInPictureMode pictureInPictureMode;

    Swift

    var pictureInPictureMode: PLVLivePictureInPictureMode { get set }
  • 画中画控件(包括播放/暂停、快进、后退)是否可见(YES 可见,NO不可见 默认 YES 可见)

    Declaration

    Objective-C

    @property (nonatomic) BOOL pictureInPictureControlsVisible;

    Swift

    var pictureInPictureControlsVisible: Bool { get set }
  • 是否允许在切换到后台时自动启动画中画,默认NO

    Declaration

    Objective-C

    @property (nonatomic) BOOL canAutoStartPictureInPicture;

    Swift

    var canAutoStartPictureInPicture: Bool { get set }
  • 画中画播放器是否正在播放正片

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL pictureInPicturePlayerPlaying;

    Swift

    var pictureInPicturePlayerPlaying: Bool { get }
  • 画中画小窗是否开启

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL pictureInPictureActive;

    Swift

    var pictureInPictureActive: Bool { get }

[ 方法 ]

  • 单例方法

    Declaration

    Objective-C

    + (nonnull instancetype)sharedInstance;

    Swift

    class func sharedInstance() -> Self
  • 停止画中画

    Declaration

    Objective-C

    - (void)stopPictureInPicture;

    Swift

    func stopPictureInPicture()
  • 检查是否支持开启画中画,ipad需要在9.0以上版本,iPhone需要在14.0以上版本

    Declaration

    Objective-C

    - (BOOL)checkPictureInPictureSupported;

    Swift

    func checkPictureInPictureSupported() -> Bool
  • 静音画中画

    Declaration

    Objective-C

    - (void)mute;

    Swift

    func mute()
  • 取消静音画中画

    Declaration

    Objective-C

    - (void)cancelMute;

    Swift

    func cancelMute()