Youtube is one of the world best online video store to upload and watch video free online. We can easily upload video’s, even large video files are also uploaded to youtube. Now in this tuts i will explain you that how we can create live video in our site and directly upload that video from site to our youtube account.

Google youtube developer create a widget that help us to create video online in our site and upload that video to youtube. Configuring youtube widget is very easy you simply need to embed the widget code where you want to use that in your website and remaining thing are done by widget relay very easy but interesting thing.

Live Demo

Youtube widget Code:

<!DOCTYPE html>
<html>
  <body>
    <!-- 1. The 'widget' div element will contain the upload widget.
         The 'player' div element will contain the player IFrame. -->
    <div id="widget"></div>
    <div id="player"></div>

    <script>
      // 2. Asynchronously load the Upload Widget and Player API code.
      var tag = document.createElement('script');
      tag.src = "https://www.youtube.com/iframe_api";
      var firstScriptTag = document.getElementsByTagName('script')[0];
      firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

      // 3. Define global variables for the widget and the player.
      //    The function loads the widget after the JavaScript code
      //    has downloaded and defines event handlers for callback
      //    notifications related to the widget.
      var widget;
      var player;
      function onYouTubeIframeAPIReady() {
        widget = new YT.UploadWidget('widget', {
          width: 640,
          events: {
            'onUploadSuccess': onUploadSuccess,
            'onProcessingComplete': onProcessingComplete
          }
        });
      }

      // 4. This function is called when a video has been successfully uploaded.
      function onUploadSuccess(event) {
        alert(event.data.videoId);
      }

      // 5. This function is called when a video has been successfully
      //    processed.
      function onProcessingComplete(event) {
       //alert(event.data.videoId);
      }
    </script>
  </body>
</html>

When you creating a video with this you need to login  to your google account so that your video is upload to your youtube account. This is the only thing this widget need to make your video upload to youtube from your site.