Overview
The Media Sync plugin for YouTube provides a one-way sync
from your YouTube channel into your Rock instance. When you upload a video into
YouTube, it will be automatically created in Rock. The only way to play a
YouTube video is with an embedded player to their site. Therefore, you will not
get true video URL links that can be used to download the video. Don’t worry,
this will still work with the Rock Media Player.
At present this plugin will not synchronize YouTube
playlists to media folders. Instead, a single folder will be created called “Library”.
Feel free to rename this if you want. All public videos in the channel will be
synchronized into this one folder. Private and unlisted videos are not
synchronized since they cannot be easily embedded.
Note
YouTube has rather low quotas for their API calls.
Because of this, the refresh functionality is not supported so the account will
only be synced when a full-sync happens, which is by default once a per day.
This also means nothing will happen when a user clicks the refresh button in
the media element picker.
Configuration
For the plugin to access your YouTube channel you need to
configure a few things on YouTube. Specifically, you need to configure an
authentication token for the plugin to use.
Configuring YouTube
To generate an authentication token, you need to go to https://console.cloud.google.com/apis/dashboard.
Near the top in the blue header, you should see a drop down that says “Select a
Project”, or it may already have a project name in it. Click on that to open
the project selector dialog. Then in the upper right corner click the “New
Project” link. You can enter anything you want for Project Name, but we
recommend “Rock Production”. After you click the Create button you should see a
small progress dialog come up telling you it’s creating the project. Once that
is done click the “Select Project” link.
After the project is created, we need to enable it to use
the YouTube API. Click on the “Enable APIs And Services” link. Search for “YouTube”
and then select the “YouTube Data API v3” option. Next click on “Enable”. After
that is done it will take you to the page for this API so we need to go back to
our previous page. In the top left, click the hamburger menu and then go to
APIs & Services > Credentials.
Up top on this page you should see a “Create Credentials”
link. Click on that and then select API Key. Copy the API key it generates for
use later in setting up Rock. Then click the “Restrict Key” button. On the
restrictions page update the name of the key to something like “YouTube Access”.
Towards the bottom of the page, you will see a section for “API restrictions”.
Under that click the “Restrict key” radio button and then in the drop down
select the “YouTube Data API v3” option. Click the Save button at the bottom
and your API key will then be ready for use in Rock.
Configuring Rock
There is one last piece of data we need before we can setup
the media account in Rock. You are going to need to know what your channel
identifier is in YouTube. Don’t worry, it’s easy to find. Go to YouTube and
make sure you are logged into your account. Under your Profile picture click
“Your Channel” and it will take you to your channel page. Now the URL will look
something like https://www.youtube.com/channel/your-channel-identifier. As you
might guess, the part of the URL you need is where “your-channel-identifier”
is.
In your Rock instance, you need to go to your Media Accounts
page and add a new account that will be synced with YouTube. Set the Account
Type to “YouTube Media Sync” and then enter the API key you previously in the
Authorization Token field. You will also need to put that channel identifier in
the Channel Id field and then you can save the account.
If you wish, you can click the Download button on the
account details screen to initiate a sync to YouTube right away, or you can
wait for the Rock job to run and perform the sync for you.