Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MPMoviePlayerController plays local file but not remote over HTTP

I have a mp4 file that as part of the app plays just fine with MPMoviePlayerController.

[_mediaPlayer setContentURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] 
                                                    pathForResource:@"movie" 
                                                    ofType:@"mp4"]]];
[_mediaPlayer play];

But once I upload the very same file to a webserver it'll give me that error:

Error Domain=MediaPlayerErrorDomain Code=2

The safari browser on the same device plays the remote movie - so the reachability is not the problem . I didn't find any Documentation about what Code 2 tells me. So I am stuck.

Anyone?

like image 400
Jakob Avatar asked Sep 09 '11 14:09

Jakob


1 Answers

You should use NSURL's URLWithString: because you aren't using a local file path. (posted as answer from comment :))

like image 83
Jesse Naugher Avatar answered Sep 24 '22 18:09

Jesse Naugher