Order Now AdSolution Sign Up | Login » Bits on the Run Sign Up | Login »

Forums

/

swfobject.js/player mismatch

6 replies [Last post]

I have constructed a page based on example "JW_API_xmpl_5-2-1-0.html". At first it did not work then I tried upgrading he swfobject.js file. This cured the problem for this page, but then rendered the JW Player inoperable on every other page, i.e the player does not appear at all. If I swap back to the original swfobject.js file the problem is reversed, yet every page is pointing at the same player.swf file. The obvious answer seems to be a player.swf/swfobject.js mismatch but I can't figure out what it is - so HELP!!!

Below is the code for the first page I mentioned:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0075)http://home5.inet.tele.dk/nyboe/flash/mediaplayer4/JW_API_xmpl_5-2-1-0.html -->
<HTML><HEAD><TITLE>Test1 </TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<SCRIPT
src="swfobject.js"
type=text/javascript></SCRIPT>

<SCRIPT type=text/javascript>

var player = null;
function playerReady(thePlayer) {
player = window.document[thePlayer.id];
}

function createPlayer() {
var flashvars = {
streamer:"http://www.mysite.co.uk/xmoov.php",
file:"THB_Web_Full.flv",
autostart:"true"
}

var params = {
allowfullscreen:"true",
allowscriptaccess:"always"
}

var attributes = {
id:"player1",
name:"player1"
}

swfobject.embedSWF("player.swf", "placeholder1", "400", "300", "9.0.115", false, flashvars, params, attributes);
}
</SCRIPT>

<META content="MSHTML 6.00.6000.16825" name=GENERATOR></HEAD>
<BODY onload=createPlayer()><A
href="http://www.jeroenwijering.com/?item=JW_FLV_Media_Player">JW FLV Media
Player</A><BR>Load files from links (or script)<BR>
<DIV id=placeholder1><A href="http://www.adobe.com/go/getflashplayer">Get
flash</A> to see this player </DIV><BR>

<a href="#" onClick="player.sendEvent('STOP');
player.sendEvent('LOAD',
'Riversmead Staff Conference.flv');
">load video 1</a>
<br>

<a href="#" onClick="player.sendEvent('STOP');
player.sendEvent('LOAD',
'Raven_ASB.flv');
">load video 2</a>
<br>

<a href="#" onClick="player.sendEvent('STOP');
player.sendEvent('LOAD',
'Sailing Promotional Video.flv');
">load video 3</a>

</BODY></HTML>

For pages that require swfobject v2.x, like the one that you posted above, you can specify:

<script type="text/javascript" src="swfobject-2.js"></script>

And for pages that require SWFObject v1.5, you can specify:

<script type="text/javascript" src="swfobject-1.5.js"></script>

Then make sure that you have the two JavaScript files on your server.

Make sure that you keep the line of HTML code that loads the JS files all on one line to avoid troubles with Internet Explorer.

Hi Lollie

The change worked! Thank you!

How were you able to spot that the page required swfobject v2.x? How will I know in future?

My general question to the guys at JW is why do they provide examples which use two different versions of swfobject?

Mark

The common JS code format is very different.

SWFObject v1.5 uses so.addParam & so.addVariable.

swfobject v2.x uses arrays of name:value pairs.

v1.5 was in widespread usage and still works. v2.x has some enhancements and is easier to use. You will see sample code for both.

Is it possible to use both 1.5 & 2.0 on the same page?

There shouldn't be any conflict, but you will have to test in your exact situation.

But why not upgrade your v1.5 code to take advantage of the advances in swfobject?

The advantages of using swfobject v2.x loaded from Google's CDN:

    Loading from Google AJAX Libraries API:

        http://pipwerks.com/journal/2008/11/11/swfobjectjs-finds-a-home-on-google-servers/

    How & Why You Should Use Google CDN:

        http://webmuch.com/how-why-you-should-use-google-cdn/

Back to what bigchetti was asking.

Is it possible to use both 1.5 & 2.2 on the same page?

For whatever reason I my website doesn't work properly on IE, but works fine with Firefox.

The problem is I'm using someone's mp3 player, and implementing my own flash into the website as well. If I specify the swfobject.js that is 1.5 the mp3 player works, but the other flash doesn't. If i specify the swfobject.js that is 2.2, the mp3 player doesn't work, and all the other flash does.

I am terrible at coding, and if there is a little bandage fix for this, it would be GREATLY appreciated, ive spent many hours on this problem ;(

The website is www.whytehype.com