Instance Property

canBeginTrimming

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

Declaration

var canBeginTrimming: Bool { get }

Discussion

Before calling beginTrimming(completionHandler:), check the value of this property to determine whether the player view and current media support trimming. This property returns false if trimming isn’t supported by the current controlsStyle selection, the media is content protected, or the media is served using HTTP Live Streaming.

If you’re presenting a menu item to initiate trimming, a good place to perform this check is in the validateUserInterfaceItem(_:) method of NSDocument:

override func validateUserInterfaceItem(_ item: NSValidatedUserInterfaceItem) -> Bool {
    if item.action == #selector(beginTrimming) {
        return playerView.canBeginTrimming
    }
    return super.validateUserInterfaceItem(item)
}

See Also

Trimming Media

Implementing Trimming (macOS)

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

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

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

enum AVPlayerViewTrimResult

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