大家好,我在iPhone开发中创建了一个简单的电影播放器。但我只能听到维迪奥的声音。这是我的代码(单击按钮时),
-(IBAction)playMe{
NSBundle *bundle=[NSBundle mainBundle];
NSString *moviePath=[bundle pathForResource:@"iiii" ofType:@"mp4"];
NSURL *movieURL = [NSURL fileURLWithPath:moviePath];
MPMoviePlayerController *theMovie=[[MPMoviePlayerController alloc] initWithContentURL:movieURL];
theMovie.scalingMode = MPMovieScalingModeAspectFill;
[theMovie play];
[self.view addSubview:theMovie.view];
}当我点击的时候,我得到的只是声音而不是电影。我还使用了iOS 4.1模拟器。
发布于 2011-04-30 15:09:57
这可能是因为您没有设置帧显示电影播放器尝试此。
theMovie.view.frame=CGRectMake(0,0,300.400);如果这不起作用,您可以查看以下教程
http://www.edumobile.org/iphone/iphone-programming-tutorials/how-to-play-video-in-iphoneos4/
https://stackoverflow.com/questions/3911611
复制相似问题