你好,
我正在寻找一种在我的应用程序中以描绘模式播放电影作为背景的方法。电影不应该响应任何点击,我的应用程序将在控制应用程序的电影上有自己的按钮和标签。
如果您碰巧知道来自 iTunes 商店的 Dragons Lair/Space Ace 应用程序,可以通过这种方式了解。
似乎有几种播放 m4v 文件的方法。
有什么建议可以像上面描述的那样给我播放视频吗?
感谢阅读!
最佳答案
在您的应用委托(delegate)中,您可以在 application:didFinishLaunchingWithOptions:
中使用此代码。诀窍是,您仍然需要在视频播放之前显示 Default.png
。
请务必将 MediaPlayer.framework
添加到您的项目中
NSString *videoUrl = [[NSBundle mainBundle] pathForResource:@"video" ofType:@"mp4"];
MPMoviePlayerViewController * movieView;
movieView = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:videoUrl]];
MPMoviePlayerController * theMovie = [movieView moviePlayer];
theMovie.scalingMode = MPMovieScalingModeAspectFit;
theMovie.fullscreen = TRUE;
theMovie.controlStyle = MPMovieControlStyleNone;
theMovie.shouldAutoplay = TRUE;
[_window addSubview:movieView.view];
关于iphone - 求教关于在iPhone上播放电影的建议,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5601626/