MPMoviePlayerController 通过 http url 请求迟到

发布于 2024-10-02 02:22:45 字数 794 浏览 1 评论 0原文

我正在开发一个 iPad 应用程序,版本为 4.1,部署目标为 3.2。

我有一个 UITableViewController ,如果选择一行,它会向主视图添加一个新视图。

在新视图的 UIViewController 中,我在 viewDidLoad 方法中执行了以下代码:

- (void)viewDidLoad 
{
 MPMoviePlayerController* player = [[MPMoviePlayerController alloc] initWithContentURL:movieurl];
 [[self.view viewWithTag:1] addSubview:player.view];    

 player.view.frame = CGRectMake(0, 0, 512, 289);
 [player play];

 [super viewDidLoad];
}

movieurl 是带有我们 CDN 的 http 地址的 URL。

viewWithTag:1 是一个简单的标准 UIView,与播放器具有相同的框架。

现在,如果我单击表格行,则会出现新视图,其中包含子视图(带有标签 1)。

而玩家也没有出现。一段时间后,当电影准备好播放时,电影播放器​​会按需要出现并开始播放电影。

电影播放器​​工作正常,只是最近才出现。

有什么办法可以直接在视图上显示电影播放器​​吗?就在电影完成预加载之前。播放器可以处于加载状态或类似状态。

要点是,玩家从一开始就出现,所以视图中没有空白区域。

感谢您的帮助!

I'm developing an iPad app with 4.1 and deployment-target 3.2.

I have a UITableViewController which adds a new View to the main view if a row becomes selected.

In the UIViewController of the new view I've following code in the viewDidLoad method:

- (void)viewDidLoad 
{
 MPMoviePlayerController* player = [[MPMoviePlayerController alloc] initWithContentURL:movieurl];
 [[self.view viewWithTag:1] addSubview:player.view];    

 player.view.frame = CGRectMake(0, 0, 512, 289);
 [player play];

 [super viewDidLoad];
}

movieurl is an URL with a http address of our CDN.

the viewWithTag:1 is a simple standard UIView with the same frame like the player.

Now, if I click on the tablerow, the new view appears with the subview (with tag 1) in it.

And the player is not showing up. After some time, when the movie is ready to play, the movieplayer shows up like wanted and starts playing the movie.

The movieplayer works fine, it only appears really lately.

Is there any way to show the movieplayer directly on the view? Just before the movie has finished preloading. The player can be in a loadingstate or something like this.

The mainpoint is, that the player shows up from beginning, so there's no empty space in the view.

Thank you for your help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

孤寂小茶 2024-10-09 02:22:45

我有同样的问题和评论,在我升级到最新的 XCode 之前,迫使我使用 4.2 作为基础 SDK,这对我来说工作得很好。我有 4.1 iPhone,播放器立即显示“电影正在加载...”标签...

升级和选择 4.2 基础 SDK 后,即使以 3.2 作为目标,情况也不再如此。

I have the same question and a comment that before I upgraded to the most recent XCode that forced me to use 4.2 as base SDK this was working fine for me. I had 4.1 iPhone and the player showed up immediately with Movie Loading... label ...

This is no longer the case after upgrade and 4.2 base sdk selection even with 3.2 as target.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文