so I am trying to edit some source code from this project source...https://github.com/ariiyu/VideoPlayerSample
So, when I simply just try to replace the video path and file it crashes and I am not sure why??
Here is one of the ViewController source code...
import UIKit
import AVFoundation
import AVKit
class SecondViewController: AVPlayerViewController {
override func viewDidLoad() {
super.viewDidLoad()
// I try to replace the string with my movie file here and crashes
let moviePath = NSBundle.mainBundle().pathForResource("hogevideo", ofType: "mp4")!
let url = NSURL(fileURLWithPath: moviePath)
let playerItem = AVPlayerItem(URL: url)
player = AVPlayer(playerItem: playerItem)
player.play()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
In iOS 8 file system structure changed thats why you are getting crash use this function to get path of video in iOS 8