php 错误“无法在广告创意中使用视频。视频 ID XXX,XXX,XXX,XXX,XXX 可能不是视频的 ID,或者您可能无权查看它”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/53245599/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error "Unable to use the video in an ad creative. Video id XXX,XXX,XXX,XXX,XXX might not be id of a video, or you might not have permission to see it"
提问by Roi Patrick Florentino
I'm trying to create an ad using the php-facebook-sdk and with the help of curl Facebook API.
我正在尝试使用 php-facebook-sdk 并借助 curl Facebook API 创建广告。
I already have uploaded my video with the use of curl and it returns an id. Now, that video id will be used to add an adcreative, but when I submit my adcreative it returns this error:
我已经使用 curl 上传了我的视频,它返回一个 id。现在,该视频 ID 将用于添加广告,但是当我提交广告时,它会返回以下错误:
object(stdClass)#568 (1) {
["error"]=>
object(stdClass)#563 (8) {
["message"]=>
string(17) "Invalid parameter"
["type"]=>
string(14) "OAuthException"
["code"]=>
int(100)
["error_subcode"]=>
int(2013004)
["is_transient"]=>
bool(false)
["error_user_title"]=>
string(28) "Invalid video in ad creative"
["error_user_msg"]=>
string(144) "Unable to use the video in an ad creative. Video id 191,520,185,101,173 might not be id of a video, or you might not have permission to see it. "
["fbtrace_id"]=>
string(11) "HSK5VFCiP6u"
}
}
The video ID returned by the way is 191520185101173.
顺便返回的视频ID是191520185101173。
Here's my code:
这是我的代码:
$object_story_spec = array('page_id' => $page_id,'video_data' => array('video_id' => $video_id,'message' => $ad_message,'image_url' => $image_url,'title' => $ad_header,'call_to_action' => array('type' => 'LEARN_MORE', 'value' => array('link' => $ad_redirect))));
$params = array(
'url_tags' => 'utm_source=facebook',
'image_url' => $image_url,
'object_story_spec' => json_encode($object_story_spec),
'access_token' => $pass_token,
);
I also tried placing that ID straight to the code (statically) like so:
我还尝试将该 ID 直接放置到代码中(静态地),如下所示:
'video_id' => '191520185101173',
And by doing so, it will run and create the adcreative, but somehow when I try using the video ID dynamically, it returns that error.
通过这样做,它将运行并创建广告,但不知何故,当我尝试动态使用视频 ID 时,它会返回该错误。
Any advise?
有什么建议吗?
采纳答案by Kannan Thamu
Use this code to solve your problem:
使用此代码解决您的问题:
video.remote_create()
video.waitUntilEncodingReady()