• Resolved BJBeacon

    (@bjbeacon)


    Great Plugin Andrew…

    Idea: it would be excellent to be able to display a ticker style box saying for example:

    “Watch for Live Videos here…”

    Your plugin would poll for Live stream as it does already, but when exists_live_stream, text changes to say, “Breaking LIVE now! Click to open Video viewer” or whatever user wants it to say. Then when a user clicks, it would either pop up a video box or open a new tab with the video in it.

    A good coder could probably make this happen using the plugin as is, but I’m not a good coder. My guess it many more people would use this if it were brain dead easy!

    Thank you.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter BJBeacon

    (@bjbeacon)

    Ok, So I found the event listener code:

    However I’m not sure where to use this. In the functions.php file?

    window.addEventListener(‘wpYouTubeLiveStarted’, function() {
    /* your code here */
    console.log(‘stream started’);
    /* your code here */
    });

    Thanks!

    Plugin Author macbookandrew

    (@macbookandrew)

    No, you’d put this in a javascript file and then include that using your functions.php file.

    So you’d create a video-ticker.js file in your theme folder containing something like this:

    
    (function($){
    $('document').ready(function() {
      window.addEventListener('wpYouTubeLiveStarted', function() {
        // swap out the content of .ticker-box
        $('.ticker-box').html('Breaking LIVE now! <a id="expand-video">Open Video viewer</a>');
      });
    
      $('#expand-video').on('click', function() {
        // do stuff here to make video visible
      });
    });
    

    Then in functions.php, add this to load it on the frontend:

    
    function my_video_ticker_js() {
      wp_enqueue_script( 'my-video-ticker', get_stylesheet_directory_uri() . '/video-ticker.js', array( 'jquery' ), NULL, true );
    }
    add_action( 'wp_enqueue_scripts', 'my_video_ticker_js' );
    
    Thread Starter BJBeacon

    (@bjbeacon)

    Greetings Andrew,

    Thanks for the programming advice and speedy turnaround time on my last support request.

    I have now been doing rather extensive testing with the plugin with excellent results. However, I’ve run into another issue regarding the fallback_behavior once the video stream ends in that the iFrame window stays open on the page. I expected (incorrectly?) that the browser would recheck for the stream, and finding none, the iFrame would clear. That does not happen.

    In checking wp-youtube-live.js, I see that there is no code to change the state of the now dead stream back to the original pre live stream state.

    Here’s my page and code:

    Live Stream page

    [youtube_live auto_refresh=”true” autoplay=”true” js_only=
    “true” fallback_behavior=”no_message”]

    This works excellently (other than a large time lag anywhere from 90 to 300 seconds.)

    Once the live video finishes. The iFrame stays on the page and does not refresh/revert to the original state.

    Can you suggest code to make the iFrame close and return to the original page as seen at the above link?

    Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Feature Request’ is closed to new replies.