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 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 simple 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 simple to trim the media to the desired time range.

Topics

Accessing the Player Object

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 controls the player view displays.

showsFrameSteppingButtons

A Boolean value that determines whether the player view displays frame stepping buttons.

showsSharingServiceButton

A Boolean value that determines whether the player view displays a sharing service button.

showsFullScreenToggleButton

A Boolean value that determines whether the player view displays a full-screen toggle button.

showsTimecodes

A Boolean value that determines whether the player view displays timecodes, if available.

contentOverlayView

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

actionPopUpButtonMenu

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

updatesNowPlayingInfoCenter

A Boolean value that indicates whether the player view controller updates the Now Playing info center.

Customizing the Video Presentation

readyForDisplay

A Boolean value that indicates whether the current player item’s first video frame is ready for display.

videoBounds

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

videoGravity

A value that determines how the player view displays video content within its bounds.

Configuring Picture in Picture Playback

allowsPictureInPicturePlayback

A Boolean value that determines whether the player view allows Picture in Picture playback.

pictureInPictureDelegate

The Picture in Picture delegate object.

AVPlayerViewPictureInPictureDelegate

A protocol that defines the methods to implement to respond to Picture in Picture playback events.

Trimming Media

Implementing Trimming (macOS)

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

canBeginTrimming

A Boolean value that indicates whether the player view can begin trimming.

- beginTrimmingWithCompletionHandler:

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

AVPlayerViewTrimResult

Constants that specify what action the user took when trimming media in a player view.

Displaying the Chapter and Title

- flashChapterNumber:chapterTitle:

Momentarily displays the provided chapter number and title in the player view.

Relationships

Inherits From

See Also

Media Playback

Adopting Picture in Picture in a Standard Player

Add Picture in Picture (PiP) playback to your app using a player view controller.

Adopting Picture in Picture in a Custom Player

Add controls to your custom player user interface to invoke Picture in Picture (PiP) playback.

Working with Interstitial Content in tvOS

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

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

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

AVPictureInPictureController

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

AVInterstitialTimeRange

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

AVNavigationMarkersGroup

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