I have a desktop (macOS) application that reads video clips (.mov, .m4v, .mp4...). The application reads a video clip as an avAsset
object as follows.
import Cocoa
import AVKit
class VideoViewController: NSViewController {
var videoPlayer: AVPlayer!
var videoURL: URL?
var videoDur: Double!
var videoFrameRate: Float!
var videoData: Data!
var naturalSize: CGSize!
var hasVideo = false
@IBOutlet weak var moviePlayer: AVPlayerView!
@IBOutlet weak var layerView: LayerView!
func readVideoClip(url: URL) {
let avAsset = AVURLAsset(url: url)
let videoTracks = avAsset.tracks(withMediaType: .video)
if videoTracks.count > 0 {
let videoTrack = videoTracks[0]
let playerItem = AVPlayerItem(asset: avAsset)
let avFrameRate = videoTrack.nominalFrameRate
videoPlayer = AVPlayer(playerItem: playerItem)
moviePlayer.player = videoPlayer
moviePlayer.isHidden = false
naturalSize = videoTrack.naturalSize
/* variables */
hasVideo = true
videoURL = url
videoDur = totalDuration
videoFrameRate = avFrameRate
}
}
}
My question is whether or not there is a way of telling whether or not the selected video clip is copy-protected. The application is already available at Mac App Store. I've submitted a software update for it. And they've rejected it by saying the following.
We found the app allows the user to select copy protected files such as .m4v and does not inform the user that the file cannot be converted/saved/revised.
It seems that AVPlayerView
has canBeginTrimming
property. And the following returns false
with a non-protected video clip.
if !moviePlayer.canBeginTrimming {
// it returns false
}
I guess an extreme measure will be to not accept the M4V format when the user selects a video clip. Thanks.