Black Branch/Docs
All sections

YouTube

This page is for a streamer on YouTube. After it, the chat of your YouTube live streams shows on your site, your YouTube stream plays in the site's player, and your past broadcasts can be listed. Nobody signs in with Google for any of it: not you, and not your viewers.

What connecting YouTube gives you

Three YouTube features come in a later release: posting messages from the site into YouTube chat, letting viewers link a YouTube account, and carrying a ban made on the site over to YouTube. All three use a Google sign-in with YouTube permissions, which this release leaves out (see Why nobody signs in with Google). Signing in to your site with a Google account, which you can switch on in Admin Panel → Site → Site, card Sign-in providers, asks for no YouTube permission and gives the site none. Until then, YouTube chat shows in site chat, and you moderate YouTube chat in YouTube Studio as usual.

YouTube is a module, off on a new install

YouTube is a module: a part of the site with its own on/off switch. It is off on a new install. While it is off, nothing is read from YouTube and the setup pages show no YouTube page.

The ingest service (the part of your site that reads platform chat) follows this switch without a restart:

The YouTube card shows the switch the way the ingest service reports it. After you switch YouTube off, or switch it on before a channel id is saved, the card says the ingest service is still on the old value and waiting for a restart, and the site's public pages (the watch page, About and the legal page) keep treating YouTube as they did. Reading itself has already stopped, or starts once the channel id is saved. Press Restart the ingest service in the card's Pending restart box if you want the card and the pages to catch up now. More on switches: Turning features on and off.

Why nobody signs in with Google

Reading a YouTube live chat needs no sign-in: the site reads it the way a logged-out viewer's browser does, using a browser built into the ingest service, inside your install. So your viewers are never asked to connect a Google account.

The reason is Google's rules. Google treats every YouTube permission that identifies a channel as "sensitive". An app Google has not reviewed shows a "Google hasn't verified this app" warning on its sign-in screen and may sign in at most 100 accounts, ever (Google: unverified apps). Getting reviewed is a long process meant for companies. Leaving Google sign-in out keeps your site free of the warning and the cap; the three sign-in features above come later.

What you need first

Step 1: your channel id

  1. Open the YouTube setup page (or Admin Panel → Platforms → YouTube).
  2. Paste your channel id into YouTube channel id.
  3. Save.

That is enough to read chat. A changed channel id applies by itself within a few seconds; no restart is needed.

The setup page's YouTube step notes that posting site chat into YouTube chat comes in a later release, and that viewers are never asked to sign in with Google. There is nothing else to fill in.

An API key is a code that lets your site ask YouTube's official API questions. It identifies your Google Cloud project; it does not sign in as anyone and cannot act on your channel.

What the key adds:

Make the key in Google Cloud

Google's overview is YouTube Data API: getting started.

  1. Sign in to the Google Cloud console with any Google account. It does not have to be the channel's account.
  2. If you have no project yet, Google asks you to create one. Name it anything, for example casey-site. A billing account is not needed for this API.
  3. Open the YouTube Data API v3 page and press Enable.
  4. Open Credentials, press Create credentials, then API key. Google shows the new key.
  5. Open the key's settings. Under API restrictions, choose Restrict key and tick only YouTube Data API v3. Leave Application restrictions at None. Save.
  6. Copy the key. It starts with AIza and is 39 characters long.

Restricting the key matters: if it ever leaked, it could only read public YouTube data, nothing else in your Google account. Google explains this in API key best practices.

Paste the key into your site

  1. Paste the key into YouTube Data API key on the setup page (or Admin Panel → Platforms → YouTube). It is stored encrypted.
  2. Press Check. With a channel id saved, the site asks YouTube for that channel, which costs one unit of quota.
Result Meaning
accepted The key works and the channel exists
not found at the provider The key works, but no channel has that id
rejected Google refused the key

Past broadcasts (optional)

To list past broadcasts, make a public YouTube playlist of them and copy its id: it starts with PL and is the part after list= in the playlist's address. The playlist is a value kept on your server, because the website reads it when it starts. The YouTube card shows it as VOD playlist, locked. On the server, run (with your own playlist id):

sudo blackbranch set YOUTUBE_VOD_PLAYLIST PLaBcDeFgHiJ

The website restarts with it. Without a playlist there is no VODs card anywhere. More on values kept on the server: Settings that live on the server.

The permissions (scopes)

There are none. Nobody signs in with Google, so Google never shows an approval screen, and an API key carries no scopes.

How to check it worked

  1. Go live on YouTube and send a chat message there. Within a few seconds it appears in site chat with the YouTube mark.
  2. If it does not, open the site's Stream tab (admins only, beside Home). It shows the YouTube reader as Reading, Starting, Failed with its reason, or Off.
  3. In Admin Panel → Doctor, the rows Chat readers started and Each switched-on module's Test passes cover YouTube.

Common problems

What you see What it means What to do
No YouTube setup page, or the guide says "Switched off" The YouTube module is off Switch on YouTube at the top of Admin Panel → Platforms → YouTube.
The Stream tab shows YouTube as Off The module is off, or no channel id is saved Check both.
Nothing from YouTube while you are live The channel id is wrong: a handle instead of the UC… id is the usual cause Paste the id from advanced settings.
The YouTube reader failed with a reason that starts "browser missing" The ingest service cannot start its built-in browser The installed release ships the browser, so this points at a damaged install. Run sudo blackbranch logs stream-ingest and see Logs, restarts and repairs.
rejected (HTTP 400) Google says the key is not valid Copy it again, and check that the YouTube Data API v3 is enabled in the same project.
rejected (HTTP 403) The key exists but may not call this API Under the key's API restrictions, make sure YouTube Data API v3 is ticked.

Next: Streamplace

← Connect your platforms