I am using similar code as mentioned in MPMoviePlayerViewController
documentation. But it's not working. It says "you are not authorized..". My server is hosted on Yahoo. Url is something like this.
Code is below
NSURLCredential *credential = [[NSURLCredential alloc]
initWithUser:@"abc"
password:@"xyz"
persistence: NSURLCredentialPersistencePermanent];
NSURLProtectionSpace *protectionSpace = [[NSURLProtectionSpace alloc]
initWithHost:@"www.someurl.com"
port:80
protocol:@"http"
realm:@"tmp"
authenticationMethod:NSURLAuthenticationMethodDefault];
[[NSURLCredentialStorage sharedCredentialStorage] setDefaultCredential:credential
forProtectionSpace:protectionSpace];
[protectionSpace release];
[credential release];
MPMoviePlayerViewController *movie = [[[MPMoviePlayerViewController alloc] initWithContentURL:url] autorelease];
If this is the same as the UIWebView access you would first open up an NSURLConnection and pass the credential in the relevant delegate methods then once you get a response you cancel the connection and then start the MPMoviePlayerViewController with the connection.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With