首页 文章

上传到vimeo后设置视频元数据

提问于
浏览
0

我已成功使用API V3将视频上传到vimeo . 现在,我想设置一些元数据,如名称,描述,privacy.view等上传视频 .

当我尝试使用vimeo游乐场时,它会获得成功:https://developer.vimeo.com/api/endpoints/videos#/

但在代码中,我尝试了两种方式,但没有取得成功 .

NSString *strURL = [NSString stringWithFormat:@"%@videos/%@?access_token=%@&name=%@&description=%@&privacy.view=%@", VIMEO_API_CALL_URL, strVideoID, VIMEO_ACCESS_TOKEN_TEMP, strName, strDescription, strPrivacyView];
NSURL *URL = [NSURL URLWithString:[strURL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];

NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:URL];

[request setHTTPMethod:@"PATCH"];

以及

NSString *strURL = [NSString stringWithFormat:@"%@videos/%@?access_token=%@", VIMEO_API_CALL_URL, strVideoID, VIMEO_ACCESS_TOKEN_TEMP];
NSURL *URL = [NSURL URLWithString:[strURL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];

NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:URL];

[request setHTTPMethod:@"PATCH"];

[request setValue:@"iOS_QuickTime" forHTTPHeaderField:@"name"];
[request setValue:@"This video is uploaded via iOS applcation and to perform last step by adding all required metadata." forHTTPHeaderField:@"description"];
[request setValue:@"nobody" forHTTPHeaderField:@"privacy.view"];

这里,VIMEO_API_CALL_URL是“https://api.vimeo.com/”;

我在寻求解决方案 . 如果有人能在这里帮助我 .

1 回答

  • 0

    您的访问令牌应包含在正确的身份验证标头中 . 像这样的东西:

    Authorization: Bearer xxxxxxxxxtokenxxxxxxx

    您尝试设置的值( Headers ,描述,隐私)应该是查询参数,而不是 Headers 键/值 . 所以你的第一种方法是正确的 .

    您还可以考虑使用Vimeo iOS SDK(我是其中一位作者)或者只是浏览代码库以帮助您从A点到达B点:

    https://github.com/vimeo/VIMNetworking

    随意提交该回购的问题 .

相关问题