gpt4 book ai didi

ios - 通过video-graph.facebook iOS将视频上传到Facebook

转载 作者:行者123 更新时间:2023-12-01 17:50:18 26 4
gpt4 key购买 nike

我正在尝试上传视频。我已将视频文件保存为MP4文件,如下所示:

NSString *fileName = [NSString stringWithFormat:@"chatVideo-%d.mp4",arc4random()%1000];
NSString *myPathDocs = [documentsDirectory stringByAppendingPathComponent:fileName];
NSURL *videoURL = [NSURL fileURLWithPath:myPathDocs];
AVAssetExportSession *exportSession = [AVAssetExportSession exportSessionWithAsset:asset2 presetName:AVAssetExportPresetHighestQuality];
exportSession.outputURL = videoURL;
exportSession.outputFileType = AVFileTypeMPEG4;
NSData *videodata =[NSData dataWithContentsOfURL:videoURL];

我调用了图谱API以上传到Facebook:
[parameters setValue:videoData forKey:@"source"];

[parameters setValue:thumbData forKey:@"thumb"];

[[[FBSDKGraphRequest alloc] initWithGraphPath:@"me/videos"
parameters:parameters
HTTPMethod:@"POST"]
startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
if ([error.userInfo[FBSDKGraphRequestErrorGraphErrorCode] isEqual:@200]) {
NSLog(@"permission error");
}
}];

但我收到此错误:

抱歉,您选择的视频文件格式不支持。

最佳答案

是的,经过很长一段时间,我才找到答案:

[parameters setValue:videoData forKey:@"source"];

肯定是:
[parameters setValue:videoData forKey:@"video.mp4"];

我讨厌Facebook文档==!。

关于ios - 通过video-graph.facebook iOS将视频上传到Facebook,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33254118/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com