我想将视频从我的应用上传到youtube.我正在使用示例YoutubeTest来实现此目的.我为我的应用设置了开发人员密钥和客户端ID.现在,当尝试使用示例源代码上传视频时,它显示的错误是:
2012-03-19 10:51:07.947 YouTubeTest [539:f803] serviceBase:objectFetcher:failedWithStatus:400 data:2012-03-19 10:51:07.985 YouTubeTest [539:f803]错误:错误Domain = com.google. GDataServiceDomain Code = 400"无法完成操作.(com.google.GDataServiceDomain error 400.)"UserInfo = 0x6c49e50 {}
有没有人成功实施过GData,可以从iphone应用上传视频到youtube.任何人都可以给我示例源代码.
我正在使用AVMutableComposition混合音频和视频文件.以下是我的代码:
enter code here
AVMutableComposition* mixComposition = [AVMutableComposition composition];
NSString *bundleDirectory = [[NSBundle mainBundle] bundlePath];
NSString *audio_inputFilePath = [bundleDirectory stringByAppendingPathComponent:@"xyz.mp3"];//audio of 35 seconds
NSURL *audio_inputFileUrl = [NSURL fileURLWithPath:audio_inputFilePath];
NSURL *video_inputFileUrl = [NSURL fileURLWithPath:videoOutputPath];
NSString *outputFilePath = [documentsDirectory stringByAppendingPathComponent:@"video.mp4"];//video of 60 seconds
NSURL *outputFileUrl = [NSURL fileURLWithPath:outputFilePath];
if ([[NSFileManager defaultManager] fileExistsAtPath:outputFilePath])
[[NSFileManager defaultManager] removeItemAtPath:outputFilePath error:nil];
CMTime nextClipStartTime = kCMTimeZero;
AVURLAsset* videoAsset = [[AVURLAsset alloc]initWithURL:video_inputFileUrl options:nil];
CMTimeRange video_timeRange = CMTimeRangeMake(kCMTimeZero,videoAsset.duration);
AVMutableCompositionTrack *a_compositionVideoTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeVideo preferredTrackID:kCMPersistentTrackID_Invalid];
[a_compositionVideoTrack insertTimeRange:video_timeRange ofTrack:[[videoAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0] atTime:nextClipStartTime …Run Code Online (Sandbox Code Playgroud)