I created a page for my project with a video (2.1 Mb / 480p) that plays in a loop. The video plays on my simulator, but not when I download the application on the iPhone. I checked several posts with the same question, but so far none of the solutions have worked. What could be causing this problem? How can i solve this?
My video is stored locally. Here is the corresponding source code that plays my video:
override func viewDidAppear(animated: Bool) {
let fileUrl = NSURL(fileURLWithPath: "/Users/User/Desktop/Project_XYZ/Pultz/11005472.mp4")
playerView = AVPlayer(URL: fileUrl)
let playerLayer = AVPlayerLayer(player: playerView)
playerLayer.frame = videoContainer.frame
playerLayer.videoGravity = AVLayerVideoGravityResizeAspectFill
self.view.layer.addSublayer(playerLayer)
playerView.play()
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(WorkoutDashboardViewController.restart), name: AVPlayerItemDidPlayToEndTimeNotification, object: self.playerView.currentItem)
}
PS The video I use is a free watermark that I got from the Internet. Could this be a likely cause?
source
share