Step 1: Get your YouTube API Key.
Step 2: Integrate YouTube API key to Magento 2.
Step 3: Implement the Magento 2 Product video.
Step 1: Get your YouTube API Key.
To create a project:
Login to your Google account
↓
Navigate to the Google Developers Console.
↓
Click the Menu button displayed on the left corner of the page.
↓
Choose API & Services Library
↓
Click on Library → Click on Create.
Enter the project name and again click on Create.
Create YouTube API Key
After creating the project, again click on the Menu button.
↓
Choose API & Services → Library.
↓
Now you’ll be redirected to the API Library page. Scroll down and click on YouTube Data API.
Now you should be on YouTube Data API Page. Click on Enable.
You need Credentials to access API’s.
Click on Create Credentials.
↓
Select YouTube Data API as shown in the image below.
↓
Select Web Browser (Javascript) as shown in the image below.
↓
Click on What Credentials do I need.
Congratulations! You have generated an API Key.
Step 2: Integrate YouTube API key to Magento 2.
On the Admin panel of your Magento e-store, click on Stores tab from the left corner of the page.
↓
Select Configurations.
Under Catalog tab click on the catalog.
↓
Under the product video section, insert the YouTube API Key generated in the Google Developers Console.
↓
Click on Save Config.
Step 3: Implement the Magento 2 Product video.
On the Admin Panel of Magento e-store, go to the Catalog tab.
↓
Click the Products option.
↓
Click on Edit option.
Go to Images and Videos Section Select Add Video.
Enter the Product Video URL of the Youtube or Vimeo Video.
↓
Complete the title, description and upload preview image.
↓
Select Get Video Information to use the video metadata and then click on Save.
To see the results, go back to the Product page.