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

Link to Playlist Item


I have 10 videos in a playlist, right in the Player does not use XML. I do not want to use the listbar, need only link the index the video I want to watch. I'm watching the video index [0], then I click the link for the video index [2], then it switches to video 2, and continues to playlist usually roll from there.

Currently, what I do is link the video, but I lose the sequence Playlist.

bc.. <a href="#mediaplayer" onclick=" javascript:jwplayer().load({file:'http://www.youtube.com/watch?v=_-lO_1QCuoI'> Video 1 </ a>

<a href="#mediaplayer" onclick=" javascript:jwplayer().load({file:'http://www.youtube.com/watch?v=-eUU2MJMvuE'> Video 2 </ a>

<a href="#mediaplayer" onclick=" javascript:jwplayer().load({file:'http://www.youtube.com/watch?v=pFl-kH199Gg'> Video 3 </ a>


Can anyone help me?
Thanks...

16 Community Answers

Ethan Feldman

JW Player Support Agent  
-1 rated :

Here is some sample code that can link to new playlist items and add them to an existing playlist, without losing the playlist:

<!DOCTYPE html>
<html>
<head>
<title>Add to Playlist</title>
<script type="text/javascript" src="http://www.longtailvideo.com/jwplayer/jwplayer.js"></script>
</head>
<body>
<div id="container"></div>
<script type="text/javascript">
    jwplayer("container").setup({
        height: 254,
        width: 720,
        file: "http://content.bitsontherun.com/videos/nPripu9l-60830.mp4",
        image: "http://content.bitsontherun.com/thumbs/nPripu9l-320.jpg",
        title: "Big Buck Bunny trailer",
        listbar: {
        position: "right",
        size: 280,
        },
        primary: 'flash'
    }); 
    function addVideo(videoUrl, videoThumb, videoTitle) {
        var playlist = jwplayer().getPlaylist();
        var newItem = {
            file: videoUrl,
            image: videoThumb,
            title: videoTitle
        };
        playlist.push(newItem);
        jwplayer().load(playlist);
    }
</script>
<p>Click on one of the links below to add an item to the player:</p>
<ul>
<li><a href="http://www.longtailvideo.com/support/jw-player/jw-player-for-flash-v5/16026/loading-a-playlist-into-the-player#" onclick="addVideo('http://content.bitsontherun.com/videos/yj1shGJB-60830.mp4', 'http://content.bitsontherun.com/thumbs/yj1shGJB-320.jpg', 'Sintel trailer'); return false;">Add the Sintel trailer to the playlist</a></li>
<li><a href="http://www.longtailvideo.com/support/jw-player/jw-player-for-flash-v5/16026/loading-a-playlist-into-the-player#" onclick="addVideo('http://content.bitsontherun.com/videos/i8oQD9zd-kNspJqnJ.mp4', 'http://content.bitsontherun.com/thumbs/i8oQD9zd-640.jpg', 'Tears of Steel'); return false;">Add the Tears of Steel trailer to the playlist</a></li>
</ul>
</body>
</html>



Hope it helps. 

JW Player

User  
1 rated :

Ethan,

Thanks, but this code does not solve my issue...

It Works, in your code.. When I passed to my JWPLAYER5, didn't work more. The problem is my local jwplayer.js, I guess...

In really, I wish a little bit more simple code... Only call by the link, a index that is in playlist... Link to example;

http://www.oenxame.com.br/jwp/

See... When I click in video link, he load a new playlist, with one video only. I want to load a index position and continue playlist, from that video.

I apreciate your help. Thanks a lot.

Ethan Feldman

JW Player Support Agent  
1 rated :

My code is for JW6. Do you not want it to add items into the playlist?

JW Player

User  
1 rated :

Would be a good idea, but the player stops, When I add a new song in Playlist .. So is returning back to the first index, which is bad for me ..

If you get me this code to version 5, I could try to adapt it to my project. It sure would help a lot! Because I think about doing it via $ _SESSION in PHP if no other plausible solution.

But what I really need in my current reality is a link to play an index on a playlist that already exists. Do not send new songs to Playlist, only play a song by index, from the location that is the playlist, and then it usually the next songs.

Ethan, Thanks for the help ..

Ethan Feldman

JW Player Support Agent  
0 rated :

The code for JW5 and JW6 are almost the same. However, adding new items into a playlist will always make the player stop playback, regardless if you are using JW5 or JW6.

JW Player

User  
1 rated :

Ok, I understand, but it seems you do not understand what I need.

It's pretty simple. I just need to know how to make a link to play a video which is already on the Playlist without it create a new playlist and play alone. The example that I sent is well understandable.

Example: I have a playlist:

video 1
video 2
video 3
video 4
video 5
video 6
video 7

I want a separate link for each of these videos, we will call it the index, and then continue the playlist.

If the video is playing 2 and I click on the video link 4, 4 video started playing, and then if I do not click on another link, to follow video 5 Video 6 Video 7.

Ethan helps me, is simple. Does not have to be complicated as this .. See the example, try to help me.

Ethan Feldman

JW Player Support Agent  
-1 rated :

So you just want a page that has a playlist, and then html links on the page, that link to the different items? Why not use the built in listbar here?

JW Player

User  
1 rated :

Because the links of the items will be in different parts of text/page ..

For example:

"Hip Hop began in the 80s in New York come from Jamaican rhythms (video link 1). Your first icon was DJ Kool Herc (video link 2). After popularized in NY, appeared on the scene several DJs, who did a technique called Back2Back (video link 3), that allowed the MCs would put vocals on the songs (video link 4).

The first song of Hip-Hop that came up the charts was the single Rapper's Delight (video link 5), launched in 1980 by the group The Sugarhill Gang.

The genre gained new styles with the influence of crime ghettos of NY City, then appeared classics like The Message (video link 6) Grandmaster Flash, among others."

I can do this in DOM, in example for you understand my problem.
Can you understand?

Ethan Feldman

JW Player Support Agent  
1 rated :

I would simply just set up this, then, this should do all you need:

http://www.longtailvideo.com/support/jw-player/31800/loading-new-playlists

JW Player

User  
1 rated :

Ethan, so you lose the previous playlist. I managed to make it even quoted in the first post.

It's almost that, I just wish he would call the music by the index, but the sequence was maintained.

If the User does not click on any video, it plays from beginning to end. Or, if you click it, it plays from that index that was clicked.

It's simple, I can not understand how you do not understand ...

Ethan Feldman

JW Player Support Agent  
1 rated :

It is not possible to load a playlist item like that without losing the original playlist.

JW Player

User  
1 rated :

Ethan, Impossible. It's very simple.

Can not you have no way to do this easily. Basically just have the index number and call him. I would not do the Load a new playlist, I just call the item index, as it does when I click an item in listbar.

All topic with far more complex issues have solution.

Help me please.

JW Player

User  
1 rated :

@Victor - Check out the following in the JavaScript API:

bc.. jwplayer().playlistItem(index)



http://www.longtailvideo.com/support/jw5/31164/javascript-api-reference

Sounds like that's all you really need!

Ethan Feldman

JW Player Support Agent  
1 rated :

Yes, you could use that, I think ?

JW Player

User  
1 rated :

I said, it's simpleeeeee...
Thanks Ethan, Thanks James Herrieven...
I think it's so simple, it seemed complicated .. lol ...
Thanks again, for now it solves my issue.

Ethan Feldman

JW Player Support Agent  
1 rated :

Np

This question has received the maximum number of answers.