当我从 OS 3.x 迁移到 4 时,视频仅播放声音

发布于 2024-09-08 15:57:08 字数 509 浏览 2 评论 0原文

嗯..基本上就是这样,当我播放游戏中的电影时,只有声音播放,视频不播放,显示黑屏,甚至触摸也被禁用。

这是代码的相关部分:

myMovie = [[MPMoviePlayerViewController alloc] initWithContentURL:[self movieURL]];

myMovie.movi​​ePlayer.scalingMode = MPMovieScalingModeFill; myMovie.movi​​ePlayer.controlStyle = MPMovieControlModeHidden;

[myMovie.movi​​ePlayer 播放];

谢谢。

编辑:好的,我现在开始工作了,我需要添加这行代码:

[self presentMoviePlayerViewControllerAnimated:myMovie];

现在的问题是,我不想看到媒体播放器控件(暂停、停止等),我只想全屏观看视频,仅此而已,有什么想法吗?

Well.. basically that's what happens, when I play a movie from a game I have, only the sound plays, the video doesn't, showing a black screen, even the touch is disabled.

This is the relevant part of the code:

myMovie = [[MPMoviePlayerViewController alloc] initWithContentURL:[self movieURL]];

myMovie.moviePlayer.scalingMode = MPMovieScalingModeFill;
myMovie.moviePlayer.controlStyle = MPMovieControlModeHidden;

[myMovie.moviePlayer play];

Thx.

Edit.: Ok, I got it working now, I needed to add this line of code:

[self presentMoviePlayerViewControllerAnimated:myMovie];

The problem now is, that I dont want to see the mediaplayer controls (pause, stop, etc), I just want to watch the video fullscreen, that's all, any ideas?

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

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

发布评论

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

评论(1

梦魇绽荼蘼 2024-09-15 15:57:08

对我来说,它添加了 MPMoviePlayerController 文档中的这两行代码,而MoviePlayer 示例代码应用程序中没有这些代码行。因此,在 4.1 和 4.2 中的示例应用程序中播放流时,我只获得音频。

[[theMovie view] setFrame: [self.view bounds]];  // frame must match parent view
[self.view addSubview: [theMovie view]];

For me, it was adding these two lines from the MPMoviePlayerController documentation that are not in the MoviePlayer sample code app. So I was getting just audio when playing a stream in the sample app in both 4.1 and 4.2.

[[theMovie view] setFrame: [self.view bounds]];  // frame must match parent view
[self.view addSubview: [theMovie view]];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文