user1191140
user1191140

Reputation: 1579

Specifying format parameter in PHP youTubeAPI

I am using google-api-php-client to search youtube. What I want to do is specify format=5 to filter embedable videos.

$client = new Google_Client();
$client->setDeveloperKey($DEVELOPER_KEY);
$youtube = new Google_YoutubeService($client);
$searchResponse = $youtube->search->listSearch('id,snippet', array(
  'q' => $searchStr,
  'maxResults' => $maxResultsNum,
));
foreach ($searchResponse['items'] as $searchResult) {
}

How do I specify the format=5 so it can be played in iPhone. The documentation has no reference on how to do this.

Upvotes: 0

Views: 124

Answers (1)

Ibrahim Ulukaya
Ibrahim Ulukaya

Reputation: 12877

Filter you are looking for is videoSyndicated

your call will look like

$searchResponse = $youtube->search->listSearch('id,snippet', array( 'q' => $searchStr, 'maxResults' => $maxResultsNum, 'videoSyndicated' => true, 'type' =>true ));

Upvotes: 1

Related Questions