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


class AVPlayerView : NSView


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 beginTrimming(completionHandler:) 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.


Providing a Playback View.

var player: AVPlayer?

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

Customizing the User Interface

var controlsStyle: AVPlayerViewControlsStyle

The player view’s controls style.

enum AVPlayerViewControlsStyle

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

var showsFrameSteppingButtons: Bool

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

var showsSharingServiceButton: Bool

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

var showsFullScreenToggleButton: Bool

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

var contentOverlayView: NSView?

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

var actionPopUpButtonMenu: NSMenu?

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

var updatesNowPlayingInfoCenter: Bool

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

Configuring Video

var isReadyForDisplay: Bool

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

var videoBounds: NSRect

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

var videoGravity: AVLayerVideoGravity

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.

var canBeginTrimming: Bool

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

func beginTrimming(completionHandler: ((AVPlayerViewTrimResult) -> Void)?)

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

enum AVPlayerViewTrimResult

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

Displaying the Chapter and Title

func flashChapterNumber(Int, chapterTitle: String?)

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

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.

Using AVKit in iOS

This sample code project demonstrates techniques for tracking AVPlayerViewController presentation state across multiple application scenarios, including being displayed fullscreen, embedded inline, or as Picture in Picture.

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.

class AVPlayerViewController

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

class AVPictureInPictureController

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

class AVRoutePickerView

An object that displays controls for picking playback routes.

class AVInterstitialTimeRange

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

class AVNavigationMarkersGroup

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