Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

playlistItem()


When I use the playlistItem() javascript call, the player starts playing the correct track but the playlist doesn't scroll down/up to that selected track. What I mean is with longer playlists the user doesn't see what started playing. Is this a bug? Is there a workaround?

10 Community Answers

Ethan Feldman

JW Player Support Agent  
0 rated :

Can I see a link to where this is running?

cavaglieri

User  
0 rated :

http://www.fonoteca.ch/cgi-bin/oecgi3.exe/inet_fnbasedetail?REC_ID=167567.011&LNG_ID=IT&TRK_ID=28

Ethan Feldman

JW Player Support Agent  
0 rated :

Where is the player on this page?

cavaglieri

User  
0 rated :

Sorry, I had to switch the above document for public access. The player is being displayed now.

Ethan Feldman

JW Player Support Agent  
0 rated :

This scrolls for me fine to the right location in the playlist when I click on a link.

cavaglieri

User  
0 rated :

When you click on a link it scrolls to the correct location, that's fine. My problem is with the initial track (in this case track #28, if you start counting from 0), when you first call the page - the player starts playing track 28 but it does not scroll to it. Maybe issuing a command to make sure the player is fully displayed before calling playlistItem() would do the trick? Could you please check line 91 in the HTML code and give me a hint?

jherrieven

User  
0 rated :

@cavaglieri

You need to ensure the player is completely ready before loading a specific playlist item.

Try replacing:

jwplayer().playlistItem(28)

With:

jwplayer().onReady(function(){this.playlistItem(28);});


James Herrieven

Ethan Feldman

JW Player Support Agent  
0 rated :

Odd, it does scroll for me.

cavaglieri

User  
0 rated :

Thanks for the hints. I replaced the initial call by including a 1 second delay (see below) and that does the trick.

setTimeout(function(){ jwplayer().playlistItem(28); }, 1000 );

Ethan Feldman

JW Player Support Agent  
0 rated :

Ah, nice.

This question has received the maximum number of answers.