I am building an application in Swift on Xcode 7.2
I added the video to my ViewController. Here is the code:
import UIKit import AVKit import AVFoundation class GymViewController: UIViewController { var playerViewController = AVPlayerViewController() var playerView = AVPlayer() let fileFemaleURL = NSURL(fileURLWithPath:"/Users/marienkoen/Documents/AppDevelopment/ROZsport/ROZsport/GymFemale-2434.m4v") override func viewDidLoad() { super.viewDidLoad() } @IBAction func playButtonPressed(sender: AnyObject) { playerView = AVPlayer(URL: fileFemaleURL) playerViewController.player = playerView self.presentViewController(playerViewController, animated: true){ self.playerViewController.player?.play() }
I can play this video when I run the application in the simulator, but it will not work on a real device. What am I missing here?
source share