Setup Guide

  1. Description
  2. Features
  3. Requirements
  4. How does it work
  5. Create your Google API App
  6. Get your App Credentials
  7. Script Installation
  8. Running the Script
  9. Integration
  10. Options
  11. Credits and Resources

1. Description

YouTube Video Uploader 3.0 is a YouTube API-based PHP script that lets you add YouTube uploading functionality to your own website or web application. It allows your users to upload videos directly to your own YouTube Channel, without the need to sign in to YouTube or even have Google Account. The script uses the latest version (3.0) of YouTube Application Programming Interface (API) to upload videos and and set the video's metadata (title, description, tags, status, and category). The script uses Google OAuth 2.0 endpoints to create web server application that use OAuth 2.0 authorization to access Google APIs. OAuth 2.0 allows you to share specific data with an application while keeping your Google Account usernames, passwords, and other information private.

While videos are being uploaded, progress bar show the current video upload progress so your users don’t have to second guess how long uploading videos is going to take.You can also set video file size limit and video types with ease to ensure your website is free from abuse.

To make this script work, you’ll need to create and authorize an app in Google Developer Console at https://console.developers.google.com (very easy, see instructions).You can integrate this script in any application with minimum effort and without the need to use MySQL unless you need to save user's logs and info.

2. Features

  1. Upload videos directly from user's browser to your YouTube channel without the need to worry about your account credentials.
  2. Uses the latest version (3.0) of YouTube Application Programming Interface (API) to upload videos and and set the video's metadata.
  3. Many aspects of the script are fully customizable, allowing you the freedom to create an uploader that does exactly what you need it to. In addition, you need to add just two lines of code in your pages to integrate the video uploader.
  4. HTML5 file uploader for ultimate compatibility.
  5. Real-time uploading progress bar indicator, so users do not have to second guess how long uploading files is going to take.
  6. Set video size limits and video type limits with ease to PASS/GET video data.
  7. Ease of workflow and usability for the application.

3. Requirements

Video Uploader 3.0 was designed to make implementation as easy as possible. Before purchasing or implementing, make sure you meet the minimum requirements:

  • A server capable of parsing PHP (5.2.0 or higher).
  • jQuery 1.4.x or greater.
  • Any HTML5 compatible browser (e.g., Chrome, FireFox, MS Edge, etc.)
  • 4. How does it work?

    Actually, your server, not the user, who authorize and upload video to your YouTube channel, not the user. The user only upload the video to a temporarily directory in your server.

    1. The client part of Video Uploader 3.0 acquires the video from user and uploads it to your server temporarily.
    2. The YouTube Data API supports the OAuth 2.0 protocol for authorizing access to your YouTube account via the application Key. When the script first attempts to upload video to YouTube account, Video Uploader 3.0 initiates the OAuth 2.0 authorization process.
    3. The script then uses YouTube API to upload the video from your server to your YouTube channel.

    5. Create your Google API App


      Watch on YouTube

    1. Sign-up for a new Google account if you do not have an account yet, or if you need to have separate account for your Video Uploader 3.0 (recommended).
    2. Sign-in to your Google account then go to Google Developer Console at https://console.developers.google.com, then "Enable and manage APIs" in the Getting Started page.



    3. Enter your project name (it could be anything, like My Video Uploader) and click "Create" button.



    4. A project will be created and you will be forwarded to the API Manager page below. If not, open the left-hand side menu then click on the API Manager link.
    5. A page with a list of Popular APIs categories appears as shown below. Under "YouTube APIs" category click in the first link "YouTube Data API" then click the "Enable" button at the top-left of the page to enable YouTube Data API v3.



    6. Get your App Credentials

    1. Click "Go to Credentials" button, or "Credentials" link in the left-hand API Manager menu. Click "Create Credentials" drop-down menu then select the first option (API key).
    2. A new dialogue box titled "Create a new key" pops-up with four options. Click "Server key" option. In the "Name" text box enter any name for your application (e.g., viduploader3) and leave the IP address empty (you can update later for secure ). Click create button to finish.
    3. A pop-up box appears with your API key.





    4. Click the "OAuth consent screen" tab at the top and enter "Product name shown to users" (it could be anything, like viduploader3).



    5. Once again (the same as step 1), click on the "Create Credentials" drop-down menu then select the second option (OAuth client ID). A list of types of applications will be displays. Select the first application type (Web application) and enter any name for your Web application (e.g., viduploader3).




    6. Under the "Restrictions" section leave the first text box (Authorized JavaScript origins) empty and in the "Authorized redirect URIs" text box copy and paste the following URL:

      http://example.com/viduploader3/upload_to_youtube
      Change "example.com" to your server address or domain name and make any changes to point to "viduploader3" directory in your server if necessary. This is very important to get your script work.

    7. Click "Create" button to finish and get your OAuth client. A pop-up box appears with your "client ID" and "client secret".

    7. Script Installation

    These steps will be done once only:

    1. Unzip the viduploader3.zip to the root directory or any other directory in your server. A new directory (/viduploader3) will be created with the following structure and files:
      /css
      /documents
      /images
      /js
      /license
      /upload_to_youtube
      /uploads
      install.php
      index.ph

    2. Load install.php file in your browser (example: http://example.com/viduploader3/install.php).

    3. Fill out the installation form with your API credentials and click install button. You will be prompted to confirm login using the same account you have just used to create the API app. Click "Allow" button to complete installation. (happen for ONE tine only).



    4. If authorization was successfull, you will be directed to the video upload form to uplod your first video (example: http://example.com/viduploader3)

    8. Running the Script

    1. Load http://example.com/viduploader3 in your browser
    2. Completing all form fields are mandatory according to the form validation options.
    3. Select the video you need to upload the click the Upload button and watch the uploading progress bar.
    4. If upload is successful, you will be redirected to viduploader3/videopage.php which could be any page in your server to PASS, display or save to MySQL the video data (e.g., key, title, description, etc.), update user's records, or notify the site admin for new uploads.
      Example:

      /viduploader3/videopage.php?video_key=Y1aMWduy&title=MyVideoTitle&desc=MyVideoDescription

    9. Integration

    1. If you need to integrate the form in any of your existing pages (e.g., mypage.php) just add the following two lines:

      // in the head section of your page
      <?php include ("uploader_head.php"); ?>

      // in the body of your page and where you need to show the upload form
      <?php include("uploader_form.php"); ?>

    2. It is very recommended to place the page in which you need to integrate the form (mypage.php) inside the viduploader3 directory to avoid any errors, at least at the beginning and until you get familiar with the script structure.

    10. Options

    Form options
    Two form options are founded in the viduploader3/uploader_form.php file: video file size and video type. Other options should NOT be changed:

    'fileSizeLimit' : '1024 MB' // other examples: '1000 KB'or '1 GB' ,
    'fileType' : ['video/x-ms-wmv', 'video/mp4', 'video/x-msvideo', 'video/x-sgi-movie', 'video/x-flv', 'video/webm', 'video/3gpp'],

    GET options and destination page
    Many video data are found in viduploader3/upload_to_youtube/processing.php and can be processed for saving or passing to other pages:

    $title=$_GET["title"];
    $desc=$_GET["desc"];
    $tags=$_GET["tags"];
    $status=$_GET["status"];
    $cat=$_GET["cat"];

    Also, you can change "videopage.php" in [window.location = "../videopage.php"] to your own destination page after uploading the video.

    11. Credits and Resources

    1. YouTube Data API Reference
    2. Google APIs Client Library for PHP
    3. PHP Server-Side YouTube V3 OAuth API Video Upload Guide (Special thanks to Dom Sammut)



    Contact us: viduploader3@gmail.com