Class

AVPlayerView

A macOS-only object that displays the video content from a player object along with system-supplied playback controls.

Declaration

@interface AVPlayerView : NSView

Overview

The player view supports a variety of different controls styles, ranging from no controls at all to controls matching the look of QuickTime Player. This makes it easy for you to tailor the presentation to best match your use of the player view. Regardless of the selected controls style, the player view always supports a standard set of keyboard shortcuts to control playback:

  • The spacebar plays and pauses playback.

  • The right and left arrow keys step frame-by-frame through the video.

  • JKL Navigation:

    • The J key rewinds. You can press it multiple times to cycle through rewind speeds.

    • The K key stops playback.

    • The L key fast-forwards. You can press it multiple times to cycle through fast-forward speeds.

In addition to providing the core playback interface for your media applications, AVPlayerView also makes it easy to add trimming capabilities to your player. Invoking the player view’s beginTrimmingWithCompletionHandler: method presents a trimming interface like that of QuickTime Player making it easy to trim the media to the desired time range.

AVPlayerView is built with modern applications in mind and automatically supports all of the standard modern macOS features, such a localization, state restoration, full-screen playback, high-resolution display, and accessibility.

Topics

Providing a Playback View.

player

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

Customizing the User Interface

controlsStyle

The player view’s controls style.

AVPlayerViewControlsStyle

Constants that specify which, if any, controls are displayed for the player view.

showsFrameSteppingButtons

A Boolean property that determines if frame stepping buttons should be shown in the player view.

showsSharingServiceButton

A Boolean property that determines if a sharing service button is displayed.

showsFullScreenToggleButton

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

contentOverlayView

A view that adds additional custom views between the video content and the controls.

actionPopUpButtonMenu

An action pop-up button menu that is displayed by the player view.

updatesNowPlayingInfoCenter

A Boolean value that indicates whether the player view controller updates the now playing info center.

Configuring Video

readyForDisplay

A Boolean value that indicates the current player item’s first video frame has been made ready for display.

videoBounds

The current size and position of the video image as displayed within the player view's bounds.

videoGravity

A setting that determines how the video is displayed within a player view’s bounds.

Trimming Playback Content

Implementing Trimming (macOS)

Implement a QuickTime media-trimming experience in your macOS app.

canBeginTrimming

A Boolean property that specifies if the current player view’s media can be trimmed.

- beginTrimmingWithCompletionHandler:

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

AVPlayerViewTrimResult

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

Displaying the Chapter and Title

- flashChapterNumber:chapterTitle:

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

Relationships

Inherits From

See Also

Media Playback

Adopting Picture in Picture in a Standard Player

Add picture-in-picture controls to your player using a player view controller.

Adopting Picture in Picture in a Custom Player

Add picture-in-picture controls to your custom player using a picture-in-picture controller.

Working with Interstitial Content (tvOS)

Present additional content such as legal text, content warnings, or advertisements alongside your main media content.

Adopting Custom Interactive Overlays, Channel Flipping, and Parental Controls in tvOS Video Playback

This sample demonstrates support for custom interactive overlays, and parental controls, using AVPlayerViewController.

Adding Information to the Info Panel (tvOS)

Add metadata information and navigation markers to the Info panel in Apple TV.

AVPlayerViewController

An object that displays the video content from a player object along with system-supplied playback controls.

AVPictureInPictureController

A controller that responds to user-initiated playback of video in a floating, resizable window on iPad.

AVRoutePickerView

An object that displays controls for picking playback routes.

AVInterstitialTimeRange

A time range in an audiovisual presentation as interstitial content, such as advertisements or legal notices.

AVNavigationMarkersGroup

A set of markers for navigating playback of an audiovisual presentation.