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

    (@macbookandrew)

    I’m not sure what you mean about the menu, but if you want the live video to show only when there’s a live video and show nothing the rest of the time, set the fallback behavior in the plugin options to “Show nothing at all”, or add fallback_behavior="no_message" to the shortcode (for example, [youtube_live fallback_behavior="no_message"])

    Thread Starter thalysonc2018

    (@thalysonc2018)

    I would like to know if I have to know if there is any live video at the moment, if I have a display block in a div. And if you do not have it, I make a display none

    Plugin Author macbookandrew

    (@macbookandrew)

    Then you’ll want to set the containing div to display: none; and use the event listener to listen for a live video and change it to display: block;.

    More info about the event listener here: https://github.com/macbookandrew/wp-youtube-live#event-listener (also on the WordPress plugin readme, but easier to link to a specific section on GitHub).

    Thread Starter thalysonc2018

    (@thalysonc2018)

    great, could you give me an example of how to use this function?

    window.addEventListener('wpYouTubeLiveStarted', function() {
        /* your code here */
        console.log('stream started');
        /* your code here */
    });
    Plugin Author macbookandrew

    (@macbookandrew)

    Instead of console.log(), you’d show/hide your div.

    You’d either add this in a JS file included in your page or inside an inline <script></script> tag (not recommended).

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘show menu only when there is a live’ is closed to new replies.