0

I am using AVPlayer to play the video from AWS CloudFront server. Here is my code:

let playerItem = AVPlayerItem(url: url)
let player = AVPlayer(playerItem: playerItem)

playerViewCont.player = player

present(playerViewCont, animated: false) { [weak self] in
    self?.playerViewCont.player?.play()
}

AVPlayer playing video from url every time its present. I want to save the video locally and for that I am seeking any function or way with which I can get downloaded video by AVPlayer so I can move it to another location for later use.

Any help?

gcharita
  • 7,729
  • 3
  • 20
  • 37
Sharma
  • 21
  • 3
  • hi, check this please ! https://stackoverflow.com/questions/35479903/swift-download-a-video-from-distant-url-and-save-it-in-an-photo-album – Alexander Nikolaychuk Aug 29 '20 at 13:05
  • I am looking to get path AVPlayer save its content for playing.. I have tons of video in my app like a Facebook feed so I can't let user wait for its download.. – Sharma Aug 29 '20 at 13:11
  • it is relate to how do you save file. In the moment of save, you need to define a link. Like in the example below – Alexander Nikolaychuk Aug 29 '20 at 13:15
  • I don't think you can touch the raw data managed by AVKit. So you may need to download it yourself. Or find another more efficient way to achieve your goal. – congnd Aug 29 '20 at 14:19
  • If I download a videos in chunks(Data), Is AVPlayer can play this? – Sharma Aug 30 '20 at 12:29

0 Answers0