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]]
print(selectedURL)
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?
Cheers,
Phil