I have a ViewController which plays a movie. If the movie was downloaded (with ASI-HTTP-Request) it takes the local version. Otherwise it streams it from the web. It's the exact same movie.
Streaming does work very well, but playing the local file does not work. Just a black screen and no controls. The file has been downloaded correctly I checked the md5 checksum.
It's a Apple QuickTime Video (.mov) at a size of 1024x5xx pixel.
player = [[MPMoviePlayerController alloc] init];
[player.view setFrame: self.view.bounds];
if (local) {
// DOES not work
// SHOULD be [NSURL fileURLWithString:...]
[player setContentURL: [NSURL URLWithString: @"/path/to/the/movie.mov"]];
} else {
// does work
[player setContentURL: [NSURL URLWithString: @"http://mydomain.tld/path/to/the/movie.mov"]];
}
[self.view addSubview: player.view];
[player play]
I tried around with the players MediaSourceType. But it didn't help. Why does it not work? I don't have any error messages because I dont receive one..., is there a way to get error messages from it?
Solution
I found my error.
I used [NSURL URLWithString: @"/the/path/..."]
for the local path.
It works with [NSURL fileURLWithPath: @"/the/path/..."]
Check URL to video file. This line return path to Documents directory.
Your path is not related to Document directory
Try this