0

I'm wondering how to update the privacy status of a video in youtube api. the update snippet goes like this.

     $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'];

that is considering if you are updating the title, description and tags. Any help is appreciated. Thanks

1 Answer 1

1

Like this...

// 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'];
Sign up to request clarification or add additional context in comments.

2 Comments

i'm getting a fatal error 'google_serviceException' saying error calling PUT.
Try changing: $updateResponse = $youtube->videos->update("snippet", $updateVideo); To: $updateResponse = $youtube->videos->update("status,snippet", $updateVideo);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.