Mac Developer Library

Developer

AVKit Framework Reference AVPlayerView Class Reference

Options
Deployment Target:

On This Page
Language:

AVPlayerView

The AVPlayerView class is a subclass of the NSView class that is used to to display and playback the visual content of an AVPlayer object using the standard playback controls. More...

Inheritance


Import Statement


import AVKit @import AVKit;

Availability


Available in OS X v10.9 and later.
  • player player Property

    The AVPlayer instance that provides the media content for the view.

    Declaration

    Swift

    var player: AVPlayer!

    Objective-C

    @property AVPlayer *player

    Import Statement

    import AVKit

    Availability

    Available in OS X v10.9 and later.

  • The player view’s control style.

    Declaration

    Swift

    var controlsStyle: AVPlayerViewControlsStyle

    Objective-C

    @property AVPlayerViewControlsStyle controlsStyle

    Discussion

    The playback view can have a number of different control styles for the playback view. See AVPlayerViewControlsStyle for the possible values.

    In addition, the showsFrameSteppingButtons property also will determine the playback view user interface.

    Import Statement

    import AVKit

    Availability

    Available in OS X v10.9 and later.

  • Whether to display frame stepping buttons in the player view, rather than scrubbing controls.

    Declaration

    Swift

    var showsFrameSteppingButtons: Bool

    Objective-C

    @property BOOL showsFrameSteppingButtons

    Discussion

    When YEStrue, the scrubbing controls in the playback UI are replaced with with frame stepping buttons.

    The default value is NOfalse.

    Import Statement

    import AVKit

    Availability

    Available in OS X v10.9 and later.

  • Whether the sharing service button is displayed.

    Declaration

    Swift

    var showsSharingServiceButton: Bool

    Objective-C

    @property BOOL showsSharingServiceButton

    Discussion

    When YEStrue, the sharing service button is displayed.

    Import Statement

    import AVKit

    Availability

    Available in OS X v10.9 and later.

  • A Boolean property that determines if the full screen toggle button is displayed.

    Declaration

    Swift

    var showsFullScreenToggleButton: Bool

    Objective-C

    @property BOOL showsFullScreenToggleButton

    Import Statement

    import AVKit

    Availability

    Available in OS X v10.9 and later.

  • Specifies an action pop-up button menu that is displayed by the player view.

    Declaration

    Swift

    var actionPopUpButtonMenu: NSMenu!

    Objective-C

    @property NSMenu *actionPopUpButtonMenu

    Discussion

    Clients can set this property in order to show an action pop-up button.

    Default is nil.

    Import Statement

    import AVKit

    Availability

    Available in OS X v10.9 and later.

  • A Boolean property that specifies if the current player view media can be trimmed. (read-only)

    Declaration

    Swift

    var canBeginTrimming: Bool { get }

    Objective-C

    @property(readonly) BOOL canBeginTrimming

    Import Statement

    import AVKit

    Availability

    Available in OS X v10.9 and later.

  • Sets the player view’s controls panel into trimming mode.

    Declaration

    Swift

    func beginTrimmingWithCompletionHandler(_ handler: ((AVPlayerViewTrimResult) -> Void)!)

    Objective-C

    - (void)beginTrimmingWithCompletionHandler:(void (^)(AVPlayerViewTrimResult result))handler

    Parameters

    handler

    The block is executed when the user selects either the Trim or the Cancel button in the trimming UI.

    The argument passed in is AVPlayerViewTrimOKButton if the user chose the Trim button or AVPlayerViewTrimCancelButton if the user chose the Cancel button.

    Discussion

    An example of the handler block is as follows:

    • [playerView beginTrimmingWithCompletionHandler:^(NSInteger result) {
    • if (result == AVPlayerViewTrimOKButton)
    • {
    • // user selected Trim button...
    • }
    • else
    • {
    • // user selected Cancel button...
    • }
    • }

    This method blocks until the user selects either the Trim or the Cancel button.

    Import Statement

    import AVKit

    Availability

    Available in OS X v10.9 and later.

  • Displays the provided chapter number and title momentarily in the player view.

    Declaration

    Swift

    func flashChapterNumber(_ chapterNumber: Int, chapterTitle chapterTitle: String!)

    Objective-C

    - (void)flashChapterNumber:(NSUInteger)chapterNumber chapterTitle:(NSString *)chapterTitle

    Parameters

    chapterNumber

    The chapter number.

    chapterTitle

    The chapter title. This value is optional and can be nil.

    Import Statement

    import AVKit

    Availability

    Available in OS X v10.9 and later.

  • Constants that specify which, if any, controls are displayed for the player view. See controlsStyle for more information.

    Declaration

    Swift

    enum AVPlayerViewControlsStyle : Int { case None case Inline case Floating case Minimal }

    Objective-C

    enum { AVPlayerViewControlsStyleNone, AVPlayerViewControlsStyleInline, AVPlayerViewControlsStyleFloating, AVPlayerViewControlsStyleMinimal, AVPlayerViewControlsStyleDefault = AVPlayerViewControlsStyleInline }; typedef NSInteger AVPlayerViewControlsStyle;

    Constants

    • None

      AVPlayerViewControlsStyleNone

      No controls pane is associated with the view.

      Available in OS X v10.9 and later.

    • Inline

      AVPlayerViewControlsStyleInline

      The inline controls pane is associated with the view.

      Available in OS X v10.9 and later.

    • Floating

      AVPlayerViewControlsStyleFloating

      The floating controls pane is associated with the view.

      Available in OS X v10.9 and later.

    • Minimal

      AVPlayerViewControlsStyleMinimal

      The minimal controls pane is associated with the view.

      Available in OS X v10.9 and later.

    • AVPlayerViewControlsStyleDefault

      AVPlayerViewControlsStyleDefault

      The default control style, which is AVPlayerViewControlsStyleInline.

      Available in OS X v10.9 and later.

    Import Statement

    import AVKit

    Availability

    Available in OS X v10.9 and later.

  • Constants that specify what the user’s action was when trimming the media in a player view. See canBeginTrimming for more information.

    Declaration

    Swift

    enum AVPlayerViewTrimResult : Int { case OKButton case CancelButton }

    Objective-C

    enum { AVPlayerViewTrimOKButton, AVPlayerViewTrimCancelButton }; typedef NSInteger AVPlayerViewTrimResult;

    Constants

    • OKButton

      AVPlayerViewTrimOKButton

      The user selected the Trim button.

      Available in OS X v10.9 and later.

    • CancelButton

      AVPlayerViewTrimCancelButton

      The user selected the Cancel button.

      Available in OS X v10.9 and later.

    Import Statement

    import AVKit

    Availability

    Available in OS X v10.9 and later.