-2
我想捕獲視頻,然後在一些社交網站和電子郵件上共享它,所以我捕獲了視頻並將其保存到相冊中,現在我不知道我怎麼能份額捕獲/保存的視頻,請提出一些對於這一點,這裏是我拍攝的視頻存儲代碼..: -在Facebook,Twitter和電子郵件上捕獲視頻分享
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
NSString *tempFilePath = [[info objectForKey:UIImagePickerControllerMediaURL] path];
// NSLog(@"dictionary info %@", info);
if (UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(tempFilePath))
{
// Copy it to the camera roll.
UISaveVideoAtPathToSavedPhotosAlbum(tempFilePath, self, @selector(video:didFinishSavingWithError:contextInfo:), tempFilePath);
NSURL *videoURL = [info objectForKey:UIImagePickerControllerMediaURL];
NSData *videoData = [NSData dataWithContentsOfURL:videoURL];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
vidPath = [documentsDirectory stringByAppendingFormat:@"/vid1.mp4"];
[vidPath retain];
BOOL success = [videoData writeToFile:vidPath atomically:NO];
NSLog(@"Written file on path success? , %@\n", (success ? @"YES" : @"NO"));
[picker dismissModalViewControllerAnimated:YES];
}
}
更新
我曾嘗試這個代碼來生成微小的URL共享視頻但它不工作:(
NSString *apiEndpoint = [NSString stringWithFormat:@"http://tinyurl.com/api-create.php?url=%@",vidPath];
[apiEndpoint retain];
shortURL = [NSString stringWithContentsOfURL:[NSURL URLWithString:apiEndpoint]
encoding:NSASCIIStringEncoding
error:nil];
[shortURL retain];
這裏我將能夠存儲視頻照片庫和文件目錄現在我想分享,那麼該怎麼做?請幫忙!
這是對您有幫助? – user1673099
實際上我需要一個適用於所有因素的全球解決方案,我想在fb,twitter和電子郵件上分享我拍攝的視頻... –
@ D-eptdeveloper,請參閱我的更新回答。對不起,我不知道推特。 – user1673099