在我的应用中,我需要从共享点网站流式传输视频。我正在使用MPMoviePlayer控制器进行视频流传输。但我得到一个黑屏,出现以下错误:
播放失败,错误说明:
错误域= MediaPlayerErrorDomain代码= -11800“操作无法完成”UserInfo = 0xbba7b90 {NSLocalizedDescription =操作无法完成}
这个错误是什么意思?我可以知道这是否是身份验证问题。或者共享点网站的问题。
NSURL *streamURL=[NSURL URLWithString:filePath];
credential = [[NSURLCredential alloc]
initWithUser: UserName
password: Password
persistence: NSURLCredentialPersistencePermanent];
protectionSpace = [[NSURLProtectionSpace alloc]
initWithHost:host
port:port
protocol: @"https"
realm:realm
authenticationMethod:NSURLAuthenticationMethodDefault];
[[NSURLCredentialStorage sharedCredentialStorage]
setDefaultCredential: credential
forProtectionSpace: protectionSpace];
NSLog(@"streamURL = %@",streamURL);
_streamPlayer = [[MPMoviePlayerController alloc] init];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleMPMoviePlayerPlaybackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:nil];
[_streamPlayer.view setFrame:CGRectMake(0, 0, self.documentView.frame.size.width, self.documentView.frame.size.height)];
_streamPlayer.shouldAutoplay=YES;
_streamPlayer.controlStyle = MPMovieControlStyleDefault;
_streamPlayer.movieSourceType=MPMovieSourceTypeStreaming;
[_streamPlayer setContentURL:streamURL];
[_streamPlayer prepareToPlay];
[_streamPlayer play];