Instance Property

canBeginTrimming

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

Declaration

var canBeginTrimming: Bool { get }

Discussion

You should check the value of this property before calling beginTrimming(completionHandler:) to determine if trimming is supported by the current media. This property will return false if not supported by the current controlsStyle selection or if the media is content protected or is served using HTTP Live Streaming.

If you are 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 Playback Content

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 the user’s action was when trimming the media in a player view. See beginTrimming(completionHandler:) for more information.