首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在MPMoviePlayer中播放视频

无法在MPMoviePlayer中播放视频
EN

Stack Overflow用户
提问于 2013-11-08 21:56:16
回答 1查看 210关注 0票数 0

我需要使用"MPMoviePlayerViewController“播放视频当我从库中挑选一个视频并将其URL传递给播放器时,它播放了大约2秒并停止响应(根本没有交互),并在控制台中找到了这些行

代码语言:javascript
复制
[MPAVController] Autoplay: Enabling autoplay
[MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 0, on player: 1)
[MPAVController] Autoplay: Enabling autoplay
[MPCloudAssetDownloadController] Prioritization requested for media item ID: 0
[MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 0, on player: 1)
[MPAVController] Autoplay: _streamLikelyToKeepUp: 0 -> 1
[MPAVController] Autoplay: Disabling autoplay for pause
[MPAVController] Autoplay: Disabling autoplay
[MPAVController] Autoplay: Disabling autoplay for pause
[MPAVController] Autoplay: Disabling autoplay
[MPAVController] Autoplay: Disabling autoplay for pause
[MPAVController] Autoplay: Disabling autoplay
[MPAVController] Autoplay: Disabling autoplay
[MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 1, on player: 0)
[MPAVController] Autoplay: Enabling autoplay
[MPAVController] Autoplay: Likely to keep up or full buffer: 0
[MPAVController] Autoplay: Skipping autoplay, not enough buffered to keep up.
[MPCloudAssetDownloadController] Prioritization requested for media item ID: 0
[MPAVController] Autoplay: Likely to keep up or full buffer: 1
[MPAVController] Autoplay: Enabling autoplay
[MPAVController] Autoplay: _streamLikelyToKeepUp: 0 -> 1
[MPAVController] Autoplay: Enabling autoplay
[MPAVController] Autoplay: Likely to keep up or full buffer: 0
[MPAVController] Autoplay: Skipping autoplay, not enough buffered to keep up.
[MPAVController] Autoplay: Enabling autoplay
[MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 0, on player: 1)
[MPAVController] Autoplay: Enabling autoplay
[MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 0, on player: 1)

我已经尝试了在"stackoverflow“中找到的所有东西,但都没有用,能不能请任何人给我建议解决方案。

设备: iPad-3,版本: 6.1

请给出建议

下面是我在播放视频时使用的代码

代码语言:javascript
复制
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    NSString* mediaType = [info objectForKey:UIImagePickerControllerMediaType];

    if([mediaType isEqualToString:(NSString*)kUTTypeMovie])
    {
        [self playVideoWithURL:[info objectForKey:UIImagePickerControllerMediaURL]];
    }
}


- (void)playVideoWithURL:(NSURL*)fileURL
{
    if(!self.playerViewController)
    {
        self.playerViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:fileURL];
        [self.moviePlayerContainer addSubview:self.playerViewController.view];
        self.playerViewController.moviePlayer.scalingMode = MPMovieScalingModeNone;
        self.playerViewController.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
        [self.playerViewController.moviePlayer stop];
    }
    else
    {
        self.playerViewController.moviePlayer.contentURL = fileURL;
    }

    CGRect movieFrame = self.moviePlayerContainer.frame;
    movieFrame.origin = CGPointZero;
    self.playerViewController.view.frame = movieFrame;
}
EN

回答 1

Stack Overflow用户

发布于 2013-11-10 04:35:46

发生这种情况的原因很简单,因为该电影不是本地存储的,而是试图通过iCloud逐步下载的。

您的网络带宽(通向iCloud)无法处理该视频,因为它的要求太高。

在没有日志的情况下,您会看到如下所示的行:

可能保持或已满缓冲区的:0

这就像是来自播放器的早期警告,告诉你它很可能加载数据的速度不足以进行流畅的回放。

另一个重要的部分是这一行

为媒体项目ID请求的 MPCloudAssetDownloadController优先级:0

这一条告诉你系统正在远程下载电影。它正在努力确保其他可能的并行下载应该等待这个下载,但显然这并没有释放足够的带宽(因为没有更多的可用带宽)。

恐怕你对此无能为力。

您需要先从iCloud下载该视频,否则您需要降低其质量(重新编码)。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19860755

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档