0

在我的应用程序中,我需要从共享点站点流式传输视频。我正在使用 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];
4

0 回答 0