Swift (for MacOS) Question re: AVPlayerView.beginTrimming

Hopefully someone here speaks Swift (esp. AppKit) well enough to share some insight on this.
I’ve not gotten any traction on Stack Overflow on this…

I’m trying to use AVPlayerView.beginTrimming to trim some .mov files but it isn’t working. I’ve checked the .canBeginTrimming property and it’s returning ‘false’.

The research I’ve found says: "This property’s value is false if the current controls style doesn’t support trimming, the media is content protected, or when playing HTTP Live Streaming media.

The .mov files I am using are local and I’m accessing them via their urls. They load and play properly, I just can’t enter trimming mode. (Also, if I open the same files in QuickTimePlayer I can trim them.)

Here is the relevant code, in which I’m attempting to trim:

    func tableViewSelectionDidChange(_ notification: Notification) {
        let row = movTableView.selectedRow
        guard row != -1 else { return }
        let selectedURL = movDict[allFilenames[row]]
        if let selectedURL {
            let player = AVPlayer(url: selectedURL)
            movPlayerView.player = player
            if movPlayerView.canBeginTrimming {
                print("medial player supports trimming")
            } else {
                print("media player does NOT support trimming")
            movPlayerView.beginTrimming { result in
                if result == .okButton {
                    print("trimming ended. ok pressed")
                } else {
                    print("cancel pressed.")

Anyone have any thoughts as to why I might be having this issue?


AVPlayerView can have different control layouts, I get the impression it means you need to use the default view where it looks like QuickTime player. Past that, I got no idea sorry.

Yes, I had thought of that. I think I have tried all possible player configurations. (I’ll explore again though)

Thanks @samRowlands

1 Like