3

I want to upload a video to youtube using javascript. Currently, I can login and get the list of the videos, but I do not know how to write the snippet to upload files.

I used google js api Link1 and youtube v3 api Link2

var requestOptions = {
playlistId: playlistId,
part: 'snippet',
myRating:'like',
maxResults: 1
};
var request = gapi.client.youtube.videos.insert(requestOptions);

I am using the above code to get video list items, but not sure how to continue to upload a video.

1

1 Answer 1

2

[Edit] CORS is supported now in v3 and here's latest answer. https://stackoverflow.com/a/19691307/1973552

Right now there is a problem on v3 due to CORS. For now you can use v2 if Javascript implementation is urgent. Here's an example.

On the other hand, we are hoping to get v3 fixed really soon for Javascript uploads and that will be the long term solution.

Sign up to request clarification or add additional context in comments.

2 Comments

can you tell me what is the problem of v3. I find firefox works on CORS as XMLHttpRequest and for IE, it has XDomainRequest object. So, I think it should not be a problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.