YouTube Live Auto-Broadcast
YouTube Live Auto-Broadcast Setup Guide
Applies to: Current VideoHub360 theme package
The YouTube Live Auto-Broadcast system lets VideoHub360 check a YouTube channel for live broadcasts and automatically create or update a VideoHub360 livestream post when the channel goes live.
This is useful for churches, creators, businesses, schools, and communities that already stream on YouTube and want the live broadcast to appear automatically on their VideoHub360 site.
What This Feature Does
When configured, the system can:
- Check a YouTube channel for an active live broadcast.
- Create a VideoHub360 video post automatically when a live stream is found.
- Update an existing VideoHub360 post instead of creating a new one.
- Display the YouTube live video on the single video page.
- Import the YouTube thumbnail as the featured image when enabled.
- Show the live badge while the stream is live.
- Remove the live badge when the YouTube live broadcast ends.
- Keep the YouTube replay/embed available after the stream ends when replay behavior is enabled.
- Check only during expected live windows so the site does not constantly call YouTube.
Requirements
Before setting up YouTube Live Auto-Broadcast, make sure you have:
- A YouTube channel.
- A Google account with access to Google Cloud Console.
- A valid YouTube Data API key.
- The YouTube channel ID for the channel you want to monitor.
- VideoHub360 Core plugin installed and active.
- A working WordPress cron system.
For the most reliable automatic checks, a real server cron job is recommended.
Open the YouTube Live Settings
In WordPress, go to:
VideoHub360 → Settings
Find the YouTube Live Auto-Broadcast settings section.
The available settings may include:
- Enable YouTube Live Auto-Broadcast
- YouTube API Key
- YouTube Channel ID
- Detection Mode
- Auto-create or update behavior
- Selected VideoHub360 post
- Featured image behavior
- Replay/end behavior
- Expected live schedules
- Manual Check YouTube Now button
Create a YouTube Data API Key
The YouTube Live Auto-Broadcast system needs a YouTube Data API key so your WordPress site can ask YouTube whether your channel is currently live.
Create a Google Cloud Project
- Go to Google Cloud Console.
- Open the project selector at the top of the page.
- Click New Project.
- Enter a project name, such as:
VideoHub360 YouTube Live Monitor
- Click Create.
- Make sure the new project is selected.
Enable YouTube Data API v3
- In Google Cloud Console, go to APIs & Services → Library.
- Search for:
YouTube Data API v3
- Open YouTube Data API v3.
- Click Enable.
The API must be enabled before the key can be used to check YouTube live broadcasts.
Create the API Key
- Go to APIs & Services → Credentials.
- Click Create Credentials.
- Select API key.
- Copy the generated API key.
- Click Restrict key before using it on a production site.
Restrict the API Key
Do not leave the API key unrestricted on a live site.
API Restriction
Set the API restriction to:
YouTube Data API v3
This prevents the key from being used with unrelated Google APIs.
Application Restriction
Because VideoHub360 checks YouTube from the WordPress server, the recommended application restriction is:
IP addresses
Add the server’s outbound public IP address.
This may be different from the website IP shown in the hosting dashboard. If the API key fails with an IP restriction error, the error message may show the actual originating IP address. Add that IP address to the allowed list.
A server may use IPv4, IPv6, or both. Add each outbound IP address used by the server.
Examples:
203.0.113.10
2001:db8:1234::10
If you do not know the outbound IP address, ask the hosting provider:
What outbound public IP address does my hosting account use for server-side HTTP/API requests?
If the hosting account has SSH access, the site owner may also check the outbound IP from the server with a command such as:
curl https://api.ipify.org
For IPv6:
curl -6 https://api64.ipify.org
If the hosting provider uses changing outbound IPs, ask them for the correct IP range or recommended way to restrict server-side Google API keys.
Find the YouTube Channel ID
VideoHub360 needs the YouTube channel ID, not just the channel name or handle.
A YouTube channel ID usually starts with:
UC
Example format:
UCxxxxxxxxxxxxxxxxxxxxxx
Method 1: From the Channel URL
If the channel URL looks like this:
youtube.com/channel/UCxxxxxxxxxxxxxxxxxxxxxx
the part after /channel/ is the channel ID.
Method 2: From YouTube Studio
- Log in to YouTube Studio.
- Go to Settings.
- Open Channel.
- Open Advanced settings.
- Copy the Channel ID.
Method 3: Ask the Channel Owner
If setting this up for a customer, ask them for the YouTube Channel ID from YouTube Studio.
Configure VideoHub360
In WordPress, go to:
VideoHub360 → Settings → YouTube Live Auto-Broadcast
Fill in the required fields.
Enable YouTube Live Auto-Broadcast
Turn the feature on.
YouTube API Key
Paste the API key created in Google Cloud Console.
YouTube Channel ID
Paste the YouTube Channel ID.
Use the channel ID, not the public handle.
Correct example:
UCxxxxxxxxxxxxxxxxxxxxxx
Incorrect examples:
@mychannel
youtube.com/@mychannel
Detection Mode
Choose how VideoHub360 should check YouTube.
Manual
Use this for testing.
The site only checks YouTube when an administrator clicks Check YouTube Now.
Scheduled
Recommended for production.
The site checks YouTube only during the expected live windows you configure.
This helps reduce unnecessary YouTube API calls.
Always
The site checks YouTube whenever the monitor runs.
Use this only when the channel may go live at unpredictable times.
Configure Expected Live Schedules
Use schedules to tell VideoHub360 when to expect a YouTube live broadcast.
A schedule row may include:
- Enabled
- Day
- Start Time
- Precheck Minutes
- Expected Duration
- Grace Minutes
- Title Prefix
- Category
Example Schedule
For a Sunday service that usually starts at 10:00 AM:
Day: Sunday
Start Time: 10:00
Precheck Minutes: 30
Expected Duration: 120
Grace Minutes: 20
This means VideoHub360 can begin checking at 9:30 AM and continue through the expected duration plus the grace period.
Precheck Minutes
Precheck minutes tell VideoHub360 how early to begin checking YouTube before the scheduled start time.
Example:
Start Time: 10:00
Precheck Minutes: 30
The monitor begins checking at:
9:30
Expected Duration
Expected duration tells VideoHub360 how long the live stream is expected to last.
Example:
Expected Duration: 120
The stream is expected to last 120 minutes.
Grace Minutes
Grace minutes prevent VideoHub360 from marking the stream ended too quickly if YouTube temporarily does not return the live video.
Example:
Grace Minutes: 20
If YouTube does not return an active live video, VideoHub360 waits through the grace period before marking the VideoHub360 post no longer live.
Add More Schedule Rows
Click Add Schedule Row to add more expected live windows.
Use multiple schedules if the channel streams on different days or times.
Example:
Sunday 10:00 AM
Wednesday 7:00 PM
Friday 12:00 PM
Configure Post Behavior
The YouTube Live Auto-Broadcast system can either create a new VideoHub360 post or update an existing one.
Auto-Create a New Post
Use this if each YouTube livestream should become its own VideoHub360 video post.
When YouTube goes live, VideoHub360 creates a new post with the live embed.
Update an Existing Post
Use this if the same VideoHub360 page should always show the current live broadcast.
This is useful for churches, recurring shows, weekly classes, and event pages.
Example:
Sunday Service Live
When the channel goes live, VideoHub360 updates that selected post with the current YouTube live embed.
Configure Featured Image Behavior
If thumbnail import is enabled, VideoHub360 can use the YouTube thumbnail as the featured image.
This helps the live post display correctly in:
- Video archives
- widgets
- featured sections
- related video areas
- single video page poster areas
After testing, open the created or updated VideoHub360 post and confirm the featured image was set.
Configure Replay or Ended Behavior
When YouTube is no longer live, VideoHub360 should stop showing the post as live.
Depending on the configured behavior, the system can:
- remove the live badge
- mark the YouTube status as ended or replay
- keep the YouTube embed available as a replay when YouTube provides one
- prevent the generic VideoHub360 stopped-stream screen from taking over YouTube replays
For YouTube auto-managed livestreams, the live badge should disappear automatically after the grace period and the next monitor check.
Test the API Key
Start with a manual test.
- Set Detection Mode to Manual.
- Save settings.
- Make sure the YouTube channel is not currently live.
- Click Check YouTube Now.
Expected result:
No live video found
This means the API key, channel ID, and server connection are working, but YouTube did not return an active live broadcast.
Test With an Active YouTube Live
- Start a real YouTube livestream on the configured channel.
- Wait until YouTube shows the stream as live.
- Go back to VideoHub360 → Settings.
- Click Check YouTube Now.
- Go to VideoHub360 → All Videos.
- Confirm a VideoHub360 post was created or updated.
- View the post on the frontend.
Expected result:
- the YouTube live video displays on the single video page
- the live badge appears
- the featured image is set if thumbnail import is enabled
- the post does not create duplicates for the same live video
Test When the YouTube Live Ends
- Stop the YouTube livestream on YouTube.
- Wait for the configured grace period.
- Click Check YouTube Now, or wait for cron to run.
- Refresh the VideoHub360 single video page.
Expected result:
- the live badge disappears
- the post is no longer treated as live
- the YouTube replay/embed remains available when replay behavior is enabled
- the generic stopped-stream message does not take over the YouTube player
Set Up WordPress Cron
VideoHub360 uses WordPress cron to check YouTube automatically.
WordPress cron can work in two ways:
- normal WP-Cron, triggered by site visits
- real server cron, triggered by the hosting server
For reliable scheduled livestream detection, real server cron is recommended.
Option 1: Use Normal WP-Cron
This is the simplest setup.
No server configuration is required.
WordPress checks scheduled tasks when visitors load the site.
This may be acceptable for small sites, active sites, or testing.
However, if the site has low traffic, scheduled checks may not run exactly on time.
Option 2: Use a Real Server Cron Job
A real server cron job is recommended for production sites that need reliable live detection.
A server cron job calls WordPress cron on a fixed interval, such as every 5 minutes.
Before Adding a Real Cron Job
Confirm the site URL.
Example:
https://example.com
The cron URL will be:
https://example.com/wp-cron.php?doing_wp_cron
Recommended Cron Interval
For YouTube Live Auto-Broadcast, a 5-minute interval is a good starting point.
Example:
Every 5 minutes
Do not run cron every few seconds.
Generic Cron Command Using wget
*/5 * * * * wget -q -O - "https://example.com/wp-cron.php?doing_wp_cron" >/dev/null 2>&1
Generic Cron Command Using curl
*/5 * * * * curl -s "https://example.com/wp-cron.php?doing_wp_cron" >/dev/null 2>&1
Use the command supported by the hosting provider.
Add Cron in cPanel
If the host uses cPanel:
- Log in to cPanel.
- Open Cron Jobs.
- Choose Every 5 minutes, or enter:
*/5 * * * *
- Enter the command using the site URL:
curl -s "https://example.com/wp-cron.php?doing_wp_cron" >/dev/null 2>&1
- Save the cron job.
If curl is not available, use wget instead.
Add Cron in Plesk
If the host uses Plesk:
- Log in to Plesk.
- Open Scheduled Tasks.
- Add a new task.
- Choose Run a command.
- Set the schedule to every 5 minutes.
- Use a command such as:
curl -s "https://example.com/wp-cron.php?doing_wp_cron" >/dev/null 2>&1
- Save the task.
Add Cron on a VPS or Dedicated Server
If the site owner has SSH access:
- Log in through SSH.
- Run:
crontab -e
- Add:
*/5 * * * * curl -s "https://example.com/wp-cron.php?doing_wp_cron" >/dev/null 2>&1
- Save the file.
The server will now call WordPress cron every 5 minutes.
Disable Default WP-Cron After Server Cron Is Working
After a real server cron job is confirmed working, site owners may disable WordPress’s page-load cron trigger.
Open wp-config.php and add this above the line that says “That’s all, stop editing”:
define( 'DISABLE_WP_CRON', true );
Only do this after the real server cron job has been set up and tested.
If the real cron job is not working and WP-Cron is disabled, scheduled tasks may stop running.
Confirm Cron Is Working
To confirm cron is working:
- Set YouTube Live Auto-Broadcast to Scheduled or Always.
- Save settings.
- Confirm the server cron job is active.
- Start a YouTube live broadcast.
- Wait for the configured schedule window.
- Confirm VideoHub360 creates or updates the live post automatically.
Advanced users with WP-CLI can also inspect cron events.
Example:
wp cron event list
Look for the VideoHub360 YouTube live check hook.
Recommended Production Setup
For most production sites, use:
Detection Mode: Scheduled
Cron Interval: Every 5 minutes
Precheck: 30 minutes
Grace: 10–20 minutes
Example:
Sunday
Start Time: 10:00
Precheck Minutes: 30
Expected Duration: 120
Grace Minutes: 20
This keeps the system reliable while avoiding unnecessary YouTube API checks.
Important Notes
The YouTube live must be available to the API
The monitor checks YouTube for live broadcasts from the configured channel.
A public live stream is the safest option for reliable detection.
If a stream is private or restricted, the API may not return it through a basic API-key request.
Use the correct Channel ID
The system needs the YouTube channel ID.
A handle such as @channelname is not the same as the channel ID.
API key restrictions may use IPv4 or IPv6
Some servers call Google using IPv6 even if the hosting dashboard shows an IPv4 website IP.
If Google returns an error saying the originating IP violates the API key restriction, add the originating IP shown in the error to the allowed IP list.
Manual checks bypass the schedule
The Check YouTube Now button is for testing and manual control.
It can check YouTube even outside the scheduled window.
Scheduled checks depend on cron
If cron is not working, automatic checks may not happen.
Use a real server cron job for the most reliable production setup.
Separate from Studio
YouTube Live Auto-Broadcast monitors and presents a YouTube live source. Studio is the native produced live/record/replay workflow. A YouTube auto-broadcast remains sourced from YouTube and should not be documented as a Studio recording session.
Troubleshooting
API error: IP address restriction
The API key is restricted to an IP address that does not match the server’s outbound IP.
Fix:
- Copy the originating IP from the error message.
- Open the API key in Google Cloud Console.
- Add that IP to the allowed IP list.
- Save.
- Test again.
API key works only when unrestricted
This usually means the wrong IP address was added to the key restrictions.
Ask the host for the server’s outbound public IP address.
No live video found
This means the API request worked, but YouTube did not return an active live video.
Check:
- the channel ID is correct
- the channel is actually live
- the live stream is public or otherwise discoverable
- YouTube has fully started the broadcast
- the correct Google Cloud project/API key is being used
The live badge does not disappear after the stream ends
The monitor waits for the configured grace period before marking the stream ended.
Wait for the grace period and the next cron run, or click Check YouTube Now.
For testing, temporarily set the grace period to a low value such as 1 minute.
The YouTube video plays audio before pressing play
This may happen if an older post was created before the safe autoplay update and still has old embed code saved in its post meta.
Fix:
- Run Check YouTube Now again while the live stream is active.
- Confirm the post embed code updates.
- If needed, create a fresh test livestream post.
- Confirm the iframe does not use the old autoplay behavior.
Featured image does not import
Check that:
- thumbnail import is enabled
- the YouTube video has a thumbnail available
- the WordPress media library can download external images
- the server is not blocking remote image requests
Cron does not run
Check:
- the server cron command uses the correct site URL
- the command uses
curlorwgetavailable on the server - the site is not blocking requests to
wp-cron.php DISABLE_WP_CRONwas not added before real cron was working
Duplicate live posts are created
Use the update-selected-post option if the same page should always show the current live broadcast.
If auto-create is enabled, VideoHub360 should still avoid duplicates for the same detected YouTube live video. If duplicates continue, check that the post metadata is being saved correctly.
Final Setup Checklist
Before considering setup complete, confirm:
- YouTube Data API v3 is enabled.
- The API key is created and restricted.
- The server outbound IP is allowed.
- The YouTube Channel ID is correct.
- YouTube Live Auto-Broadcast is enabled.
- Detection mode is set to Manual for testing.
- Manual Check YouTube Now works.
- A real YouTube live creates or updates a VideoHub360 post.
- The live badge appears while live.
- The featured image imports if enabled.
- The YouTube live displays on the frontend.
- The stream stops being marked live after YouTube ends.
- Scheduled mode is configured.
- Server cron is configured for production reliability.
- Manual mode, Scheduled mode, and Always mode have been tested as needed.
