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

Embed multiple videos on one page


I have put two videos on one page and can't make the second one play. Just get the this page will be replaced notice. I only changed the video file name and wonder if the player code has to be altered.
www.the-slingshot.com

18 Community Answers

Ethan Feldman

JW Player Support Agent  
0 rated :

You need to update the code slightly for each additional player. Here is some example code, for your reference:

<script type="text/javascript" src="swfobject.js"></script>
	
	<div id="hi"></div>
	
	<script type="text/javascript">
	var s1 = new SWFObject('player.swf','mp1','500','400','9');
	s1.addParam('allowscriptaccess','always');
	s1.addParam('allowfullscreen','true');
	s1.addParam('wmode','transparent');
	s1.addVariable('file','video.flv');
	s1.addVariable('image','dawg.jpg');
	s1.write('hi');
	</script>
	
	<div id="hi2"></div>

	
	<script type="text/javascript">
	var s2 = new SWFObject('player.swf','mp2','500','400','9');
	s2.addParam('allowscriptaccess','always');
	s2.addParam('allowfullscreen','true');
	s2.addParam('wmode','transparent');
	s2.addVariable('file','bunny.flv');
	s2.addVariable('image','dawg.jpg');
	s2.write('hi2');
	</script>
	
	<div id="hi3"></div>
	
	<script type="text/javascript">
	var s3 = new SWFObject('player.swf','mp3','500','400','9');
	s3.addParam('allowscriptaccess','always');
	s3.addParam('allowfullscreen','true');
	s3.addParam('wmode','transparent');
	s3.addVariable('file','video.flv');
	s3.addVariable('image','dawg.jpg');
	s3.write('hi3');
	</script>

JW Player

User  
0 rated :

Hi again Ethan:

I am getting a message from Flash Player Security that it has blocked an unsafe operation.It says that it has blocked access to www.the-slingshot.com and I find that address in the permitted sites. One movie loads fine and plays as it should. The second player hangs up on this text will be replaced. I am using Firefox and could find nothing about this situation in their help or in Adobe help.

Good code that loads is:
<script type='text/javascript' src='swfobject.js'></script>

<div id='mediaspace'>This text will be replaced</div>

<script type='text/javascript'>
var s1 = new SWFObject('http://www.the-slingshot.com/mediaplayer/player.swf','mpl','470','320','9');
s1.addParam('allowfullscreen','true');
s1.addParam('allowscriptaccess','always');
s1.addParam('wmode','opaque');
s1.addVariable('file','http://www.the-slingshot.com/video/vasswastewater.flv');
s1.addVariable('title','The Moore County Water Summit');
s1.addVariable('backcolor','9999FF');
s1.write('mediaspace');
</script></div>

Blocked code is:
<script type="text/javascript" src="swfobject.js"></script>

<div id=mediaspace>This text will be replaced</div>

<script type="text/javascript">
var s2 = new SWFObject(' 'http://www.the-slingshot.com/mediaplayer/player.swf','mp2','500','400','9');
s2.addParam('allowscriptaccess','always');
s2.addParam('allowfullscreen','true');
s2.addParam('wmode','transparent');
s2.addVariable('file','''http://www.the-slingshot.com/video/summitgeneral.flv');
s2.addVariable('image','Slingshooter.jpg');
s2.write('mediaspace');
</script>

<div id="hi2"></div>

Any thoughts?

Walter

Ethan Feldman

JW Player Support Agent  
0 rated :

@Walter:

Make the code like this:

<script type='text/javascript' src='swfobject.js'></script>

<div id='mediaspace'>This text will be replaced</div>

<script type='text/javascript'>
var s1 = new SWFObject('http://www.the-slingshot.com/mediaplayer/player.swf','mpl','470','320','9');
s1.addParam('allowfullscreen','true');
s1.addParam('allowscriptaccess','always');
s1.addParam('wmode','opaque');
s1.addVariable('file','http://www.the-slingshot.com/video/vasswastewater.flv');
s1.addVariable('title','The Moore County Water Summit');
s1.addVariable('backcolor','9999FF');
s1.write('mediaspace');
</script></div>

Blocked code is:
<script type="text/javascript" src="swfobject.js"></script>

<div id=mediaspace2>This text will be replaced</div>

<script type="text/javascript">
var s2 = new SWFObject(' 'http://www.the-slingshot.com/mediaplayer/player.swf','mp2','500','400','9');
s2.addParam('allowscriptaccess','always');
s2.addParam('allowfullscreen','true');
s2.addParam('wmode','transparent');
s2.addVariable('file','''http://www.the-slingshot.com/video/summitgeneral.flv');
s2.addVariable('image','Slingshooter.jpg');
s2.write('mediaspace2');
</script>



You need to make the 2nd div something different than the first. That is why my example had h1,h2,h3,etc.

JW Player

User  
0 rated :

I am trying to upload a screen shot that shows my problem. It may be Firefox issue.
The error message reads:

"Adobe Flash Player Security

Adobe Flash Player Has Stopped a Potentially Unsafe Operation

The following application on your computer or network

C:\users\walter\appdata\local\temp\preview\preview.html

is trying to communicate with this Internet-embedded location:

www.the-slingshot.com

To let this application communicate with the Internet click Settings
You must restart this application after changing your settings.

OK Settings "

The site is on the list of allowed addresses and video number one connects and works well


Walter

Ethan Feldman

JW Player Support Agent  
0 rated :

@Walter – C:\users\walter\appdata\local\temp\preview\preview.html is on your local machine and is trying to connect to your website.

You should put this page online.

Please put this page online and then please post a test link here, thanks.

JW Player

User  
0 rated :

Ethan:

The page that I am trying to put two videos on is

http://www.the-slingshot.com/summit.html

The screen shot is at

http://www.the-slingshot.com/videotest.html

Thanks

Walter

Ethan Feldman

JW Player Support Agent  
0 rated :

Hi Walter,

On – http://www.the-slingshot.com/summit.html

You have – <div id=mediaspace2>This text will be replaced</div>

But it needs to be – <div id='mediaspace2'>This text will be replaced</div>

You forgot the starting quote.

JW Player

User  
0 rated :

I still cannot put two videos on one page. The host's help desk has yet to answer respond that it is possible to do. The first video posts fine and then there is a flash message calling the second post an unsafe operation that it (flash) has stopped. A simple workaround would be to just add another page, but that might make me lose viewers.

Do I need to put a second media player folder on the site for the second movie and point to it?

Ethan Feldman

JW Player Support Agent  
0 rated :

Walter,

If you view the source of – http://www.the-slingshot.com/summit.html in Firefox, you will see that some of the code is in red. This is because you have copied non unicode quotes from somewhere, and it is breaking the player below the page.

I can show you a demo page of the code working. Please contact me at ethan [at] longtailvideo [dot] com for it.

Best,
-Ethan

JW Player

User  
-1 rated :

I can not find anywhere on here to post a new problem. The only thing keeping me from buying the JW Playing is the following. My Email is dlmmartin@gmail.com.

----------------------------------------------------------------------
Simply put I have .flv (flash files) stored in inetpub/www directory. The link or reference to the files is stored in a SQL Server 2008 database, table and field. Users can use a search page to view specfic video based on the search criteria they enter. I use JW Player within a datalist to bring back the .flv dynamically and display multiple video files.

My Problem:
When I use the Object/Embed code for the JW Player the videos display perfect and play correctly. However, I did more testing and the video does not play or work in browsers other than internet explorer. I tested Safari, Chrome and Firefox. I read that I should try the SWFobject method with the JW Player. I tried this and the video does play. However, only one video is displaying insted of four as in internet explorer. Is there a way to make the Object/Embed code work in other browsers or make SWFobject code display all of the video instead of one. I am listing code for both.

Object/Embed Code with JW Player (won't display in other browsers. Will display in Internet Explorer.
--------------------------------------------------------------
<asp:DataList ID="DataList1" runat="server" DataKeyField="eid"
DataSourceID="SqlDataSource1">
<ItemTemplate>
eid:
<asp:Label ID="eidLabel" runat="server" Text='<%# Eval("eid") %>' />
<br />
addtofavorite:
<asp:Label ID="addtofavoriteLabel" runat="server"
Text='<%# Eval("addtofavorite") %>' />
<br />
ddshareworkout:
<asp:Label ID="ddshareworkoutLabel" runat="server"
Text='<%# Eval("ddshareworkout") %>' />
<br />
ddnewworkout:
<asp:Label ID="ddnewworkoutLabel" runat="server"
Text='<%# Eval("ddnewworkout") %>' />
<br />
demolink:
<asp:Label ID="demolinkLabel" runat="server" Text='<%# Eval("demolink") %>' />
<br />
<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='320' height='240' id='single1' name='single1'>
<param name='movie' value='player.swf'>
<param name='allowfullscreen' value='true'>
<param name='allowscriptaccess' value='always'>
<param name='wmode' value='transparent'>
<param name='flashvars' value= 'File= <%# Eval("demolink") %>&image=bckimg.jpg' />
<embed
type='application/x-shockwave-flash'
id='single2'
name='single2'
src='player.swf'
width='320'
height='240'
bgcolor='undefined'
allowscriptaccess='always'allowfullscreen='true'
wmode='transparent'
flashvars= 'flashvars' value= 'File= <%# Eval("demolink") %>&image=bckimg.jpg' />
</object>

<br />
<br />
<br />
<br />
<br />
<br />
<br />
</ItemTemplate>
</asp:DataList>

SWFobject - Only displays one video and should display 4. The test is display for 4 records but only one video shows.
-------------------------------------------------------------------
<asp:DataList ID="DataList1" runat="server" DataKeyField="eid"
DataSourceID="SqlDataSource1">
<ItemTemplate>
eid:
<asp:Label ID="eidLabel" runat="server" Text='<%# Eval("eid") %>' />
<br />
addtofavorite:
<asp:Label ID="addtofavoriteLabel" runat="server"
Text='<%# Eval("addtofavorite") %>' />
<br />
ddshareworkout:
<asp:Label ID="ddshareworkoutLabel" runat="server"
Text='<%# Eval("ddshareworkout") %>' />
<br />
ddnewworkout:
<asp:Label ID="ddnewworkoutLabel" runat="server"
Text='<%# Eval("ddnewworkout") %>' />
<br />
demolink:
<asp:Label ID="demolinkLabel" runat="server" Text='<%# Eval("demolink") %>' />
<br />
<script src="swfobject.js" type="text/javascript">
</script>
<div ID="mediaspace">
This text will be replaced</div>
<script type="text/javascript">
var so = new SWFObject('player.swf', 'mpl', '320', '240', '9');
so.addParam('allowfullscreen', 'true');
so.addParam('allowscriptaccess', 'always');
so.addParam('wmode', 'opaque');
so.addVariable('file', '<%# Eval("demolink") %>');
so.write('mediaspace');
</script>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
</ItemTemplate>
</asp:DataList>

JW Player

User  
0 rated :


The ASP code isn't useful. You need to look at what is being delivered to the browser.

Ifbc.. so.addVariable('file', '<%# Eval("demolink") %>');
is delivering a valid playlist in one of the supported formats, the player will display & play all of the tracks in that playlist.

Perhaps calling your playlist-generating code from your browser, to see if you are getting a valid playlist, might be useful.

JW Player

User  
0 rated :

I cannot get two players on one page?

If I put one it is working fine. What do I wrong?

The script are:

<div id="player">video</div>
<p><script src="/players/swfobject.js" type="text/javascript"></script><script type="text/javascript"><!--
var s1 = new SWFObject("/Players/player.swf","ply","305","229","9","#FFFFFF");
s1.addParam("allowfullscreen","true");
s1.addParam("allowscriptaccess","always");
s1.addParam("flashvars","controlbar=over&file=/Players/RTVOoost Beatrixschool Nijverdal.wmv_2.flv&image=/Players/princesbeatrixschool.jpg");
s1.write("player");
// --></script></div>





<div id="player">radio</div>
<p><script src="/players/swfobject.js" type="text/javascript"></script><script type="text/javascript"><!--
var s1 = new SWFObject("/Players/player.swf","ply","305","90","9","#FFFFFF");
s1.addParam("allowfullscreen","true");
s1.addParam("allowscriptaccess","always");
s1.addParam("flashvars","controlbar=over&file=/players/RTVOost radio.flv&image=radio.png");
s1.write("player");
// --></script></div>

JW Player

User  
0 rated :


bc.. <script src="/players/swfobject.js"></script>

<div id="player1"><a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">Get the Adobe Flash Player to see this video.</a></div>
<div id="player2"><a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">Get the Adobe Flash Player to see this video.</a></div>

<script type="text/javascript">
var s1 = new SWFObject('/Players/player.swf', 'ply1', '305', '229', '9.0.124', '#FFFFFF');
s1.addParam('allowscriptaccess', 'always');
s1.addParam('allowfullscreen', 'true');
s1.addParam('flashvars', 'controlbar=over&file=/Players/RTVOoost Beatrixschool Nijverdal.wmv_2.flv&image=/Players/princesbeatrixschool.jpg');
s1.write('player1');
var s1 = new SWFObject('/Players/player.swf', 'ply2', '305', '90', '9.0.124', '#FFFFFF');
s1.addParam('allowscriptaccess', 'always');
s1.addParam('allowfullscreen', 'true');
s1.addParam('flashvars', 'controlbar=over&file=/players/RTVOost radio.flv&image=radio.png');
s1.write('player2');
</script>



JW Player

User  
0 rated :

Pls i want to incorporate multiple videos to be viewed on one video screen at a click on the video link. Pls can you send me a code i can use to achieve this? Here my email ad: daygee_adeniji@yahoo.com.

Thanks

Ethan Feldman

JW Player Support Agent  
0 rated :

@Jonathan – This can be done with a playlist – http://www.longtailvideo.com/support/jw-player/jw-player-for-flash-v5/24/creating-a-playlist

JW Player

User  
0 rated :

so if i have multiple players on a page (is there a way to abuse javascript to generate unique and nice looking ids for the div id's and player names? like: player1, player2, ply1, ply2

or what is the correct approach to this (i'd like to make a separate player script, but with the ability to generate embed code for say wordpress...), please don't link me to any 3rd party hosted plugins, i need my scripts to work outside of internet as well.

JW Player

User  
0 rated :

p.s. or would a php like this be unique enough?
bc.. <?php
//creates a unique id with the 'div_' and 'ply_' prefix
$a = uniqid();
$b = 'div_'.$a;
$c = 'ply_'.$a;

echo $b;
echo "<br>";

echo $c;
echo "<br>";
?>

Ethan Feldman

JW Player Support Agent  
0 rated :

@brontosaurusrex – That would work. You just need to make sure every instance of the player has unique IDs.

This question has received the maximum number of answers.