감사합니다. 내 응용 프로그램의 문서 디렉토리에있는 파일의 이름을 읽고 나열하는 코드가 있습니다. 이 잘 작동하고 난 그래서 난이 코드 발견 내가 얻을 비디오의 각에서 thumnails을 추가 할 알고 : 그것은 다른 추가 그래서 잘 모르겠어요 그러나Objective-C : thumbnail을 TableView에 추가하는 방법 비디오에서?
NSURL *videoURL = [NSURL fileURLWithPath:@""];
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];
UIImage *thumbnail = [player thumbnailImageAtTime:1.0 timeOption:MPMovieTimeOptionNearestKeyFrame];
cell.imageView.image = thumbnail;
[player stop];
내 파일의 경로를 가리을 내 tableview가 표시하는 모든 개별 비디오의 썸네일. 사전에
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MainCell"];
if (cell == nil) {
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"MainCell"];
}
NSLog(@"urlstring %@",[filePathsArray objectAtIndex:indexPath.row]);
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
filePathsArray = [[NSFileManager defaultManager] subpathsOfDirectoryAtPath:documentsDirectory error:nil];
cell.textLabel.text = [filePathsArray[indexPath.row] lastPathComponent];
filePathsArray = [[NSArray alloc] initWithArray: [[[NSFileManager defaultManager] subpathsOfDirectoryAtPath:documentsDirectory error:nil]mutableCopy]];
NSURL *videoURL = [NSURL fileURLWithPath:@""];
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];
UIImage *thumbnail = [player thumbnailImageAtTime:1.0 timeOption:MPMovieTimeOptionNearestKeyFrame];
cell.imageView.image = thumbnail;
[player stop];
return cell;
}
감사 :
는 여기에 내가 비디오 파일을 받고 표에 표시하고 있습니다 내 전체 코드입니다.