Grow your CSS skills. Land your dream job.

Anythingslider + Longtail + Event Listeners

  • # December 14, 2009 at 8:08 pm

    I’ve implemented the Fabulous AnythingSlider with images and video (using the longtail flv player).

    Problem: When the user plays the video, the slideshow doesn’t know this has happened, so the slideshow keeps cycling while the video runs. So you have the slideshow running – and user can hear the audio but the video has cycled off.

    I’m trying to figure out an event-listener that will look and see when the LONGTAIL player is in PLAYING state and signals to the AnythingSlider that it needs to STOP.

    Here’s what I’ve got so far … which is probably not worth much as it doesn’t work!!

    Code:
    // Fires when the VIDEO player is succesfully initialized and drawn on the page
    function playerReady(obj) {
    player = document.getElementById(obj[‘vucastvid’]);
    // This line adds the listener.
    player.addModelListener(“STATE”,”stateHandler”);
    };
    // This function is called every time the listener is fired
    function stateHandler(obj) {
    // if the VIDEO state is changed to “PLAYING”
    if(obj.newstate == “PLAYING”) {
    // make the SLIDESHOW STOP
    $(‘.AnythingSlider’).base({‘startStop':’false’});
    }else {
    // do nothing because the video is not playing
    }
    }
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".