如何使视频资源兼容视网膜显示?

发布于 2024-10-01 14:55:25 字数 1220 浏览 4 评论 0原文

我有一个应用程序,可以在播放 2 秒的电影时加载。目前,该应用程序已在商店上架,并且除此视频外,所有静态内容均符合视网膜显示标准。我有一个用于视网膜显示屏的 960x640 mp4 h.264 编码视频,它在 iPhone(是的,高分辨率,而不是 480x320)和 iPhone4 模拟器中运行良好。但它似乎无法在我运行 iOS4 的 iPod Touch 第三代上播放。我还无法在物理视网膜显示器上进行测试。

直到现在我才意识到 MPMoviePlayerController 可能不支持高于 480x320 的分辨率,但文档确实这么说。

http://developer.apple.com/ Library/ios/#documentation/MediaPlayer/Reference/MPMoviePlayerController_Class/MPMoviePlayerController/MPMoviePlayerController.html

我知道这很可能听起来像另一个 @2x 解决方案,但这似乎也不起作用。

对于让这个高分辨率视频在两个屏幕上播放有什么建议吗?如果需要的话我可以发布代码。


作为参考,这是解决方案:

MPMoviePlayerController *movieController;

if ([[UIScreen mainScreen] scale] == 2.0) {
  movieController = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath: [[NSBundle mainBundle] pathForResource:@"highRes" ofType:@"mp4"]]];
} else {
  movieController = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"lowRes" ofType:@"m4v"]]];
}

I have an app that loads while a 2 second movie plays. Currently the app is out on the store and has all static content retina display compliant except this video. I have a 960x640 mp4 h.264 encoded video for the retina display and it works well in both iPhone (yes, high res, not 480x320) and iPhone4 simulators. but it just doesn't seem to play on my iPod Touch 3rd Gen running iOS4. I haven't been able to test on the physical retina display yet.

It never occurred to me until now that maybe MPMoviePlayerController might not support higher than 480x320, but the docs do say that.

http://developer.apple.com/library/ios/#documentation/MediaPlayer/Reference/MPMoviePlayerController_Class/MPMoviePlayerController/MPMoviePlayerController.html

I know this most likely sounds like another @2x solution, but that does not seem to be working either.

Any suggestions for getting this High-res video playing for both screens? I can post code if needed.


For reference, here's the solution:

MPMoviePlayerController *movieController;

if ([[UIScreen mainScreen] scale] == 2.0) {
  movieController = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath: [[NSBundle mainBundle] pathForResource:@"highRes" ofType:@"mp4"]]];
} else {
  movieController = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"lowRes" ofType:@"m4v"]]];
}

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

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

发布评论

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

评论(1

过去的过去 2024-10-08 14:55:25

我建议使用此处的代码检查来为您的媒体播放器提供正确的视频文件。

I would suggest using code checking here to supply your media player with the correct video file.

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