Skip to content
This repository has been archived by the owner on Nov 27, 2018. It is now read-only.

Commit

Permalink
Merge pull request #16 from jimpannell/master
Browse files Browse the repository at this point in the history
Added a new method called videoUpdate which enables you to change access...
  • Loading branch information
jimdoescode committed Nov 30, 2013
2 parents e0e8bc7 + b66b7a0 commit 50cfed5
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions libraries/Youtube.php
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,38 @@ public function directUpload($path, $contenttype, $metadata, $filesize = false,
return false;
}


/**
* Make a video either public or hidden
* Uses the yt:accessControl 'list' action with permission 'allowed' or 'denied'
* Need to include the media group info in order for data to not be overwritten/reset
*
* @param string $videoId The video you want to change.
* @param string $title The video's title.
* @param string $description The video's description.
* @param string $keywords The keywords you want to tag the video with
* @param string $category The category you want to put the video in
* @param string $permission Needs to be either 'allowed' or 'denied'
* @param string (optional) $user The user name whose account this video will go to. Defaults to the authenticated user.
* @param string (optional) $method Defaults to 'PUT'.
**/
public function videoUpdate($videoId, $title, $description, $keywords, $category, $permission, $user = 'default', $method = 'PUT')
{
$uri = "/feeds/api/users/{$user}/uploads/{$videoId}";
$xml = '<?xml version="1.0"?>';
$xml .= '<entry xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xmlns:yt="http://gdata.youtube.com/schemas/2007">';
$xml .= '<media:group>';
$xml .= '<media:title type="plain">'.$title.'</media:title>';
$xml .= '<media:description type="plain">'.$description.'</media:description>';
$xml .= '<media:category scheme="http://gdata.youtube.com/schemas/2007/categories.cat">'.$category.'</media:category>';
$xml .= '<media:keywords>'.$keywords.'</media:keywords>';
$xml .= '</media:group>';
$xml .= '<yt:accessControl action="list" permission="'.$permission.'"/>';
$xml .= '</entry>';
return $this->_data_request($uri, $xml, $method);
}


/**
* Writes a file specified by path to the stream specified by the handle.
* The file is written in chunks specified by the chunk size to decrease
Expand Down

0 comments on commit 50cfed5

Please sign in to comment.