Here is a sample call with the video to upload in the CI root directory:
$xml = '<?xml version="1.0"?><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 Video</media:title><media:description type="plain">This is a direct upload test</media:description><media:category scheme="http://gdata.youtube.com/schemas/2007/categories.cat">People</media:category><media:keywords>test, upload</media:keywords></media:group></entry>'; $this->youtube->directUpload("test.3gp", 'video/3gp', $xml);
You may wish to note that uploading a large file could take awhile and this library doesn't currently support resumable uploads so you just have to wait it out if things are taking awhile. As always you can turn on the DEBUG flag at the top and watch your error log for more info on what is going on.
While I was in there I took the liberty to fix a bug where only a response of 200 was deemed success by the library now any 200 level response is considered successful as it should be.
Here is the updated library: http://dl.dropbox.com/u/13081549/youtube.php
If you are new here consult my other posts for more information.
I got my consumer key and secret and my youtube developer key,How does one get the access key ie
ReplyDelete$params['oauth']['access_token'] ??
Works like a charm. It never seems to return the response from youtube though, even though it uploads correctly. Is that the way it's supposed to work? Or am I missing something....
ReplyDeleteAccording to the Developers Guide: "When you submit an Upload API request, the API returns an Atom entry that contains information about the uploaded video. The entry has the same format as an entry that would appear in a user's uploaded videos feed."
ReplyDeleteSo something is not working correctly. I will investigate it further.
For some reason direct upload does not return a chunk size which the read method requires. I fixed the read method so that it will attempt to handle situations with no chunk size. That seems to have resolved the issue.
ReplyDelete