- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在尝试在装有 iOS 4.1 的 iPhone 上播放资源文件夹中的视频文件。 MPMoviePlayerViewController 显示该 View ,但它只会随着事件指示器的旋转而永远显示“正在加载电影...”。任何人都知道这是什么原因?我试过各种应该在 iPhone 上运行的视频格式,每次都得到相同的结果。
电影播放器响应显示和隐藏控件等操作。
我的代码:
-(void) playVideoNamed:(NSString *)videoName
{
// I get the path like this so the user can enter extension in the filename
NSString *path = [NSString stringWithFormat:@"%@/%@",
[[NSBundle mainBundle] resourcePath], videoName];
NSLog(@"Path of video file: %@", path);
RootViewController *rootController = [(DerpAppDelegate *)[[UIApplication sharedApplication] delegate] viewController];
NSURL *url = [NSURL URLWithString:path];
MPMoviePlayerViewController *vc = [[MPMoviePlayerViewController alloc] initWithContentURL:url];
vc.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
[rootController presentMoviePlayerViewControllerAnimated:vc];
[vc.moviePlayer prepareToPlay]; // Not sure about this... I've copied this code from various others that claims this works
[vc.moviePlayer play];
}
最佳答案
发现问题:
NSURL *url = [NSURL URLWithString:path];
必须替换为:
NSURL *url = [NSURL fileURLWithPath:path];
很难发现那个...
关于iphone - MPMoviePlayerController "Loading Movie...",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6070975/
我有这个 MPMovePlayerController 和一个自定义 slider (它不是一个 slider ,但它具有相同的目的)。考虑到我的“ slider ”可以返回我需要的任何浮点值,我怎样
我正在使用 m3u8 视频格式来流式传输视频,现在我需要显示相同的字幕。 我在 Apple 文档中搜索,发现我可以通过使用 closedCaptionDisplayEnabled 来实现这一点。 AV
我正在使用 MPMoviePlayerController 在我的应用程序中播放一个视频。下面是我播放视频的代码。 **NSURL *url=[[NSURL alloc] initFileUR
请检查以下代码: (void) moviePlayerDidExitFullscreen:(NSNotification*)notification { MPMoviePlayerControlle
为了在我的应用中播放视频,我设置了 MPMoviePlayerController并将其添加到 subview 。用户可以使用捏合手势更改为全屏模式。 在此 viewController (包含电影播
有没有捕捉异常的方法(特别是对于网络错误 /没有可用连接)当使用 MPMoviePlayerController 时? 我特别担心一旦播放器的实例被初始化为 initWithURL:您无法知道电影加载
这真让我抓狂。 很简单,我有一个 MPMoviePlayerViewController 并且想要全屏显示电影。 在 iOS 5.0+ 上使用 ARC 我想让这个播放器应用程序范围内可重用。 这部电影
MPMoviePlayerController 似乎存在问题,一旦您处于全屏模式并按住快进按钮,让它向前搜索(以快速播放)一直到视频结尾。 此后,你只会得到一个黑屏,它被卡住了。换句话说,它不响应任何
我正在使用 MPMoviePlayerController 在 iPad 上播放电影。 当用户将设备旋转到横向时,我将其设置为全屏。 如果用户随后点击“退出全屏”或“完成”,电影将动画回到其小帧( n
我正在将应用程序移植到 iOS 8。我有一些代码可以播放以前可以运行的视频,但现在不能了。 当我运行它时,我收到以下错误: ( "", "", "", "", "", "", "", "", "" )
MPMoviePlayerController 支持哪些格式? 最佳答案 根据the documentation : 支持的格式 此类播放 iOS 支持的任何电影或音频文件。这包括流式内容和固定长度文
已结束。此问题正在寻求书籍、工具、软件库等的推荐。它不满足Stack Overflow guidelines 。目前不接受答案。 我们不允许提出寻求书籍、工具、软件库等推荐的问题。您可以编辑问题,以便
这是代码 - (void)applicationDidFinishLaunching:(UIApplication *)application { NSBundle *bundle = [NSBu
每次我的应用程序更改显示的动画(这是一部循环电影)时,他都会暂停,直到最终开始播放电影。MoviePlayerConntroller 是这样创建的 self.moviePlayer = [MP
MPMoviePlayerController 几乎按照我想要的方式工作,除了它覆盖了屏幕上的任何其他项目,例如我的导航栏。有没有办法阻止这种情况发生? 最佳答案 它的播放器是基于 UIView 的,
我们可以像MPMoviePlayerController中的默认Slider一样制作自定义控件吗用于前进和后退电影? 最佳答案 虽然您无法修改 MPMoviePlayerController 类,但您
我想自定义 MPMoviePlayerController 来为视频播放器添加更多控制。我可以添加额外的控件,但顶部缓冲控件被删除。我怎样才能让它可见? 最佳答案 我对你的问题的理解是你想在 MPMo
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:video_url]
如何调整 MPMoviePlayerController 的帧大小? 最佳答案 通过新版本的 MPMoviePlayerController,您可以做到。 关于iphone - MPMoviePlay
我需要在没有播放器任何覆盖的情况下播放电影。没有播放/停止按钮,没有时间线,没有开始/结束时间,没有进度条,什么都没有。只是 subview 中的普通裸体电影。然后这部电影可能会被我自己的图形覆盖。该
我是一名优秀的程序员,十分优秀!