Support » Plugin: WP YouTube Live » Live Notification

  • Resolved ryankline


    Is it possible to have a notification in menu or widget area that shows live/offline status for this plugin?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author macbookandrew


    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 3 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.

    Plugin Author macbookandrew


    It depends on your theme or widget. If I were to build it, I would:

    1. Add this to your theme’s javascript file
    2. Add a menu item or widget with two <span>s or <div>s, one for “offline” and one for “live”
    3. On pageload, hide the “live” one
    4. 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.

    Plugin Author macbookandrew


    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.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.