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

2 players, same div


I copy this from another post, as example:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<script type="text/javascript" src="http://player.longtailvideo.com/jwplayer.js"></script>
<title>Multiple</title>
</head>
<body>
<div id="container"></div>
<script type="text/javascript">
jwplayer("container").setup({
file: "http://www.longtailvideo.com/jw/upload/bunny.mp4",
image: "http://www.longtailvideo.com/jw/upload/bunny.jpg",
height: 300,
width: 400,
controlbar: "bottom"
});
</script>
<div id="container2"></div>
<script type="text/javascript">
jwplayer("container2").setup({
file: "http://www.longtailvideo.com/jw/upload/bunny.flv",
image: "http://www.longtailvideo.com/jw/upload/bunny.jpg",
height: 300,
width: 400,
controlbar: "bottom"
});
</script>
<\html>

If I use this code it will be showed 2 videos on the page. I want to use two different players (jwplayer 6 and jwplayer 7) on the same div
I try deleting <div id="container2"></div> and the second player doesn't show off,
and I'm trying to change the players, using this:
onclick="jwplayer("container").play(); jwplayer("container").setCurrentQuality(0);jwplayer("container").setFullscreen(true)"></button>
onclick="jwplayer("container2").play(); jwplayer("container2").setCurrentQuality(0);jwplayer("container2").setFullscreen(true)"></button>

it only works for the container, not for the container2

Any ideas how I do that?

5 Community Answers

Alex

JW Player Support Agent  
0 rated :

Hi there,

My name is Alex and I am one of the Support Engineers at JW Player. I will be more than happy to assist you with your questions.

Because JW Player 6 and 7 are such different codebases, it is not required to have them embedded on the same page. If it is absolutely necessary for you to do so, we would recommend embedding the players on different pages and then embedding those pages on the same other page using iFrames.

Also, with either version, if the player is told to setup in a container (in this instance, ‘container2’) and no <div> exists on the page with that ID, the player will not be setup.

In addition, when the player is told to embed in a <div>, it replaces the entire contents of that <div> with the player. This means if I have one element – <div id="container"></div> – and have two player setups – jwplayer(“container”).setup(1) and jwplayer(“container”).setup(2) – the second instance of .setup will overwrite anything that the first instance placed in that <div>. So there is no way to have two players set up in the same <div>.

Please let me know if you need any more help or have any other questions.

Thank you!

breno

User  
0 rated :

The problem is JW6 works on SmartTV and JW7 works on iOS (fullscreen with subtitles). In order to have all systems supported, I really need both. Thanks for the your explication. I just be wait and hope JW8 works on everything.

Alex

JW Player Support Agent  
0 rated :

Hi there,

That helps me understand your use case, thank you. However, please note that we have no current plans to support our player on Smart TVs. We do provide SDKs for Apple TV and Roku, in addition to the ability to cast content to Chromecast-enabled devices, but there are just too many different variables on each model TV to be able to support Smart TVs widely. However, it will be something we continue to look at.

Please let me know if you need any more help or have any other questions.

Thank you!

Breno

User  
0 rated :

Actually I figure out how to solve my problem. using 2 different phps, one with each version of JW and they both redirected to dame iframe, and a button below the player to change from one to another. But thanks for your support.

Alex

JW Player Support Agent  
0 rated :

I’m glad you got it working, Breno!

This question has received the maximum number of answers.