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

Multiple different JWPlayer on one page


I try to add 2 Players on one Page. Each of the player should have a seperate Cloud Player Library URL.

It looks like:

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://content.jwplatform.com/libraries/XXXXXXX.js"></script>
<script src="https://content.jwplatform.com/libraries/YYYYYYY.js"></script>
<script>
$(function(){
jwplayer("player1").setup({
image: 'myimage1.jpg',
title: 'Video 1',
file: "video1.mp4"
});

jwplayer("player2").setup({
image: 'myimage2.jpg',
title: 'Video 2',
file: "video2.mp4"
});
});
</script>
</head>
<body>
<h3>Player 1</h3>
<div id="player1"></div>
<h3>Player 2</h3>
<div id="player2"></div>
</body>
</html>


Both players uses the same library.
Is it possible to tell each player which library it should use?

3 Community Answers

Randy

JW Player Support Agent  
0 rated :

Hello,

This is not a suggested setup as both libraries will interact and could potentially negate the other as the page is loaded and executed. If you require the use of multiple players on one page you can either use the cloud hosted player solution which would contain the embed in its own container or simply embed the player with an iFrame.

I hope this helps,

Randy

info

User  
0 rated :

Both solutions are not possible in my case.

What if i will host the js-file on my server and change the declaration "window.jwplayer=...." to "window.jwplayer2=" and use "jwplayer2" in the setup and other events etc.
Is there anything that is blocking to host the file on my website or anythig that will not work?

Randy

JW Player Support Agent  
-1 rated :

Hello,

It is not recommended to modify the code base of the player at all as it would negate the ToS: https://www.jwplayer.com/tos/. You can certainly host the player on your own site as a self-hosted solution but the use of multiple player embeds on one page is suggested against. Any workarounds you might need to have this take place would require custom code on your end.

Randy

This question has received the maximum number of answers.