iPhone 3.0 操作系统应用程序在 iPhone 4.0 操作系统中运行时崩溃的视频

发布于 2024-09-09 02:24:25 字数 968 浏览 6 评论 0原文

我在 iPhone 4.0 操作系统中播放视频时遇到崩溃问题。实际上,我已经使用基础 SDK 3.0 创建了应用程序,现在我只是将应用程序安装到 4.0 操作系统设备。

它不起作用...我已经调试了这个问题,发现在4.0操作系统中,苹果改变了播放视频的框架和方法。

任何人都可以帮助我如何克服这个问题。

这是我的代码,在 3.0 操作系统中运行良好。

-(void)play
    {
     NSBundle *bundle = [NSBundle mainBundle];
     //NSString *path = [bundle pathForResource:@"Icon" ofType:@"png"];
     NSString *path = [bundle pathForResource:@"loader" ofType:@"m4v"];
     NSURL *url = [NSURL fileURLWithPath:path];
     moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
     moviePlayer.scalingMode = MPMovieScalingModeAspectFill;

     [[NSNotificationCenter defaultCenter] addObserver:self 
                selector:@selector(moviePlayBackDidFinish:) 
                 name:MPMoviePlayerPlaybackDidFinishNotification 
                  object:moviePlayer];
     moviePlayer.movieControlMode = MPMovieControlModeHidden;
     [moviePlayer play];
    }

提前致谢, 普拉格内什

I am having a crash issue while playing video in iphone 4.0 OS. Actually, I have created application with base SDK 3.0 and now i am just installing application to 4.0 OS device.

It is not working in that... I have debugged that issue and found that in 4.0 OS, apple change the framework and methods to play the video.

Any one help me how to overcome this issue.

Here is my code which is running fine in 3.0 OS.

-(void)play
    {
     NSBundle *bundle = [NSBundle mainBundle];
     //NSString *path = [bundle pathForResource:@"Icon" ofType:@"png"];
     NSString *path = [bundle pathForResource:@"loader" ofType:@"m4v"];
     NSURL *url = [NSURL fileURLWithPath:path];
     moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
     moviePlayer.scalingMode = MPMovieScalingModeAspectFill;

     [[NSNotificationCenter defaultCenter] addObserver:self 
                selector:@selector(moviePlayBackDidFinish:) 
                 name:MPMoviePlayerPlaybackDidFinishNotification 
                  object:moviePlayer];
     moviePlayer.movieControlMode = MPMovieControlModeHidden;
     [moviePlayer play];
    }

Thanks in advance,
Pragnesh

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

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

发布评论

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

评论(1

笔落惊风雨 2024-09-16 02:24:25

对于iOS4,您需要使用MPMoviePlayerViewController。我发布了我的 工作代码示例在这里

With iOS4, you need to use the MPMoviePlayerViewController. I posted my working code sample here.

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