title: Load Avplayer with large amount of data (decrypted output of a local file)
body: <p>Am using below code for decrypting the VideoFile.mp4(CTR/Nopadding encrypted file) and playing it in Avplayer.
  This code works for small files. But its crashing for big video files due to memory issues.</p>
  <p>How to solve this issue. Please help</p>
  <pre><code>guard let content = Bundle.main.url(forResource: &quot;videoFile&quot;, withExtension: &quot;mp4&quot;) else{
                  return
              }
   
    let vidoeData = NSData(contentsOf: content)!
              
     let vidoeDatadencrypted = vidoeData.decryptData(vidoeData as Data, withKey: aeskey.data(using: .utf8))
      
      let tmpFileURL1 = URL(fileURLWithPath:NSTemporaryDirectory()).appendingPathComponent(&quot;video&quot;).appendingPathExtension(&quot;mp4&quot;)
              let wasFileWritten1 = (try? vidoeDatadencrypted!.write(to: tmpFileURL1, options: [.atomic])) != nil
      
     if wasFileWritten1{
      let player = AVPlayer(url: tmpFileURL1)
      let playerLayer = AVPlayerLayer(player: player)
      playerLayer.frame = self.view.bounds
      self.view.layer.addSublayer(playerLayer)
      player.play()
     }
  </code></pre>
  <p>update:</p>
  <p>Able to achive this for smaller files using the above shared code.</p>
  <p>how to load avplayer with NSStream?</p>