Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

youtube api v3.0 Browser-based Uploading in php

i'm trying (php) to upload a video (browser based not storing video in my app want to upload straight to youtube).

I cant find any docs on this. Eg like this https://developers.google.com/youtube/2.0/developers_guide_php#Browser_based_Upload

But for v3.0 i'm looking at the code that is provided (3.0) but cant see a way to get video (ie $videoPath = "/path/to/file.mp4") without storing (temporarily in my app).

// REPLACE with the path to your file that you want to upload
$videoPath = "/path/to/file.mp4";

// Create a snipet with title, description, tags and category id
$snippet = new Google_VideoSnippet();
$snippet->setTitle("Test title");
$snippet->setDescription("Test description");
$snippet->setTags(array("tag1", "tag2"));
like image 393
louie172 Avatar asked Mar 22 '23 20:03

louie172


1 Answers

There's now support for resumable uploads using CORS in the YouTube Data API v3.

A rough, but working, example at https://youtube-api-samples.googlecode.com/git/yt-upload-javascript/index.html (source files at https://code.google.com/p/youtube-api-samples/source/browse/#git%2Fyt-upload-javascript) that shows the upload flow, using the Google+ sign-in button to handle OAuth 2 (you can use the normal OAuth 2 browser client flow if you'd prefer) and with a progress indicator. It also shows how you could poll for video processing status following an upload and embed the resulting video on a page once it's been processed.

like image 172
Ibrahim Ulukaya Avatar answered Apr 02 '23 08:04

Ibrahim Ulukaya