So I'm trying to use a video as a background and I have a .mov
file in my app and when I run this code:
NSBundle * bundle = [NSBundle mainBundle];
NSString * urlString = [bundle pathForResource:@"movie" ofType:@"mov"];
NSURL * movieURL = [NSURL URLWithString:urlString];
if (!movieURL) {
NSLog(@"Not valid");
}
I get Not valid
in the console. I checked urlString
and it is giving me a url and I'm positive that the file is named correctly and is not in a directory.
So the file is there and is copied into the source. Not sure why this is doing this.
You want to use:
NSURL *moveiURL = [NSURL fileURLWithPath:urlString];
Better yet, use:
NSURL *moveURL = [bundle URLForResource:@"movie" withExtension:@"mov"];