-4

I want to play online videos in my iOS app, I am using Swift 3 + Xcode 8. I don't want to download video data on the device, I just want it to play as soon as it gets response data. Is there any helpful tutorial for this scenario?

Scott Willeke
  • 8,884
  • 1
  • 40
  • 52
  • Based on the above question (in my previous comment), you might want to follow [this answer](https://stackoverflow.com/a/42105016/5501940) (using `AVPlayerViewController `) since `MPMoviePlayerController` is deprecated. – Ahmad F Feb 07 '18 at 07:49
  • Should rather consider https://wiki.videolan.org/LibVLC . It is for sure into ObjC but its a package. And VCL supports a lot of formats – Ganesh Somani Feb 07 '18 at 07:53

1 Answers1

0

You can use AVPlayerViewController to stream the video from your server or from third party storage(For example, from AWS or CDN Servers).

Just get the URL of Video and use the code below.

let player = AVPlayer(url: videoURL)

let playerViewController = AVPlayerViewController()
playerViewController.player = player
self.present(playerViewController, animated: true) {
    playerViewController.player?.play()
}
hardik parmar
  • 853
  • 8
  • 15