Answers for "open video url in swift"

1

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()
    }


}
Posted by: Guest on March-06-2020

Code answers related to "Swift"

Browse Popular Code Answers by Language