jqueryflowplayer

playlist prev/next


I use FLOWPLAYER I have a playlist but I don't use their playlist plugin. I have PREV/NEXT buttons, so I can navigate to one another.

demo :: http://baazooka.com/_ext/flowplayer/index.html

    $("#clips a").each(function(index){

    $("#next").click(function(){
    var nex = $("#clips a").next().attr('href');
          $f().play(nex);
          return false;
   });
   $("#previous").click(function(){
    var pre = $("#clips a").prev().attr('href');
          $f().play(pre);
          //return false;
   });
   
});

but it only works one time. the value of #next and #previous keep the same value. it doesn't in crement or decrement.

i've found this below but still doesn't work. it skips videos...

var link = $("#clips a");
link.each(function(i){
$("#next").click(function(){
 var nex = link.eq(i+1).attr('href');
      $f().play(nex);
      return false;
});
$("#previous").click(function(){
 var pre = link.eq(i-1).attr('href');
      $f().play(pre);
      return false;
});

Solution

  • $("#clips a").each(function(index){
      $("#next").click(function(){
        var nex = $("#clips a.playing:first").next().attr('href');
        $f().play(nex);
        return false;
      });
      $("#previous").click(function(){
        var pre = $("#clips a.playing:first").prev().attr('href');
        $f().play(pre);
        return false;
      });
    });
    

    Just select .playing, not all links.