我无法理解此类并使其正常工作,这是我使用它的一段代码:
MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:_videoURL];
UIImage *videoThumbnail = [moviePlayer thumbnailImageAtTime:0 timeOption:MPMovieTimeOptionNearestKeyFrame];
[lastImageView setImage:videoThumbnail];
[moviePlayer setControlStyle:MPMovieControlStyleNone];
[moviePlayer setShouldAutoplay:YES];
[moviePlayer prepareToPlay];
[moviePlayer.view setFrame:lastImageView.frame];
moviePlayer.view.transform = CGAffineTransformMakeRotation((90*M_PI)/180);
[self.view addSubview:moviePlayer.view];
[moviePlayer play];
videoThumbnail 行仍然存在的唯一原因是因为我没有播放视频,直到我只是尝试看看它是否会从那里获取图像然后它突然开始工作......有点. 现在它播放 2-3 秒,然后终止而不发送 MPMoviePlayerPlaybackDidFinishNotification 或 MPMoviePlayerPlaybackStateDidChangeNotification 我用谷歌搜索了一下,找不到任何有用的提示,有人能告诉我什么是错的或我忘记了什么