【问题标题】:i cannot see movie playing in iphone simulator我在 iphone 模拟器中看不到电影播放
【发布时间】:2009-12-17 06:34:45
【问题描述】:

我创建了一个在按钮单击时播放电影的应用程序。我的应用程序正在运行,没有任何警告或错误。但是我看不到电影不知道为什么? 我添加了媒体播放器框架并在 viewController.h 中导入了#import 我的按钮操作代码如下... -(IBAction)playMyMovie:(id)sender{

NSBundle *bundle =[NSBundle mainBundle];
NSString *moviePath = [bundle pathForResource:@"jumps" ofType:@"mov"];
NSURL *movieURL = [[NSURL fileURLWithPath:moviePath] retain];
MPMoviePlayerController *theMovie =[[MPMoviePlayerController alloc] initWithContentURL:movieURL];
theMovie.scalingMode = MPMovieScalingModeAspectFill;
[theMovie play];

}

请告诉我我错过了什么..

【问题讨论】:

    标签: iphone mpmovieplayer


    【解决方案1】:

    在 iPhone 模拟器中,您无法正常播放电影。

    在 iPhone(真实仪器)上测试应用程序。

    它会正常工作的。

    【讨论】:

      【解决方案2】:

      您正在创建一个 MPMoviePlayerController。它有一个view 属性——这是它的视图。将该视图放入您的界面是您的工作。否则,您将看不到任何东西。

      【讨论】:

        【解决方案3】:

        尝试在 [theMovie play] 之前添加这一行

        [self.view addSubview:theMovie.view];
        

        还要记得设置FullScreen:

        [self.theMovie setFullscreen:YES];
        

        如果你不想全屏但想嵌入到视图中,你可以忽略“setFullscreen”,但为 MPMoviePlayerController 视图设置框架:

        [self.theMovie.view setFrame:CGRectMake("add in the size you want here")];
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多