After following @Neelam Verma's answer or @dawid's answer, which has the same end result as @Neelam Verma's answer, difference being that @dawid's answer starts with the drag and drop of the file into the Xcode project and @Neelam Verma's answer starts with a file already a part of the Xcode project, I still could not get NSBundle.mainBundle().pathForResource("file-title", ofType:"type")
to find my video file.
I thought maybe because I had my file was in a Group nested in the Xcode project that this was the cause, so I moved the video file to the root of my Xcode project, still no luck, this was my code:
guard let path = NSBundle.mainBundle().pathForResource("testVid1", ofType:"mp4") else {
print("Invalid video path")
return
}
Originally, this was the name of my file: testVid1.MP4
, renaming the video file to testVid1.mp4
fixed my issue, so, at least the ofType
string argument is case sensitive.