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
- YouTube live chat in site chat, read while you are live.
- Super Chats, Super Stickers, new memberships, membership milestones and gifted memberships as alerts.
- Removals mirrored: when a YouTube moderator removes a message, or hides or bans a person, in YouTube chat, it disappears from site chat too.
- Live detection: the site notices when you go live on YouTube and when you stop.
- Your YouTube stream in the site's player.
- Past broadcasts (optional): a VODs card on Home and VODs tabs, from a YouTube playlist you choose.
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.
- During setup: on the Modules page of the setup pages, switch on YouTube. A YouTube page then appears in the setup steps.
- Later: open Admin Panel → Platforms → YouTube. The switch, YouTube, is the first row of the YouTube card. The page's guide, How to set up YouTube, says "Switched off" until you switch it on.
The ingest service (the part of your site that reads platform chat) follows this switch without a restart:
- Switched on, with a channel id saved: it starts reading within a few seconds.
- Switched off: it stops reading at once.
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
- Your YouTube channel id: a code that starts with
UC, for exampleUCaBcDeFgHiJkLmNoPqRsTuV. It is not your@handleand not your channel's display name. To find it, open YouTube's advanced settings while signed in as the channel, or in YouTube Studio go to Settings → Channel → Advanced settings, and copy the value labelled Channel ID. - Optionally, a Google account to make an API key in Google Cloud (free; step 2).
Step 1: your channel id
- Open the YouTube setup page (or Admin Panel → Platforms → YouTube).
- Paste your channel id into YouTube channel id.
- 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.
Step 2: a YouTube Data API key (optional, recommended)
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:
- Live detection: the site finds your live stream sooner. Without a key it checks your channel's live page instead.
- A check of the channel id, with the Check button.
- Past broadcasts: the site reads your playlist through the API. Without a key it reads the playlist's public page, which also works.
- Your channel picture, read from YouTube.
- Account-age checks: the site can see how old a YouTube chatter's channel is, which helps spot throwaway accounts. The lockdown's account-age lever holds YouTube chatters only when a key is set; without one, the lever says "age unknown" for YouTube and lets them through.
Recommended: make the key. It is free, takes a few minutes, and YouTube's free daily allowance (its "quota") is far more than the site uses.
Make the key in Google Cloud
Google's overview is YouTube Data API: getting started.
- Sign in to the Google Cloud console with any Google account. It does not have to be the channel's account.
- 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. - Open the YouTube Data API v3 page and press Enable.
- Open Credentials, press Create credentials, then API key. Google shows the new key.
- Open the key's settings. Under API restrictions, choose Restrict key and tick only YouTube Data API v3. Leave Application restrictions at None. Save.
- Copy the key. It starts with
AIzaand 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
- Paste the key into YouTube Data API key on the setup page (or Admin Panel → Platforms → YouTube). It is stored encrypted.
- 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
- Go live on YouTube and send a chat message there. Within a few seconds it appears in site chat with the YouTube mark.
- 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.
- 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