Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
771 views
in Technique[技术] by (71.8m points)

video - 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"));
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...