1

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.

El Tomato
  • 6,479
  • 6
  • 46
  • 75
  • it might be a `hasProtectedContent` property of AVAsset class - `A Boolean value that indicates whether the asset has protected content`. https://developer.apple.com/documentation/avfoundation/avasset/1389223-hasprotectedcontent – John Sep 25 '18 at 03:51
  • @John I think you are right except that there is no way of my confirming it since I have no DRM-protected clips. Anyway, I will accept it if you submit that as a solution. – El Tomato Sep 25 '18 at 04:44

0 Answers0