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

Loading New Playlists ... problem


Hi,

I'll try to do the same thing as it's post here: https://developer.jwplayer.com/jw-player/demos/basic/loading-new-playlists/ but I fail.

Here is my code:

First:
<script src="https://content.jwplatform.com/libraries/GswCDm6y.js"></script>

In my page, I would like that visitor can change the playlist by clicking links in menu with <ul><li>:

<ul class="menuCombo">
<li class="item1"><a href="#">Genres</a>
<ul id="firstmenu">
<li class="subitem1"><a href="javascript:loadPlaylist(playlistOne)">Institutionnel</a></li>
<li class="subitem2"><a href="javascript:loadPlaylist(playlistTwo)">Bandes Annonces</a></li>
<li class="subitem3"><a href="javascript:loadPlaylist(playlistThree)">Publicités</a></li>
</ul>
</li>
</ul>

Here are my scripts:

<!-- Player JWPLAYER: Initial Playlist , there is a first playlist who plays when we arrive at the page and I use a Json link -->
<script type="text/javascript">
jwplayer("mediaplayer").setup({
"playlist": "https://cdn.jwplayer.com/v2/playlists/lMeqEfxa"
});
</script>


<!-- Here I copy the code of the tuto and I would like to use Json links too. As that doesn't work, I tried with different syntax -->

<script type="text/javascript">
//Define our three playlist arrays
var playlistOne = [{
"playlist":"https://cdn.jwplayer.com/v2/playlists/e1XLOaCH"}];
var playlistTwo = [{
"https://cdn.jwplayer.com/v2/playlists/e1XLOaCH"
}];
var playlistThree = "https://cdn.jwplayer.com/v2/playlists/e1XLOaCH";

//Create a function to load a playlist var
function loadPlaylist(thePlaylist) {
jwplayer("mediaplayer").load(thePlaylist)
};
</script>

Here is the webpage:
http://www.hervelacroix.com/testNewPlaylist.php

Thanks for your help.

3 Community Answers

Todd

JW Player Support Agent  
0 rated :

Hi,

When calling load(), the only required parameter to pass is the URL of the new playlist, so you only need to define playlistOne as ‘https://cdn.jwplayer.com/v2/playlists/e1XLOaCH’ , etc

or just use

<li class="subitem1"><a href="jwplayer('mediaplayer').load('https://cdn.jwplayer.com/v2/playlists/e1XLOaCH');">Institutionnel</a></li>

Herve Lacroix

User  
0 rated :

Oh yes it's very simple...I was stupid.
Thanks so lot.

Todd

JW Player Support Agent  
0 rated :

You’re welcome. Glad to hear that this worked for you.

This question has received the maximum number of answers.