Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

c# - YouTube API integration ASP.NET - upload video with a single page

we are trying to use the Google YouTube API to upload videos from our website to YouTube through the browser directly.

The API works in two steps, in the first step we need to create an Video object with all the metadata like title,tags,description, category etc. Then we need to send a request with this object to YouTube and get a Token object generated as a response. This token object has a Token Value and a Token URL as its members.

In second step they suggest that we should create a Form with the action attribute set to the Token URL. This form should have a file upload control and a hidden field with the Token Value as its value. When this form is posted, it would upload the video to YouTube.

This works great if we have it as a two step process, asking users for the metadata first and then redirecting them on to second page for the actual video upload. However, we are trying to accomplish this in a single page, appearing as a single step to the user.

We have a MasterPage with the 'aspnetForm' specified in it, because of which we cant have another form with runat='server' property.

We have tried modifying the aspnetFrom's action attribute using JavaScript/code-behind but it stays the same, whatever we do.

We have also tried to put another nested form, whose action tag would be set on the button click event, after the first response from YouTube with token is received. But even this doesn't work, as the form isn't created at the time this method is called..

We have tried several approaches but none seems to work.. any suggestions on this would be great.

If you have any more questions to understand the situation clearly.. please let me know..


Update:

Thanks for the responses guys.

We changed the business logic a little bit to resolve the issue. It was long back and I am not looking for a resolution as of now..

However, the question is still open and getting responses. I really appreciate all the help and hence, would leave the question open for any further discussions.

See Question&Answers more detail:os

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

1 Reply

0 votes
by (71.8m points)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...