How to upload Product Videos in Magento 2 - Youtube API Key
Vinh Jacker | 04-14-2016
                            Are you wondering how to attract and persuade customers more effectively? The answer is, show them, don’t tell them. To help your products be more attractive and lively, Magento 2 allows uploading individual video for any product you need. Videos comprise all kinds of medium, from images to audios, hence being a powerful method to convey any messages. That is why watching Magento product video will bring a true overview of your product to customers before purchasing. The more visual a product is, the more sales is created by the clients.
The video can be uploaded from your browse or you can embed the Youtube link to the product settings. To do that, you must get an API Key from your Google account and insert it in the configuration.
The required steps you should follow are listed clearly in this tutorial.
3 Steps to Upload Product Videos in Magento 2
Step 1: Get Your YouTube API Key
First, you have to get your YouTube API Key by going to your Google account:
- Log in to your Google account, and visit the Google Developers Console. Then, follow these:
    
- Under Use Google APIs, click 
Youtube Data APIs.
 - Click on 
Manage
 - In the panel on the left choose 
Credentials, click onCreate Credentialsand chooseAPI key.
 - When prompted to create a new key, choose 
Server key. Enter a name for the key and IP address, and click onCreate. 
 - Under Use Google APIs, click 
 - After you get the key, copy the key to the clipboard.

 
Step 2: Configure in Magento
Now, come back to the Magento and finish the settings:
- On the Admin Sidebar, 
Stores > Settings > Configuration. - In the panel, under Catalog, choose 
Catalog. - Expand the 
Product Videossection, paste Youtube API key into the required field. 

- Click 
Save Config. - Go to Cache Management to refresh the cache.
 
Step 3: Link to Video
Add the video on your site and everything will be set!
- From the 
Product Detail, click onAdd Videoin theImages and Videos. 

- Enter the URL of the YouTube or Vimeo video. In the 
URLfield, if you haven’t entered the Youtube API key yet, the system error message will appear, click onOKto continue. 

- Enter the 
TitleandDescriptionof the video. - To upload a Preview Image, browse to the image and select the file.
 - If you prefer to use the video meta data, click on 
Get Video Information. - To assign the role to the video, mark the corresponding checkbox of each Role:
    
- Base Image
 - Small Image
 - Swatch Image
 - Thumbnail
 - Hide from Product Page
 
 - When complete, click on 
Save. 

Options for Magento 2 Product Video Configurations
You can adjust various product video choices in the config.xml setup file. You can modify these settings within your custom module’s file.
| Option | Default Settings | What this option offers | Types | 
|---|---|---|---|
| play_if_base | Videos are not played on the page load | Videos are played automatically on the page load | Boolean | 
| show-related | Related videos are not shown | Admin can show related videos | Boolean | 
| video-auto-restart | Videos are not automatically replayed | Videos are replayed automatically | Boolean |