首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我的MPMediaPlayerController怎么了?

我的MPMediaPlayerController怎么了?
EN

Stack Overflow用户
提问于 2010-10-12 12:04:57
回答 1查看 312关注 0票数 0

大家好,我在iPhone开发中创建了一个简单的电影播放器。但我只能听到维迪奥的声音。这是我的代码(单击按钮时),

代码语言:javascript
复制
-(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模拟器。

EN

回答 1

Stack Overflow用户

发布于 2011-04-30 15:09:57

这可能是因为您没有设置帧显示电影播放器尝试此。

代码语言:javascript
复制
theMovie.view.frame=CGRectMake(0,0,300.400);

如果这不起作用,您可以查看以下教程

http://www.edumobile.org/iphone/iphone-programming-tutorials/how-to-play-video-in-iphoneos4/

http://iosdevelopertips.com/video/getting-mpmovieplayercontroller-to-cooperate-with-ios4-3-2-ipad-and-earlier-versions-of-iphone-sdk.html

http://www.devx.com/wireless/Article/44642/1954

http://iosdevelopertips.com/video/how-to-play-movies-from-application-bundle-or-from-a-remote-server-url.html

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3911611

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档