Upload videos to youtube with javascript and without signing in to google -


i want allow visitors of site upload videos youtube channel.

i don't want force visitors sign in google.

i want upload sent visitors browser directly youtube using cors or similar. see example below.

i don't want handle video on server. don't idea of server first receiving 1gb (example) file , sending youtube. stress storage capabilities , bandwidth.

the example below perfect.

the problem requires user sign in user google account.

what i'm wondering if somehow can give client proper credentials use account upload video.

is possible? can perhaps generate kind of access token server side , send client client can upload video youtube under name?

can done without giving client ability other stuff such delete videos / edit account etc?

example here: https://youtube-api-samples.googlecode.com/git/yt-upload-javascript/index.html

it possible. i'm building similar @ moment. general idea store secure secret data on server. (client secret, refresh token etc)

then when client wants upload video youtube, check (via server ) if token has expired (1hr expiration time).

if has need request new access_token youtube , pass client them use.

just info, using moment.js timekeeping , meteor.js app.

var = moment();  var result;  if (now.diff(meteor.settings.youtube.expiration, 'minutes') >= 50) {    console.log('getting new access token...')      var options = {      headers: {        "content-type": "application/x-www-form-urlencoded"      },      content: "client_secret=" + meteor.settings.youtube.client_secret + "&grant_type=refresh_token&refresh_token=" + meteor.settings.youtube.refresh_token + "&client_id=" + meteor.settings.youtube.client_id    }      try {      result = http.call("post", 'https://www.googleapis.com/oauth2/v3/token', options);      meteor.settings.youtube.access_token = result.data.access_token;      meteor.settings.youtube.expiration = moment();        return meteor.settings.youtube.access_token;    } catch (e) {      // got network error, time-out or http error in 400 or 500 range.      return false;    }      } else {    console.log('returning access token...')    return meteor.settings.youtube.access_token;  }


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

python - Django-cities exits with "killed" -

python - How to get a widget position inside it's layout in Kivy? -