Last active
January 30, 2018 17:55
-
-
Save meyusufdemirci/735f640653e2279b23aeb91d70f881de to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import AVKit | |
class ViewController: UIViewController { | |
let playerController = AVPlayerViewController() | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// if you have a url of video | |
// let player = AVPlayer(url: URL(string: "video url")!) | |
let path = Bundle.main.path(forResource: "Mahmut Orhan - Game Of Thrones", ofType: "mp4") | |
// if you have a path of local video | |
let player = AVPlayer(url: URL(fileURLWithPath: path!)) | |
playerController.player = player | |
playerController.view.frame = CGRect(x: 0, y: 200, width: UIScreen.main.bounds.width, height: 250) | |
self.view.addSubview(playerController.view) | |
playerController.player?.play() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment