如何在iPhone中使用MPMoviePlayerController播放视频?
这是我使用 MPMoviePlayerController 加载视频的代码,我的问题是我可以听到视频的声音,但看不到视频。谁能给我解决办法吗!!!
注意:“AddRunningClient 在非零客户端计数上启动设备”当我在控制台中运行我的应用程序时显示此消息,
现在我正在使用 IOS4.1 sdk
- (void)viewDidLoad {
[super viewDidLoad];
NSString *mediaPath = [[[NSBundle mainBundle]resourcePath] stringByAppendingPathComponent:@"understandingoilcost_1500kbps.mov"];
MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:mediaPath]];
moviePlayer.scalingMode = MPMovieScalingModeAspectFit;
[moviePlayer play];
}
请帮助我!
谢谢。
This is my code for load the video using MPMoviePlayerController my issue is i can hear the voice of the video but can't see the video. can any one give me the solution!!!
note:"AddRunningClient starting device on non-zero client count" this message is display while i run my application in console
now i'm working IOS4.1 sdk
- (void)viewDidLoad {
[super viewDidLoad];
NSString *mediaPath = [[[NSBundle mainBundle]resourcePath] stringByAppendingPathComponent:@"understandingoilcost_1500kbps.mov"];
MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:mediaPath]];
moviePlayer.scalingMode = MPMovieScalingModeAspectFit;
[moviePlayer play];
}
Please help me out!
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
那是因为您还没有将玩家的视图添加到您的视图中。您需要执行以下操作:
此外,您应该将电影播放器存储在实例变量中,否则您将无法停止或释放它(从而造成内存泄漏)。
That's because you haven't added the player's view to your view. You need to do something like this:
Also, you should store the movie player in an instance variable, or else you won't be able to stop it or release it (thus creating a memory leak).