Yes, but it would take a bit of custom code.
When a live stream is loaded, the wpYouTubeLiveStarted event is fired; you can use this javascript code to create custom front-end features on your site by adding an event listener:
window.addEventListener('wpYouTubeLiveStarted', function() {
/* your code here */
console.log('stream started');
/* your code here */
});
You’d have to include the [youtube_live fallback_behavior="no_message"] shortcode in a widget or footer so it would be running on every page.
-
This reply was modified 6 years, 2 months ago by
macbookandrew. Reason: tweak code formatting
What code would need to be added this where the commented out code is? Meaning, if I have a true false question “Is stream live?” If yes, display “LIVE”. If no, display “OFFLINE”. Not sure I follow how my description would be included in your code above.
It depends on your theme or widget. If I were to build it, I would:
- Add this to your theme’s javascript file
- Add a menu item or widget with two
<span>s or <div>s, one for “offline” and one for “live”
- On pageload, hide the “live” one
- The snippet above will run when a video starts, so in that snippet, hide the “offline” and display the “live” one
Sorry, it’s not particularly user-friendly if you’re not comfortable with a bit of coding.
I’ll look at adding a [youtube_live_indicator] shortcode you could place in a menu or widget to show an indicator as described—that seems generally useful to a lot of people.