iO4 上仅使用 MPMoviePlayerController 播放音频

发布于 2024-09-11 00:30:30 字数 399 浏览 4 评论 0原文

当我在 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 技术交流群。

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

发布评论

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

评论(2

过气美图社 2024-09-18 00:30:30

我相信在您的播放命令中添加此命令应该会改善您的情况:

[电影播放]
[电影设置全屏:是];
[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];

琉璃梦幻 2024-09-18 00:30:30

尝试,

//add frame works

 //   AVFoundation.framework
 //   MediaPlayer.framework
    [movie setFullscreen:YES]; 
    [self.view addSubview:movie.view];
    moviePlayer.controlStyle =  MPMovieControlStyleDefault; 
    moviePlayer.shouldAutoplay=YES;
     moviePlayer.repeatMode = YES; 

try,

//add frame works

 //   AVFoundation.framework
 //   MediaPlayer.framework
    [movie setFullscreen:YES]; 
    [self.view addSubview:movie.view];
    moviePlayer.controlStyle =  MPMovieControlStyleDefault; 
    moviePlayer.shouldAutoplay=YES;
     moviePlayer.repeatMode = YES; 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文