Youtube Video Upload In Laravel



Published
Hello Freinds,
Welcome To My Youtube Channel...
In This Video,We Will See How To Upload Video To Youtube Step-By Step.....
First Of All Login To Google Account & Create One Youtube Channel For That Google Account To store uploaded video...
To get started, you need to have a Google Account. On the Google account, you need to register your application and get the API keys.

Below are the steps to register an application and grab the API keys.

Go to the Google Developer Console.
Create a new project. You can also select the existing project.
Type a name of your project. Google Console will create a unique project ID for you.
Upon creating a project, it will appear on top of the left sidebar.
Click on Library from the left menu. You will see a list of Google APIs. Enable the YouTube Data API.
Next, from the left menu click on the Credentials. Select Oauth Client id under Create credentials. Choose the radio button for Web Application.
Give the Name. Under Authorized JavaScript origins enter your domain URL. In the Authorized redirect URIs add the link of the redirect URL as http://localhost:8000/youtube/callback. I am passing my local URL here. You should adjust this URL with your domain.To authorize youtube and store youtube accessToken use http://localhost:8000/youtube/auth url.
Finally, click on the Create button. You will get a client ID and client secret in the pop-up. Copy these details. We will require it soon.

Step-1:Setup & Create Laravel Project With Database Credentials
Step-2:install the joedawson/youtube library to your Laravel project With this Command
composer require dawson/youtube
Step-3:register the service provider and aliases in the config/app.php
Step-4:publish the configuration With This Command,
php artisan vendor:publish --provider="Dawson\Youtube\YoutubeServiceProvider"
Step-5:Run php artisan migrate command to generate youtube access token table
Step-6:Open the .env file and add your client id and client secret as follows:
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
Step-7:clear the configuration cache using the command:
php artisan config:clear
Step-8:now authorize your account using the http://localhost:8000/youtube/auth URL in the browser. It will redirect to the Google login page to authenticate your account. Complete the process. On successful authentication, you will redirect back to your Laravel application. Check the youtube_access_tokens table and you should see tokens inserted in the access_token column. This is a one-time process. The library will automatically generate access_token in the background even if it is expired. The user does not need to authorize their account again
Step-8:Now create a form to browse the video file and send it to YouTube. Let’s create a controller by running the below command.
php artisan make:controller VideoController
Step-9:Create Routes For Display UploadForm & Store Video In Youtube Channel
Step-10:Create Blade/View File For UI To Upload Video From Local To Youtube Channel
Step-11:Put Appropriate Methods In Controller To Display Upload Form & Store Video On Youtube & Visit Route To Display Upload Form
Step-12:Now Test & Run With Below Commands...
php artisan optimize:clear & php artisan serve

Referal Links:https://artisansweb.net/how-to-upload-video-on-youtube-in-laravel-application/
https://github.com/joedawson/youtube
https://www.oodlestechnologies.com/blogs/integrate-youtube-upload-video-in-laravel/
Category
Web design
Be the first to comment