如何以编程方式访问 ipad 电影文件夹中的文件?
我正在寻找一种方法以编程方式访问我的文档或 iPad 的电影目录中的电影,而不是将它们捆绑到 Resources 目录中。我正在编写一个严重依赖电影的 iPad 应用程序,旨在成为一个内部演示工具(它将仅分发到公司的几台 iPad 上)。将电影捆绑到应用程序中后,它的大小几乎就是一个完整的演出。我找不到任何方法来自动加载文件而不将其放入资源目录中:
NSString *path = [[NSBundle mainBundle] pathForResource:name ofType:@"m4v"];
MPMoviePlayerViewController *thisplayer = [[MPMoviePlayerViewController alloc]
initWithContentURL:[NSURL fileURLWithPath:path]];
[self presentMoviePlayerViewControllerAnimated:thisplayer];
我是否丢失了某些内容,或者是否存在安全驱动的限制不允许我使用电影目录?如果我脑残的话,非常抱歉。
I am looking for a way to programmatically access movies in my documents or movies directory of my iPad, rather than bundling them into the Resources directory. I am programming an iPad application that is heavily dependent on movies, and is intended to be an inhouse demo tool (it will be distributed to only a few iPads in the company). With the movies bundled in to the app, it's almost a full Gig in size. I can't find any way to automatically load a file without placing it in the Resources directory:
NSString *path = [[NSBundle mainBundle] pathForResource:name ofType:@"m4v"];
MPMoviePlayerViewController *thisplayer = [[MPMoviePlayerViewController alloc]
initWithContentURL:[NSURL fileURLWithPath:path]];
[self presentMoviePlayerViewControllerAnimated:thisplayer];
Am I missing something, or is there a security-driven limitation that won't allow me to use the movies directory? Much apologies if I have brainfarted.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
ALAssetsLibrary
类以编程方式访问存储在用户设备上的电影。 (或者,您可以使用媒体选择器让用户选择要使用的资源;然后您将获得一个可以从中加载电影的 URL。)
You can use the
ALAssetsLibrary
class to get programmatic access to the movies stored on the user's device. (Alternatively, you can use a media picker to let the user choose which asset to use; then you'll be given a URL which you can load the movie from.)