April 12, 2009 | Posted by Manchumahara(Sabuj Kundu) in category Joomla, Joomla Extention with tags

I think JW Player(flash player) by longtailvideo.com is well known to u all. There are so many extension for joomla, wordpress, drupal and other cms using this tool. Simple_video_flash_player is a joomla module to show flash and other videos. Today I used it with one of project. But after checking in ie6 I was tempered becuase it was showing a js error in ie and the modules config file I meant he xml file has not param to show module class suffix which is very important to style module using css. I searched google and got so many solution. Here is my code that helped to solve this issue in ie6.

Here is portion module code I mean the main php file of this module (mod_simple_video_flash_player.php)

<div id="videoplayer<?php echo $count ?>">Video Advert</div>
<script src="<?php echo JURI::base();?" type="text/javascript">// < ![CDATA[
  modules/mod_simple_video_flash_player/swfobject.js">
// ]]></script><script type="text/javascript">// < ![CDATA[
 /* function show_simple_video_flash_player(){ var s1 = new SWFObject("< ?php echo JURI::base();;?>modules/mod_simple_video_flash_player/< ?php echo $player ?>","ply< ?php echo $count ?>","< ?php echo $width ?>","< ?php echo $height ?>","< ?php echo $version ?>","#FFFFFF"); s1.addParam("allowfullscreen","true"); s1.addParam("allowscriptaccess","always"); s1.addParam('wmode','opaque'); s1.addVariable("width","< ?php echo $width ?>"); s1.addVariable("height","< ?php echo $height ?>"); s1.addParam("flashvars","file=< ?php echo $video ?>< ?php echo $preview ?>< ?php echo $logo ?>< ?php echo $link ?>< ?php echo $repeat ?>< ?php echo $shuffle ?>< ?php echo $autostart ?>"); s1.write("videoplayer< ?php echo $count ?>"); //alert("hi"); } */window.addEvent('domready', function(){ var s1 = new SWFObject("< ?php echo JURI::base();;?>modules/mod_simple_video_flash_player/< ?php echo $player ?>","ply< ?php echo $count ?>","< ?php echo $width ?>","< ?php echo $height ?>","< ?php echo $version ?>","#FFFFFF"); s1.addParam("allowfullscreen","true"); s1.addParam("allowscriptaccess","always"); s1.addParam('wmode','opaque'); s1.addVariable("width","< ?php echo $width ?>"); s1.addVariable("height","< ?php echo $height ?>"); s1.addParam("flashvars","file=< ?php echo $video ?>< ?php echo $preview ?>< ?php echo $logo ?>< ?php echo $link ?>< ?php echo $repeat ?>< ?php echo $shuffle ?>< ?php echo $autostart ?>"); s1.write("videoplayer< ?php echo $count ?>"); });
// ]]></script>

If u check the last lines I meant he js code that embed the flash player to that a div having a id like videoplayer1, videoplayer2 etc.

Here the problem was with the width and height problem for ie and I solved just adding two extra var for height and with like bellow

s1.addVariable("width","< ?php echo $width ?>");
s1.addVariable("height","< ?php echo $height ?>");

To I have retouched the js code so that the flash object is added after the window is load I mean the dom is ready so that no issue about id unavailability

Just check my code and compare with the original code

/* function show_simple_video_flash_player(){ var s1 = new SWFObject("< ?php echo JURI::base();;?>modules/mod_simple_video_flash_player/< ?php echo $player ?>“,”ply< ?php echo $count ?>“,”< ?php echo $width ?>“,”< ?php echo $height ?>“,”< ?php echo $version ?>“,”#FFFFFF”); s1.addParam(”allowfullscreen”,”true”); s1.addParam(”allowscriptaccess”,”always”); s1.addParam(’wmode’,'opaque’); s1.addVariable(”width”,”< ?php echo $width ?>“); s1.addVariable(”height”,”< ?php echo $height ?>“); s1.addParam(”flashvars”,”file=< ?php echo $video ?>< ?php echo $preview ?>< ?php echo $logo ?>< ?php echo $link ?>< ?php echo $repeat ?>< ?php echo $shuffle ?>< ?php echo $autostart ?>“); s1.write(”videoplayer< ?php echo $count ?>“); //alert(”hi”);

} */window.addEvent(’domready’, function(){ var s1 = new SWFObject(”< ?php echo JURI::base();;?>modules/mod_simple_video_flash_player/< ?php echo $player ?>“,”ply< ?php echo $count ?>“,”< ?php echo $width ?>“,”< ?php echo $height ?>“,”< ?php echo $version ?>“,”#FFFFFF”); s1.addParam(”allowfullscreen”,”true”); s1.addParam(”allowscriptaccess”,”always”); s1.addParam(’wmode’,'opaque’); s1.addVariable(”width”,”< ?php echo $width ?>“); s1.addVariable(”height”,”< ?php echo $height ?>“); s1.addParam(”flashvars”,”file=< ?php echo $video ?>< ?php echo $preview ?>< ?php echo $logo ?>< ?php echo $link ?>< ?php echo $repeat ?>< ?php echo $shuffle ?>< ?php echo $autostart ?>“); s1.write(”videoplayer< ?php echo $count ?>“); });

Again as the default module’s config file mod_simple_video_flash_player.xml has no param for module class suffix so I added just one line.

and the whole file’s code is like now

< ?xml version="1.0" encoding="utf-8"?><install type="module" version="1.5"> <name>Simple Video Flash Player Module</name> <author>www.time2online.de</author> <creationdate>01/23/2009</creationdate> <copyright>time2online</copyright> <license>http://www.gnu.org/copyleft/gpl.html GNU/GPL</license> <authoremail>info@time2online.de</authoremail> <authorurl>http://www.time2online.de</authorurl> <version>1.5</version> <description> < ![CDATA[ <p># Simple Video Flash Player Module # <p>For download, demo and documentation use http://www.time2online.de.</p> <p># JW Player License #</p> <p>Below you see a simple embedded example of the JW Player!</p> <p>Licensing: The player is licensed under a http://creativecommons.org/licenses/by-nc-sa/2.0/ Creative Commons License. It allows you to use, modify and redistribute the script, but only for noncommercial purposes.</p> <p>For corporate use, http://www.longtailvideo.com/players/order Order commercial licenses please apply for a commercial license.</p> ]]> </description> <files> <filename module="mod_simple_video_flash_player">index.html</filename> <filename module="mod_simple_video_flash_player">mod_simple_video_flash_player.php</filename> <filename module="mod_simple_video_flash_player">demo.flv</filename> <filename module="mod_simple_video_flash_player">jwplayer.swf</filename> <filename module="mod_simple_video_flash_player">miniplayer.swf</filename> <filename module="mod_simple_video_flash_player">yt.swf</filename> <filename module="mod_simple_video_flash_player">swfobject.js</filename> </files> <params> <param name="moduleclass_sfx" type="text" default="" label="Module Class Suffix" description="PARAMMODULECLASSSUFFIX" /> <param name="@spacer" type="spacer" default="" label="" description="" /> <param name="player_variant" type="list" default="jwplayer" label="Player" description="choose jw player, mini player or youtube player (default value is jw player)"> <option value="jwplayer">JW Player</option> <option value="miniplayer">Mini Player</option> <option value="yt">Youtube Player</option> </param> <param name="width" type="text" default="200" label="Video Width" description="the width of the flash player (default value is 200)" /> <param name="height" type="text" default="200" label="Video Height" description="the height of the flash player (default value is 200)" /> <param name="@spacer" type="spacer" default="" label="" description="" /> <param name="video_url" type="text" default="demo.flv" label="Single Video URL" description="edit flash video url (for example http://content.bitsontherun.com/videos/3ta6fhJQ.flv)" /> <param name="preview_url" type="text" default="" label="Preview Image URL" description="edit preview image url (for example http://content.bitsontherun.com/thumbs/qyehIiBT.jpg)" /> <param name="@spacer" type="spacer" default="" label="" description="" /> <param name="playlist_url" type="text" default="" label="Multi Playlist URL" description="edit url for the rss file to play (for example http://www.longtailvideo.com/jw/upload/mrss.xml)" /> <param name="playlist_position" type="list" default="over" label="Playlist Position" description="position of the playlist (default value is none)" > <option value="">None</option> <option value="over">Over</option> <option value="right">Right</option> <option value="bottom">Bottom</option> </param> <param name="playlist_size" type="text" default="180" label="Playlistsize" description="edit height or width of the playlist (default is 180)" /> <param name="@spacer" type="spacer" default="" label="" description="" /> <param name="logo_url" type="text" default="" label="Logo URL" description="edit logo image url (for example http://www.longtailvideo.com/jw/upload/longtail.png)" /> <param name="link_url" type="text" default="" label="Link URL" description="edit link to an external site (for example http://www.joomla.org)" /> <param name="autostart" type="radio" default="0" label="Autostart" description="automatically start playing (default value is no)" > <option value="1">Yes</option> <option value="0">No</option> </param> <param name="playlist_repeat" type="list" default="" label="Repeat" description="continously repeat playback (default value is no)" > <option value="">No</option> <option value="repeat=always">Always</option> <option value="repeat=list">List</option> </param> <param name="playlist_shuffle" type="list" default="" label="Shuffle" description="shuffle playlist order (default value is no)" > <option value="">No</option> <option value="shuffle=true">Shuffle</option> </param> <param name="version" type="text" default="6" label="Flash Version" description="edit the minimum version of flash player (default value is 6)" /> <param name="count" type="text" default="1" label="Flash Player ID" description="edit video flash player id" /> </params> <params group="advanced"> <param name="cache" type="list" default="1" label="Caching" description="Select whether to cache the content of this module"> <option value="1">Use global</option> <option value="0">No caching</option> </param> <param name="cache_time" type="text" default="900" label="Cache Time" description="The time before the module is recached" /> </params></install>

One thing to note that that modules uses a free js tool to embed flash in html and that can be found here. So if there is any error about the swfobject.js then u can download the latest one from the above link.

Bye for today.

This articles is read 1440 times

Last Update on July 21st, 2009

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

One Response to Problem in IE for simple_video_flash_player (Joomla module)

  1. Clip says:

    Nice thnx man . that help me now

Leave a Reply

Additional comments powered by BackType

feedback