1
我使用到現在這段代碼保存視頻,我從UIImagePickerController
得到:保存視頻在IOS 5
NSURL *url = [info objectForKey:UIImagePickerControllerMediaURL];
NSData *videoData = [NSData dataWithContentsOfURL:url];
path = [kFilesSaveDirectory stringByAppendingFormat:@"%@/Vid%d.mov",album.albumName,album.lastfile];
path2 = [kFilesSaveDirectory stringByAppendingFormat:@"%@/VidImg%d.png",album.albumName,album.lastfile];
[videoData writeToFile:path atomically:NO];
[[videoPlayer moviePlayer] setContentURL:[NSURL URLWithString:path]];
UIImage *image = [[videoPlayer moviePlayer] thumbnailImageAtTime:1.0 timeOption: MPMovieTimeOptionNearestKeyFrame];
[[videoPlayer moviePlayer] setContentURL:nil];
[UIImagePNGRepresentation(image) writeToFile:path2 atomically:YES];
到現在爲止在iOS 4的它的工作沒有任何問題,但是當我嘗試使用它現在在iOS 5中,它有兩個問題:
- 它給我零爲img。
2.it不告訴我視頻的時候,我想使用此代碼來顯示它:
[[videoPlayer moviePlayer] setContentURL:[NSURL URLWithString:choosen.bigpath]];
[self presentModalViewController:videoPlayer animated:YES];
[[videoPlayer moviePlayer] play];