如何以肖像模式播放电影 [英] how to Play movie in portrait mode

查看:157
本文介绍了如何以肖像模式播放电影的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在肖像模式下播放电影吗?如果是,则播放?

Can i play movie in portrait mode?If yes than how to play?

推荐答案

而不是显式使用MPMoviePlayerController,您可以将影片加载到UIWebView中。这将以肖像模式启动电影,与通常的电影播放器​​控件。积分转至此博客文章

Instead of using the MPMoviePlayerController explicitly, you can load the movie into a UIWebView. That will launch the movie in portrait mode, with the usual movie player controls. Credits go to this blog post.

这是一段代码:

self.webView = [[[UIWebView alloc] initWithFrame: CGRectMake(0.0, 0.0, 1.0, 1.0)] autorelease];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL: urlToMovie];
[self.webView loadRequest: request];
[request release];

此处webView实例初始化为1x1像素元素,并未作为子视图添加。当它加载电影的URL请求时,它将自动填满整个屏幕,你会看到电影以纵向模式播放。

Here the webView instance is initialized as a 1x1 pixel element, and is not added as a sub-view. When it loads the URL request of the movie, it will automatically fill the entire screen and you'll see the movie play in portrait mode.

注意:它看起来像它需要iPhone OS 3.1(或更高版本)才能在UIWebView中播放视频。

Note: it seems like it requires iPhone OS 3.1 (or higher) for videos to play in UIWebView.

这篇关于如何以肖像模式播放电影的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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