youtube-live
YouTube Live
This module will allow you to control YouTube live events/broadcasts.
The module is only able to manipulate predefined broadcasts, it is currently not capable of creating them. So all broadcasts to be controlled by the module have to be created in the YouTube Studio first.
Available actions
- Start broadcast test - This action initializes a YouTube broadcast. You'll need to explicitly use this only if you want to launch the so-called "monitor stream" of a broadcast. The same goal can be achieved by visiting the Live Control Room of the broadcast when the associated input stream is active.
- Go live - This action starts a YouTube broadcast and makes it available for the public.
- Finish broadcast - This action ends a published YouTube broadcast.
- Advance broadcast to next phase - This action combines the above actions into one action (off → testing → live → finished).
- Refresh broadcast/stream feedbacks - This action triggers immediate refresh of broadcast lifecycle status/ stream health and their feedbacks/variables. This can typically be useful for quickly checking if your RTMP stream data has successfully reached the corresponding YouTube endpoint.
- Reload everything from YouTube - This action forces all cached data to be reloaded from YouTube. This can be used to make broadcasts created after Companion startup appear in the Companion UI.
- Send message to live chat - This action sends a message (200 chars max.) to a YouTube broadcast's live chat.
- Insert advertisement (cuepoint) - This action inserts an advertisement to the YouTube broadcast.
- Set visibility - This action sets the visibility of the specified broadcast.
- Set title - This action sets the title of the specified broadcast.
- Set description - This action sets the description of the specified broadcast.
- Prepend text to description - This action inserts the given text at beginning of the description.
- Append text to description - This action inserts the given text at end of the description.
- Add chapter timecode to description - This action inserts a chapter timecode at the end of the description.
Configuration
Connecting to YouTube account
In order to set up module, you need to authorize it for accessing your channel via the YouTube Data API. For this you will need to create a new Google API application. This is done via the Google API console:
-
Log in to the API console with your personal Google account.
-
Create a new project (name of the project doesn't matter, but we suggest something as companion-yt-control).
-
Enable YouTube Data API v3 for the project - the easiest way to do so is to search for it and click on enable on its page.
-
Go back by clicking the Google APIs logo. Then, click on OAuth consent screen on the sidebar and fill in the following information:
- User Type: External (do not worry, there is no need to submit the app for verification)
- Application name: YouTube Live (the exact name does not matter)
- Scopes for Google APIs: add `https://www.googleapis.com/auth/youtube.force-ssl
-
Head to Credentials page. Select Create credentials on the top bar and pick OAuth client ID.
Create the client ID with these options:
- Aplication type: Web application
- Name is not important, its only used to identify created credentials in the API console
- Authorized redirect URLs: This is where the Google OAuth server will forward the authorization grant, so it
must be the same as the OAuth redirect url parameter set in Companion (by default
http://localhost:3000
)
After creating these credentials, copy client ID and client secret into corresponding fields in the module instance cofiguration in Companion.
-
When first configuring the module, make sure that the Authorization token field in instance configuration is empty.
-
After applying changes to module configuration, you will be redirected to your OAuth consent screen to authorize module for accessing your YouTube channel. Proceed with the account with which you want the module to interact.
When all above is done, the module is ready for work.
Action configuration
When creating buttons for either starting or stopping a broadcast, you should pick the broadcast to work with using the provided dropdown menu. It should contain all broadcasts present on the channel.
Thanks
Big thanks to members of AVC Silicon Hill, for inspiration for further development.