beginTrimming(completionHandler:)
Puts the player view into trimming mode.
Declaration
func beginTrimming(completionHandler handler: (@Sendable (AVPlayerViewTrimResult) -> Void)? = nil)func beginTrimming() async -> AVPlayerViewTrimResultParameters
- handler:
The callback the system invokes when the user selects the Trim or Cancel button in the trimming UI.
The result passed to the closure indicates whether the user clicked the Trim or Cancel button.
Mentioned in
Discussion
An example implementation of the handler block is as follows:
@IBAction func beginTrimming(_ sender: AnyObject) {
playerView.beginTrimming { result in
if result == .okButton {
// user selected Trim button (AVPlayerViewTrimResult.okButton)...
} else {
// user selected Cancel button (AVPlayerViewTrimResult.cancelButton)...
}
}
}This method blocks until the user selects either the Trim or the Cancel button.