javascriptphpflowplayervideo-player

Flowplayer video keeps playing in background hidden span


Here its the index file (javascript)

$(document).ready(function(){
    player("video-1.mov","player1");
    player("video-2.mov","player2");
    player("video-3.mov","player3");
});

function player(video,id) {
    flowplayer(id, "http://releases.flowplayer.org/swf/flowplayer-3.2.14.swf", {
        playlist: [video],
        clip:  {
              autoPlay: true,
              autoBuffering: true
        }
    });
}

function goto_next(current,page)
{
    $('#'+current).hide();
    $('#'+page).show();
    flowplayer.unload();
}

This is the index file

<span id="1" class="step">
    <div class="player formplayer" id="player1"></div>
</span>
<span id="2" class="step" style="display:none;">
    <div class="player formplayer" id="player2"></div>
</span>
<span id="3" class="step" style="display:none;">
    <div class="player formplayer" id="player3"></div>
</span>

When I click on next button it will call goto_next with two different id's to show/hide. But, the video of previous span is keep playing in background. How to stop all other videos and play the current video only?

P.S.: It is working fine on windows: chrome, firefox.

But having problem with firefox on mac.


Solution

  • Try stop the players with the stop() function of the javascript api (http://flowplayer.org/documentation/api/index.html)

    function goto_next(current,page)
    {
        flowplayer(0).stop();
        flowplayer(1).stop();
        flowplayer(2).stop();
        $('#'+current).hide();
        $('#'+page).show();
        flowplayer.unload();
    }