PSPDFMediaPlayerController


@interface PSPDFMediaPlayerController : NSObject

A simple media player used for video playback.

  • Undocumented

    Declaration

    Objective-C

    
    @interface PSPDFMediaPlayerController : NSObject
  • Undocumented

    Declaration

    Objective-C

    
    @interface PSPDFMediaPlayerController : NSObject
  • Initialize the player controller with the URL of the media file.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithContentURL:(nonnull NSURL *)contentURL;

    Swift

    init(contentURL: URL)
  • The content URL of the item that the player plays.

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic) NSURL *_Nonnull contentURL;

    Swift

    var contentURL: URL { get }
  • If an error occurred while preparing the content for playback, this will bet set.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable) NSError *contentError;

    Swift

    var contentError: Error? { get }
  • Starts playing the media.

    Declaration

    Objective-C

    - (void)play;

    Swift

    func play()
  • Pauses the media.

    Declaration

    Objective-C

    - (void)pause;

    Swift

    func pause()
  • Pauses all instances of this class.

    Declaration

    Objective-C

    + (void)pauseAllInstances;

    Swift

    class func pauseAllInstances()
  • Seek to time.

    Declaration

    Objective-C

    - (void)seekToTime:(CMTime)time;

    Swift

    func seek(to time: CMTime)
  • Indicates if the player did finish playing the entire video.

    Declaration

    Objective-C

    @property (readonly, nonatomic) BOOL didFinishPlaying;

    Swift

    var didFinishPlaying: Bool { get }
  • If the media is currently playing, this returns YES.

    Declaration

    Objective-C

    @property (readonly, getter=isPlaying, nonatomic) BOOL playing;

    Swift

    var isPlaying: Bool { get }
  • Indicates if the player uses external playback.

    Declaration

    Objective-C

    @property (readonly, getter=isExternalPlaybackActive, nonatomic)
        BOOL externalPlaybackActive;

    Swift

    var isExternalPlaybackActive: Bool { get }
  • The current state of the content.

    Declaration

    Objective-C

    @property (readonly, nonatomic)
        PSPDFMediaPlayerControllerContentState contentState;

    Swift

    var contentState: PSPDFMediaPlayerControllerContentState { get }
  • The cover mode.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) PSPDFMediaPlayerCoverMode coverMode;

    Swift

    var coverMode: PSPDFMediaPlayerCoverMode { get set }
  • The URL of the cover image to be displayed. Only effective if coverMode is set to PSPDFMediaPlayerCoverModeCustom.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic, nullable) NSURL *coverImageURL;

    Swift

    var coverImageURL: URL? { get set }
  • The time in the video at which the image for the cover is captured. Only effective if coverMode is set to PSPDFMediaPlayerCoverModePreview. Defaults to 2 seconds.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CMTime coverImagePreviewCaptureTime;

    Swift

    var coverImagePreviewCaptureTime: CMTime { get set }
  • The player’s delegate.

    Declaration

    Objective-C

    @property (readwrite, nonatomic)
        id<PSPDFMediaPlayerControllerDelegate> _Nullable delegate;

    Swift

    @IBOutlet weak var delegate: PSPDFMediaPlayerControllerDelegate? { get set }
  • Set this to YES if you want to hide the toolbar. This property might be ignored if it is set to NO in case the PSPDFMediaPlayerCoverView is visible. Use view.toolbar.hidden to access the actual visibility state of the toolbar. Normally you don’t need to change this property yourself because PSPDFMediaPlayerController handles it for you. Defaults to YES.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL shouldHideToolbar;

    Swift

    var shouldHideToolbar: Bool { get set }
  • Set this to YES if you want to hide the toolbar. This might be ignored if it is set to NO in case the PSPDFMediaPlayerCoverView is visible. Use view.toolbar.hidden to access the actual visibility state of the toolbar. Normally you don’t need to change this property yourself because PSPDFMediaPlayerController handles it for you. - parameter: animated BOOL indicating whether to hide the toolbar animated.

    Declaration

    Objective-C

    - (void)setShouldHideToolbar:(BOOL)shouldHideToolbar animated:(BOOL)animated;

    Swift

    func setShouldHideToolbar(_ shouldHideToolbar: Bool, animated: Bool)

    Parameters

    animated

    BOOL indicating whether to hide the toolbar animated.

  • Indicates that the player has started playing, although it might not be playing right now. Defaults to NO.

    Declaration

    Objective-C

    @property (readonly, nonatomic) BOOL didStartPlaying;

    Swift

    var didStartPlaying: Bool { get }
  • The tap gesture recognizer used for toggling the toolbar.

    Declaration

    Objective-C

    @property (readonly, nonatomic)
        UITapGestureRecognizer *_Nonnull tapGestureRecognizer;

    Swift

    var tapGestureRecognizer: UITapGestureRecognizer { get }
  • Enables playback looping. Defaults to NO.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL loopEnabled;

    Swift

    var loopEnabled: Bool { get set }
  • Uses external playback automatically while an external screen is active. Defaults to YES.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic)
        BOOL usesExternalPlaybackWhileExternalScreenIsActive;

    Swift

    var usesExternalPlaybackWhileExternalScreenIsActive: Bool { get set }
  • The control style of the media player. Defaults to PSPDFMediaPlayerControlStyleDefault.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic)
        PSPDFMediaPlayerControlStyle controlStyle;

    Swift

    var controlStyle: PSPDFMediaPlayerControlStyle { get set }
  • The range of the video that should be played. You can use this property to truncate parts of the video at the start or at the end. Defaults to a range with start kCMTimeZero, and duration kCMTimeIndefinite, which means that the entire video will be played from start to end. - note: You must set this property before playback starts, otherwise it will have no effect.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CMTimeRange playableRange;

    Swift

    var playableRange: CMTimeRange { get set }
  • The internally used player. The AVPlayer in use might change during the lifecycle of an PSPDFMediaPlayerController! Use with caution!

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable) AVPlayer *internalPlayer;

    Swift

    var internalPlayer: AVPlayer? { get }