在 iPad 版 SDK 3.2 中使用 MPMoviePlayerViewController
我开发了一个 iPhone 应用程序,它运行 MPMoviePlayer(3.2 SDK 之前的版本)没有任何问题。我知道这是一个新手问题,但如何让电影在新的 MPMoviePlayerViewController 中播放。我只收到音频并希望学习新的视图控制器。我已经将整个应用程序移植到 iPad 上,除了视频之外,其他一切都运行良好。有人可以展示一个使用电影视图控制器的示例吗?任何帮助将不胜感激。
谢谢,
I've developed an iPhone app that has been running MPMoviePlayer (pre 3.2 SDK) with no problems. I know this is a newbie question, but how do I get a movie to play in the new MPMoviePlayerViewController. I am only getting audio and wish to learn the new view controller. I've ported my whole app over to iPad and everything else works fine except for video. Could someone please show an example using the movie view controller? Any help would be appreciated.
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
您需要使用 MPMoviePlayerViewController,而不是 MPMoviePlayerController。在文档中搜索 MPMoviePlayerViewController。
You need to use MPMoviePlayerViewController, not MPMoviePlayerController. Search the docs for MPMoviePlayerViewController.
在您的视图控制器中尝试一下:
这应该可以帮助您入门,但请检查 MPMoviePlayerViewController 类参考以获取详细信息。
Try this in your view controller:
This should get you started but check the MPMoviePlayerViewController Class Reference for detailed info.
我一直在努力解决这个问题 - Apple 自己的 MoviePlayer 示例代码不能播放视频,只能播放音频。实际上我花了很长时间才发现它正在播放音频,因为他们提供的示例飞机视频没有音频轨道! (所以我点击按钮,却什么也没得到。)
感谢这里的所有建议。我终于找到了 https://developer.apple.com/library/ios /#qa/qa2010/qa1240.html
即便如此,这也是一个晦涩难懂的解决方案。
这有效:在 [mp 发布] 之后的 initAndPlayMovie 中:
一路顺风,快乐飞行:)
I've struggled all over the place with this - Apple's own MoviePlayer sample code doesn't play video, only audio. It actually took me ages to figure out that it was playing audio because the sample airplane video they supply has NO AUDIO TRACK!!! (So I click the button and get absolutely nothing.)
Thanks for all the suggestions here. I finally found https://developer.apple.com/library/ios/#qa/qa2010/qa1240.html
and even that is an obscure-ish fix.
This works: in initAndPlayMovie after [mp release]:
Bon voyage and happy flying :)
更改此行:
您
需要
*
change this line:
to
you need the
*
我很确定它目前在模拟器中坏了!我使用最新的 sdk 和他们自己的 MPMoviePlayer 示例代码以及苹果自己的视频得到相同的行为(没有视频,但听到音频),该代码将使用 safari 在 iPad 模拟器中播放...所以底线视频在 Safari 内部的模拟器 ipad 上播放,但不是来自使用 MpMoviePlayer 类的应用程序。错误或功能,由您决定。 (我认为它刚刚坏了)。此版本的发行说明在 MPMoviePlayer 类中进行了很多更改...
I am pretty sure that its broken in simulator at present ! I get same behavior (no video but hear audio) with latest sdk and their own MPMoviePlayer sample code with Apples own video that Will play in iPad simulator using safari... So bottom line video plays on simulator-ipad inside of Safari but Not from an app using MpMoviePlayer class. Bug or feature, you decide. (I think its just broken). release notes for this version have lots of changes going on in MPMoviePlayer class...