PHImageManager requestPlayerItem returning error code 257, no permission to view

I am requesting videos using using PHImageManager. For some I get status .readyToPlay, but for others I get status .failed, and error code 257.

As I open the assets on Photos, go back to my app, then I am able to play those assets. What am I missing?

The request:
Code Block
PHImageManager.requestPlayerItem(forVideo: asset, options: options) {
avPlayerItem, dictionary in
guard avPlayerItem != nil else {
return
}
self.avPlayerItem = playerItem
self.avPlayerItem?.addObserver(self, forKeyPath: #keyPath(AVPlayerItem.status), options: [.old, .new], context: &self.playerItemContext)
self.avPlayer = AVPlayer(playerItem: self.avPlayerItem!)
}


The options for videos are:
Code Block    
var videoViewOptions : () -> PHVideoRequestOptions = {
    let options = PHVideoRequestOptions()
    options.version = .current
    options.isNetworkAccessAllowed = true
    options.deliveryMode = .automatic
    return options
  }


The observer:
Code Block
   override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
    guard context == &playerItemContext else {
      super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context)
      return
    }
     
    guard keyPath == #keyPath(AVPlayerItem.status) else {
      return
    }
       
    let status: AVPlayerItem.Status
     
    // Get the status change from the change dictionary
    if let statusNumber = change?[.newKey] as? NSNumber {
       
      status = AVPlayerItem.Status(rawValue: statusNumber.intValue)!
       
      completionHandler?(self)
    }
       
  }