我想获取内部存储在iPhone中的所有视频文件的列表(录制和iPod).我想在我的应用程序中显示所有视频文件.
我有一个,TableViewController并希望在我的应用程序中显示来自iphone的所有视频文件.
如何获取所有视频文件的列表?
我正在尝试使用iOS 4.1在iPhone上的资源文件夹中播放视频文件.MPMoviePlayerViewController显示视图,但它只会在活动指示器旋转时显示"正在加载电影...".谁知道这个的原因?我尝试过各种适用于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 …Run Code Online (Sandbox Code Playgroud) iphone video objective-c mpmovieplayercontroller iphone-video