open video url in swift code example
Example: swift play video from url
import AVKit
import AVFoundation
class VideoController: UIViewController
override func viewDidLoad(){
guard let videoURL = URL(string: "VideoURL") else {
return
}
let player = AVPlayer(url: videoURL)
let playerViewController = AVPlayerViewController()
playerViewController.player = player
self.present(playerViewController, animated: true) {
playerViewController.player?.play()
}
}