5. Youtube API : Direct Upload

Posted: 24/12/2013 in Youtube API
Tags: , ,

This process involves uploading a video stored on your server to YouTube.

The metadata field is the API_XML_Request as defined in the YouTube API documentation and the contenttype is the MIME-type of the video to upload and Video URL.

$videoPath = 'D:\BlackBerry120.3gp';
$videoType= "video/3gpp";
$params['apikey'] = 'API-Key';
$params['oauth']['key'] = 'xxxxxxxxxxxx.apps.googleusercontent.com'; // Key
$params['oauth']['secret'] = 'xxxxxxxxxxx'; // Secret
$params['oauth']['algorithm'] = 'HMAC-SHA1';
$params['oauth']['access_token'] = array('oauth_token'=>urlencode($this->session->userdata('oauth_token')),
'oauth_token_secret'=>urlencode($this->session->userdata('oauth_token_secret')));
$this->load->library('youtube', $params); $metadata = '<entry xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xmlns:yt="http://gdata.youtube.com/schemas/2007"> <media:group> <media:title type="plain">Test Direct Upload</media:title> <media:description type="plain">Test Direct Uploading.</media:description> <media:category scheme="http://gdata.youtube.com/schemas/2007/categories.cat">People</media:category> <media:keywords>test</media:keywords> </media:group> </entry>'; echo $this->youtube->directUpload($videoPath, $videoType, $metadata);

Refereed By : Google API’s

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s