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

Help to add multiple sources trought api


Hi there,

I have this code:

jwplayer('video').setup({
'primary': 'flash',
sources: [
{
file: "....AYT1-XDVBRYZHZDM3.mp4", label: "360p" },
{ file: "....AYT1-XDVBRYZHZDM3.mp4", label: "720p" }
]
});


What i want to to is change multiple sources with the js api. If i have one file source i do it like the example below and it works fine.

var the_video_url = "....AYT1-XDVBRYZHZDM3.mp4";

jwplayer('video').setup({
'primary': 'flash',
file: the_video_url
});

I did not find a piece of code that help me to add multiple sources files with the js api.

Is this possible, and if it is can you provide me some example on how to do it please?

Thank you very much.

Nelson

3 Community Answers

Cooper Reid

JW Player Support Agent  
0 rated :

Hi,

You can use the `load` method to load additional playlist items into the player. Each playlist item can have multiple sources. Here’s how that is done:

jwplayer().load({
sources: [{
file: ‘source-1.mp4’,
}, {
file: ‘source-2.mp4’
}]
});

That is a single item with multiple sources – the single source version of that is:

jwplayer().load({
file: ‘video.mp4’
});

http://support.jwplayer.com/customer/portal/articles/1413089-javascript-api-reference

Kind Regards,
Cooper
Client Support Engineer, JWPlayer

mediacapitalradios

User  
0 rated :

Thank you so much Cooper.

Regards,
Nelson

Cooper Reid

JW Player Support Agent  
0 rated :

No problem, have a nice weekend!
Cooper

This question has received the maximum number of answers.