在ios中播放视频6 [英] playing video in ios 6

查看:98
本文介绍了在ios中播放视频6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在ios 6中播放视频。我正在使用Xcode 4.5。我在下面编写代码但收到错误

I wanted to play a video in ios 6. I am using Xcode 4.5. I write code below but getting error

 Test Demo[736:14003] [MPAVController] Autoplay: Disabling autoplay for pause
 Test Demo[736:14003] [MPAVController] Autoplay: Disabling autoplay
 Test Demo[736:14003] [MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 1, on player: 0)

和我的代码

NSString *videoPath = [[NSBundle mainBundle] pathForResource:@"TestVideo" ofType:@"m4v"];
NSURL *streamURL = [NSURL fileURLWithPath:videoPath];

MPMoviePlayerController *player =
[[MPMoviePlayerController alloc] initWithContentURL: streamURL];
[player prepareToPlay];
[player.view setFrame: self.view.bounds];  // player's frame must match parent's
[self.view addSubview: player.view];
// ...
[player play];`


推荐答案

您的错误可能存在许多问题。

There could be many issues for your error.

1)为 MPMoviePlayerController设置属性并合成它。如果您的MPMoviePlayerController在播放之前发布,则可能会发生这种情况。

1) Set a property for your MPMoviePlayerController and synthesize it. This may occur, if your MPMoviePlayerController releases before it plays.

2)添加此代码 player.movi​​ePlayer.movi​​eSourceType = MPMovieSourceTypeFile;

3)根据文档 .m4v 未提及扩展名。

3) As per documentation, .m4v extension is not mentioned to play.

4)下面的截图将帮助您了解支持的格式。

4) Below screenshot will help you about supported formats.

这篇关于在ios中播放视频6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆