How to Upload Videos Using YouTube API Key in Magento 2?

Today, we’re going to teach you guys how to upload videos using Youtube API Key in Magento 2.

Videos help to better present your products and make them more attractive and lively on your online store.

In other words, videos help to get a truly complete overview of your products to your customers so that they can make the right decision.

And Magento 2 allows uploading videos to individual products directly using the Youtube API Key.

Also read: How to Add a Video to a Product Programmatically in Magento 2?

In this tutorial, we will show you exactly how to upload videos using Youtube API Key in your Magento 2 store.

Step-by-Step Process to Upload Videos Using Youtube API Key in Magento 2

Below are the steps you need to follow to learn how to upload videos using Youtube API Key in Magento 2.

Step #1 - Get Youtube API Key

First of all, login to your Google account and go to the Google Developers Console website.

After that, do the following:

  • Navigate to Use Google APIs tab and click on the “Youtube Data APIs”.

Get YouTube API Key

  • Now, click on the “Manage” button as shown in the below screenshot.

  • Next, click on the “Credentials” from the left-side panel, then click on the “Create Credentials”, and lastly select “API Key”.

  • Now, in the next screen, select “Server Key” and then write a name for the key and IP address and click on the “Create” button.

As you click on the Create button, the API key will be created as shown in the image above.

Now, copy the key to the clipboard.

Step #2 - Configure Key in Magento

Once you’ve the key, you need to configure it in your Magento 2 backend.

For this, open the admin panel and navigate to Stores > Settings > Configuration.

Then, open the Catalog tab from the panel and click on the “Catalog”.

After that, click on the “Product Videos” to expand the section and paste your Youtube API Key in the given field.

Now, click on the “Save Config”.

And lastly, open the Cache Management and refresh the cache.

Step #3 - Link to Video

First of all, go to the “Product Detail” and click on the “Add Video” in Images and Videos.

Now, enter the URL of your product Youtube or Vimeo video in the URL field.

Next, write the “Title” and “Description” of your product video.

If you want to upload a preview image for your video, click on the “Browse” button and select an image.

Write the Title and Description of your product video

And if you rather prefer using video metadata, then click on the “Get Video Information” button.

Now, if you want to assign a role to your video, you can do so by marking the corresponding checkbox from the below options:

  • Base Image
  • Small Image
  • Swatch Image
  • Thumbnail
  • Hide from Product Page

Once you’ve marked any of these checkboxes, click on the “Save” button to finish the configuration.

Also read: How to Add Custom Product Video in Fotorama Gallery?

Concluding Thoughts…

And it’s done!

This is how you can upload videos using Youtube API Key in Magento 2.

We hope that you found this tutorial helpful. If you have any doubts, please ask them in the comments below.

And if you want our professional assistance, feel free to contact us anytime.