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

OBJECT Syntax


How can you use <OBJECT> syntax for setting up JW Player instead of JavaScript?

Here's why I ask. I currently have the following XLS that works perfectly in FireFox, but the the JW Player javascript doesn't work in IE. It looks like the resulting javascript is actually never executed. So I'd like to use the old <OBJECT> syntax instead. That's what I have for Windows media player and it works in both FireFox and IE. Of course if anyone can explain my FireFox problem, I'd certainly like to hear it.

<xsl:choose>
<xsl:when test="$media/@type = 'flash'">
<p><xsl:value-of select="$mediaPath"/></p>
<div id="{$media/@id}"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.</div>
<script type="text/javascript">
var s1 = new SWFObject("../flash/player.swf","ply","300","400","9","#FFFFFF");
s1.addParam("allowfullscreen","true");
s1.addParam("allowscriptaccess","always");
s1.addParam("flashvars","file=C:/Documents%20and%20Settings/Brad/My%20Documents/LT/deviewer/devsrc/deroot/public/courses/DEViewer_Tests_en/media/stewardship.swf");
s1.write("<xsl:value-of select="$media/@id"/>");
</script>
</xsl:when>
<xsl:when test="$media/@type = 'msmediaplayer'">
<OBJECT ID="MediaPlayer1" WIDTH="{$finalPlayerWidth}" HEIGHT="{$finalPlayerHeight}" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">
<PARAM NAME="URL" VALUE="{$mediaPath}"/>
<PARAM NAME="volume" VALUE="0"/>
<PARAM NAME="enabled" VALUE="true"/>
<PARAM NAME="autoStart" VALUE="{$autostart}"/>
<EMBED type="application/x-mplayer2" src="{$mediaPath}" name="MediaPlayer1" width="{$finalPlayerWidth}" height="{$finalPlayerHeight}"/>
</OBJECT>
</xsl:when>
</xsl:choose>

UPDATE: I still have the same question, but I've learned something. It turn out that when generating javascript via xslt you need to have to add defer="defer" to the script tag: <script type="text/javascript" defer="defer">.

Figuring that out helped a little, but IE still blows up saying SWFObject isn't defined. So I still need to know how to use <OBJECT> syntax instead of JavaScript.

3 Community Answers

JW Player

User  
0 rated :

I finally found an example of <OBJECT> syntax at http://www.longtailvideo.com/support/forum/Setup-Problems/14193/INSTALLATION-FOR-IGNORANTS-OR-STARTERS#msg96333.

I changed it just a bit to run the sample that comes w/ the player. This code assumes everything is in the same folder. Note this is using swfobject 1.5.

bc.. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
swfobject.registerObject("myFlashContent", "9.0.0");
</script>
</head>
<body>
<div>

<object id="player1" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9.0.115" width="320" height="240">
<param name=bgcolor value="#FFFFFF">
<param name=movie value="player.swf">
<param name=allowfullscreen value="true">
<param name=allowscriptaccess value="always">
<param name="flashvars" value="file=http://www.studioroosegaarde.net/video/TV_Documentary_Daan_Roosegaarde.flv&controlbar=bottom">
<embed name="player1" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="320" height="240"bgcolor="#FFFFFF" src="player.swf" allowfullscreen="true"allowscriptaccess="always" flashvars="file=video.flv&controlbar=bottom">
</embed>
</object>
</div>
</body>
</html>

JW Player

User  
1 rated :

I never get this to work in IE when the code was generated with XSL. The couldn't get past sfwobject not found errors. Just when I was about to give up, I found the "Scriptless Embedding" example at http://www.longtailvideo.com/support/tutorials/Javascript-API-Examples:

bc.. <html>
<head>
<title>JW API Example 1-3-2-0 - only Embed code</title>
</head>
<body>

<embed name="player1" id="player1"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer"
width="320" height="240"
bgcolor="#FFFFFF"
src="player.swf"
allowfullscreen="true"
allowscriptaccess="always"
flashvars="file=video.flv&fullscreen=true&controlbar=bottom">
</embed>

</body>
</html>


JW Player

User  
0 rated :

Once you use scriptless embedding, how can you go behind and use Javascript to control playback?

This question has received the maximum number of answers.