MPMoviePlayerController给我一个黑色的空白视图,没有视频播放 [英] MPMoviePlayerController gives me a black empty view,no video playing

查看:71
本文介绍了MPMoviePlayerController给我一个黑色的空白视图,没有视频播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

iOS 5.1,代码如下:

iOS 5.1 ,here is the code:

 MPMoviePlayerController *player =
    [[MPMoviePlayerController alloc] initWithContentURL: [NSURL URLWithString:@"map.mp4"]];
    [player prepareToPlay];
    [player.view setFrame: self.view.bounds];  // player's frame must match parent's
    [self.view addSubview: player.view];
    // ...
    [player play];

实际上,这与苹果参考资料中所说的一样,但是当我单击该按钮以使用此功能时,只有一个黑色的矩形停留在那里,没有视频播放,没有声音,也没有暗恋,所以我想知道如何使这项工作

in fact ,this is just the same as the apple reference say,but when I click the button to use this function,there is just a black Rectangle stay there,no vedio playing ,no sound happening,and no crush,so I want to know how to make this work

推荐答案

抱歉,回复时间太晚了.解决方案有点奇怪.但这帮助我在面对相同问题的同时继续前进.

Sorry for very late reply. The Solution is kind of wierd. But it helped me keep going while facing the same issue.

MPMovieSourceTypeStreaming是您错过的东西.

MPMoviePlayerController *player =
[[MPMoviePlayerController alloc] initWithContentURL: [NSURL URLWithString:@"map.mp4"]];
[player prepareToPlay];
[player.view setFrame: self.view.bounds];  // player's frame must match parent's
player.movieSourceType    = MPMovieSourceTypeStreaming;
[self.view addSubview: player.view];
// ...
[player play];

这篇关于MPMoviePlayerController给我一个黑色的空白视图,没有视频播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆