You will recieve your password to this address. Address is not made public.

Your preferred username that is used when logging in.

getPlaylist, play(index) problem Created Nov 1, 2009

This thread is solved

Views: 2984     Replies: 4     Last reply Nov 3, 2009  
You must login first before you can use this feature

slaveri

Posts: 3

Registered:
Nov 1, 2009

getPlaylist, play(index) problem

Posted: Nov 1, 2009

Hello,

This problem drove me nuts for the last 3 hours.

I have a player set up with a manual playlist and everything works fine until I wanted to have a possibility to jump to the next clip. From the API documentation it sounded quite easy, but for the life of me I'm not able to understand why there's a problem.

This is what I have in my script:


<script type="text/javascript"> 
  flowplayer("jukebox", "/flash/flowplayer-3.1.5.swf", {
  	
  	plugins: { 
      audio: { 
        url: '/flash/flowplayer.audio-3.1.2.swf' 
      },
      controls: { 
         fullscreen: false 
        }
    },
    clip: {onFinish: function() {
     player_next();
}}  
  }).playlist("#playlist", {
    loop: true,
    template: '<div><a href="${url}">${title}</a></div>'
  });

function player_next()
{
//$f().next();
//$f().play(1);
//alert($f().getPlaylist().length)
$f().play($("#item_10 a").attr("href"))
}
 
</script> 

Within the function player_next() I've tried several things.

$f().next();
$f().play(1); - those two don't work, error given is Object undefined

When I am trying to get the playlist's size it's only 1.

Currently I have to select the items using jQuery selector and passing href to play(). Only then it works.

Anybody can help me out with this issue?

janwari

Posts: 5

Registered:
Oct 14, 2009

» getPlaylist, play(index) problem

Posted: Nov 2, 2009

Reply to: getPlaylist, play(index) problem, from slaveri
From your code it looks like you are using Flowplayer's Playlist javascript plugin. And you have already set "loop:true" which would mean that Flowplayer would play the clips in the playlist from the beginning to the end. So here you don't need to add onFinish event.

Also where in the documentation is $f().next() mentioned?

slaveri

Posts: 3

Registered:
Nov 1, 2009

» » getPlaylist, play(index) problem

Posted: Nov 2, 2009

Reply to: » getPlaylist, play(index) problem, from janwari
Hi janwari -

I want to create a "next" button, that will advance to the next clip in the playlist. So the question still remains. The onFinish event will be done to ensure I can shuffle through the playlist, as I understand it's not available as a standard. The next() method is in the standard API reference, but because there are no examples, I might be reading it wrong.

So, any help will still be appreciated!

janwari

Posts: 5

Registered:
Oct 14, 2009

» » » getPlaylist, play(index) problem

Posted: Nov 3, 2009

Reply to: » » getPlaylist, play(index) problem, from slaveri
Below code should allow you to create a next button. Just add the code to the "onClick" event of the next button.

clipIndex = $f().getClip().index; 
++clipIndex; 
$f().play(clipIndex); 

slaveri

Posts: 3

Registered:
Nov 1, 2009

» » » » getPlaylist, play(index) problem

Posted: Nov 3, 2009

Reply to: » » » getPlaylist, play(index) problem, from janwari
janwari -

This seems to be exactly my problem, that $f().play(1) does not find a next item in the playlist.