Greg Buretz
Greg Buretz

Reputation: 21

Google API PHP Client YouTube "embeddable" setting not working

I downloaded and installed the Google API PHP Client beta on April 7, 2015. I'm able to upload a video to YouTube using it, but within the video's edit screen in YouTube, the "Allow embedding" checkbox is always checked regardless of how I attempt to set it through the API. This is the checkbox I'm talking about:

https://assets.libsyn.com/secure/show/37607/youtube-embeddable2.jpg

Here's my code prior to the file upload:

// set up client
$client = new Google_Client();
$client->setClientId(...);
$client->setClientSecret(...);
$client->refreshToken(...);

$youtube = new Google_Service_YouTube($client);

// create snippet
$snippet = new Google_Service_YouTube_VideoSnippet();
$snippet->setTitle(...);
$snippet->setDescription(...);

// create status
$status = new Google_Service_YouTube_VideoStatus();
$status->setPrivacyStatus("public");
$status->setEmbeddable(false);

// Create a YouTube video with snippet and status
$video = new Google_Service_YouTube_Video();
$video->setSnippet($snippet);
$video->setStatus($status);

$client->setDefer(true);

$insertRequest = $youtube->videos->insert("status,snippet", $video);

// file chunking and upload here...

The privacyStatus option within the the Google_Service_YouTube_VideoStatus object works. If I set it to "private", the video uploads as private. Therefore, the problem isn't with attaching the status to the video. It's just the embeddable option which doesn't appear to work.

I'm left with three possibilities here:

  1. I'm doing something wrong
  2. I'm misinterpreting what the "embeddable" setting does
  3. There's a bug in the client library

Can someone please tell me which I'm dealing with?

Thanks!

Upvotes: 1

Views: 265

Answers (1)

Greg Buretz
Greg Buretz

Reputation: 21

The client library passes status.embeddable through to the API. The YouTube v3 API is the culprit here. I finally found a ticket from 2013 about this:

https://code.google.com/p/gdata-issues/issues/detail?id=4861

Upvotes: 1

Related Questions