PHP:通过YouTube API更改视频的隐私状态

PHP:通过YouTube API更改视频的隐私状态,php,youtube-api,Php,Youtube Api,我想知道如何在youtube api中更新视频的隐私状态。更新片段如下所示 $updateVideo = new Google_Video($video); $updateSnippet = new Google_VideoSnippet($videoSnippet); $updateSnippet->setTitle($title); $updateSnippet->setDescription($description); $u

我想知道如何在youtube api中更新视频的隐私状态。更新片段如下所示

     $updateVideo = new Google_Video($video);
     $updateSnippet = new Google_VideoSnippet($videoSnippet);

     $updateSnippet->setTitle($title);
     $updateSnippet->setDescription($description);
     $updateSnippet->setTags($tags);

     $updateVideo -> setSnippet($updateSnippet);

     $updateResponse = $youtube->videos->update("snippet", $updateVideo);
     $responseTags = $updateResponse['snippet'];
如果您正在更新标题、说明和标记,则需要考虑这一点。感谢您的帮助。谢谢你像这样

// Create a video status with privacy status. Options are "public", "private" and "unlisted".


 $updateVideo = new Google_Video($video);
 $updateSnippet = new Google_VideoSnippet($videoSnippet);

 $updateSnippet->setTitle($title);
 $updateSnippet->setDescription($description);
 $updateSnippet->setTags($tags);

$status = new Google_VideoStatus();//here
$status->privacyStatus = "private";//here
 $updateVideo -> setSnippet($updateSnippet);
$updateVideo->setStatus($status);//and here

//Updated this line to have "status,snippet"
 $updateResponse = $youtube->videos->update("status,snippet", $updateVideo);
 $responseTags = $updateResponse['snippet'];

我收到一个致命错误“google_serviceException”,说调用PUT时出错。请尝试更改:$updateResponse=$youtube->videos->update(“snippet”,$updateVideo);至:$updateResponse=$youtube->videos->update(“状态,代码段,$updateVideo”);