我搜索了所有类似的问题,但无能为力。这是关于https://172.16.58.100:8443/test02.mp4
使用 MPMoviePlayerController 的流式 URL。
我使用 MPMoviePlayerController 流式传输视频并在我的应用程序中播放。像这样的 URLhttp://172.16.58.100:8080/test.mp4
没问题, MPMoviePlayerController 工作正常。
但是像https://172.16.58.100:8443/test02.mp4
MPMoviePlayerController 这样的 URL 不起作用,它会返回MPMovieFinishReasonPlaybackError
。我知道这意味着 videoPlayer 初始化失败并导致MPMoviePlayerPlaybackDidFinishNotification
. 我不知道该怎么做。
我也试过这个:
NSURLCredential *credental = [[NSURLCredential alloc]initWithUser:@"tomcat"
password:@"123456"
persistence:NSURLCredentialPersistenceForSession];
NSURLProtectionSpace *protectSpace = [[NSURLProtectionSpace alloc]initWithHost:@"172.16.58.100"
port:8443
protocol:@"http"
realm:nil
authenticationMethod:NSURLAuthenticationMethodDefault];
[[NSURLCredentialStorage sharedCredentialStorage]setDefaultCredential:credental forProtectionSpace:protectSpace];
NSURL *fileURL = [NSURL URLWithString:@"https://172.16.58.100:8443/test.mp4"];
[self.moviePlayer playMovieFile:fileURL];
但它仍然显示相同的错误(初始化失败并输入 MPMoviePlayerPlaybackDidFinishNotification)
==============================
我的意思是我只想知道 MPMoviePlayerController 如何流式传输 URL,例如“https://xxx.xxx.xx.mp4”。
有什么建议吗?圣诞节快乐。