i am having problems with playing movie from URL that has basic http authentification.
Here is code:
NSURLCredential *credential = [[NSURLCredential alloc]
initWithUser:@"user"
password:@"password"
persistence:NSURLCredentialPersistenceForSession];
NSURLProtectionSpace *protectionSpace = [[NSURLProtectionSpace alloc]
initWithHost:@"moze.dyndns.org"
port:80
protocol:@"http"
realm:nil
authenticationMethod:NSURLAuthenticationMethodHTTPBasic];
[[NSURLCredentialStorage sharedCredentialStorage] setDefaultCredential:credential forProtectionSpace:protectionSpace];
NSURL *videoURL = [NSURL URLWithString:@"http://moze.dyndns.org/test/test.mov"];
moviePlayerController = [[MPMoviePlayerViewController alloc] initWithContentURL:videoURL];
[moviePlayerController.view setFrame:self.view.bounds];
[self.view addSubview:moviePlayerController.view];
MPMoviePlayerController *mp = [moviePlayerController moviePlayer];
mp.controlStyle = MPMovieControlStyleDefault;
[mp prepareToPlay];
[[moviePlayerController moviePlayer] play];
I am getting error "The operation couldn't be completed. (MediaPlayerErrorDomain error -1013.)", errorLog in NULL, just like accessLog too.
I am using a apache server with AuthType Basic, credentials are right, tested them on web browser. There are no problems with playback if authentification is disabled.
Please help, I can't find what is wrong.