On your Storyboard, add a "AVKit Player View Controller". Connect it with a Segue from a UIButton you put on the View Controller.
Like this:
(Xcode 8.2, Swift 3)
Like this:
import UIKit import AVKit import AVFoundation class ViewController: UIViewController { override func prepare(for segue: UIStoryboardSegue, sender: Any?) { let destination = segue.destination as! AVPlayerViewController let url = Bundle.main.url(forResource: "myMovieName", withExtension: "m4v") if let movieURL = url { destination.player = AVPlayer(url: movieURL) } } }
(Xcode 8.2, Swift 3)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.