iO4 上仅使用 MPMoviePlayerController 播放音频
当我在 3.2 上播放这样做的视频时
NSString *videoFilepath = [[NSBundle mainBundle] pathForResource:@"bacon" ofType:@"mov"];
NSURL *videoURL = [NSURL fileURLWithPath:videoFilepath];
MPMoviePlayerController *movie;
movie = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];
[movie play];
,它工作得很好。但如果我将基础 SDK 切换到 4.0,我只能听到电影的声音。
有什么想法吗?
When I play a video doing this:
NSString *videoFilepath = [[NSBundle mainBundle] pathForResource:@"bacon" ofType:@"mov"];
NSURL *videoURL = [NSURL fileURLWithPath:videoFilepath];
MPMoviePlayerController *movie;
movie = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];
[movie play];
on 3.2, it works pefeectly. But if I switch the base SDK to 4.0 i only hear the sound of the movie.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我相信在您的播放命令中添加此命令应该会改善您的情况:
[电影播放]
[电影设置全屏:是];
[self.view addSubview:movie.view];
尝试测试此属性,因为听起来电影正在播放但尚未设置为全屏:
http://developer.apple.com/iphone/library/documentation/mediaplayer/reference/MPMoviePlayerController_Class/MPMoviePlayerController/MPMoviePlayerController.html# //apple_ref/occ/instp/MPMoviePlayerController/fullscreen
这行代码也很重要:
[自我呈现MoviePlayerViewControllerAnimated:电影];
I believe that adding this with your play command should improve matters for you:
[movie play]
[movie setFullscreen:YES];
[self.view addSubview:movie.view];
Try testing this property as it sounds like the movie is playing but has not been set to fullscreen:
http://developer.apple.com/iphone/library/documentation/mediaplayer/reference/MPMoviePlayerController_Class/MPMoviePlayerController/MPMoviePlayerController.html#//apple_ref/occ/instp/MPMoviePlayerController/fullscreen
This line of code is also of importance:
[self presentMoviePlayerViewControllerAnimated:movie];
尝试,
try,