小编Tyl*_*aus的帖子

PHP:带有同步标记的YouTube v3 API标题上传

在过去的几周里,我的同事和我一直在努力通过v3 API尝试为我们的客户提供YouTube视频的标题.大约一周之后,我们终于能够将字幕上传得很好但是,YouTube会在用户界面中向我们显示此消息"跟踪内容未处理",并且不会显示我们上传的字幕.但是,我们可以下载上传的原始格式; 所以我们知道该文件已成功上传.

我们还能够获得同步标记,告诉YouTube运行成绩单并设置视频的时间,但实际上并不起作用.它返回告诉我们它正在同步,但是当我们转到视频的UI时,它只显示字幕轨道名称,并向我们提供消息"轨道内容未被处理"..我们用完了所有的时间,现在我们正在努力解决这个问题,但仍然没有运气.

有没有人遇到过这个问题?如果是这样,你能做些什么才能让它发挥作用?

我将在下面发布我的代码片段,其中显示了我们脚本的上传部分.

# Insert a video caption.
# Create a caption snippet with video id, language, name and draft status.
$captionSnippet = new Google_Service_YouTube_CaptionSnippet();
$captionSnippet->setVideoId($videoId);
$captionSnippet->setLanguage($captionLanguage);
$captionSnippet->setName($captionName);
$captionSnippet->setIsDraft( true );

# Create a caption with snippet.
$caption = new Google_Service_YouTube_Caption();
$caption->setSnippet($captionSnippet);

// Setting the defer flag to true tells the client to return a request which can be called
$client->setDefer(false);

// Get the file content's of the uploaded file
$file = file_get_contents( …
Run Code Online (Sandbox Code Playgroud)

php youtube youtube-data-api

15
推荐指数
1
解决办法
881
查看次数

标签 统计

php ×1

youtube ×1

youtube-data-api ×1