Hiya,

I'm trying to setup SWF Tools to work correctly, but is seems no matter what I do, it doesn't want to cooperate. I'm new to drupal and this site, so if someone has already raised this, please forgive me.

If I enable the javascript replacement for embedding, when looking at the page source I notice (in the head of the page):

(This is using a php node)

<?php print swf('remotetv_VP6_384K.flv'); ?>

------------------------

<script type="text/javascript" src="/modules/swftools/shared/"></script>

<script type="text/javascript">
  $(document).ready(function(){
    $('.swfobject').each(function(i){
      params = Drupal.parseJson($(this).attr('swftools'));
	    var so = new SWFObject(params['src'], '', params['width'], params['height'], params['version'], params['bgcolor']);
      so.addParam('quality', params['quality']);
      so.addParam('wmode', params['wmode']);
      so.addParam('align', params['align']);
      so.addParam('salign', params['salign']);
      so.addParam('play', params['play']);
      so.addParam('loop', params['loop']);
      so.addParam('menu', params['menu']);
      so.addParam('salign', params['salign']);
      so.addParam('base', params['base']);
      so.addVariable('flashvars', '&'+ params['flashvars']);
      so.addParam('allowfullscreen','true');
      so.write(this.id);
    });
  });
  </script>

---------

    <div class="wijering-mediaplayer "><div id="swfobject-id-11800494771" class="swftools swfobject" swftools='{ "wmode": "opaque", "bgcolor": "#FFFFFF", "menu": 0, "play": 1, "loop": 0, "quality": "autohigh", "align": "l", "salign": "tl", "scale": "showall", "swliveconnect": "default", "version": "7", "base": "http://mcnubblet.net/media/", "src": "http://mcnubblet.net/modules/swftools/shared/flash_media_player/mediaplayer.swf", "flashvars": "file=http%3A//mcnubblet.net/media//remotetv_VP6_384K.flv" }' >
</div>

The bit that has me concerned is that is doesn't actually have the script filename included, just the 'shared' path, and also the double slash in the 'file' flashvar.

If I use direct embed (without the javascript), the flash will work, but the 'file' flashvar still has the double slash in it.

If I use the filter, as opposed to the php code, the actual filename of the flv i'm trying to embed is truncated out of the 'file' flashvar, so just the path appears. The same thing occurs with/without the javascript replace when using the Flash filter.

If you need to have a look at my site/config,, let me know and i'll set you up.

Thanks for your time,
Nub.

Comments

sime’s picture

Don't use filters just yet, I'll be fixing them last before the release.

Hmm, that double slash... I assume you have the media url set?

sime’s picture

Make sure the media url doesn't have a trailing slash.

Otherwise, the actual swfobject js looks normal... is swfobject showing any errors in the javascript embedding section of /admin/media/swf/embed ?

McNubblet’s picture

Heya,

Thanks for the quick response.

Yes, i have the media URL set, but it doesn't have a trailing slash at all. It's: http://mcnubblet.net/media

No errors are showing anywhere in the javascript embed config stuff.

My question about the JS was, shouldn't this line:

<script type="text/javascript" src="/modules/swftools/shared/"></script>

be
<script type="text/javascript" src="/modules/swftools/shared/swfobject1-5/swfobject.js"></script>

If you need any more info, let me know :)

Thanks again,
Nub.

sime’s picture

Oh I see.

I did just fix that line in the last day, can you make sure your version of swfobject.module has this at the top?:
// $Id: swfobject.module,v 1.1.2.2.2.9 2007/05/25 00:53:37 sime Exp $

If not, then you need to download again when the packaging script runs again (I just checked and it hasn't updated yet.) Here is a link to the new file directly in CVS if you can't wait:
http://cvs.drupal.org/viewcvs/drupal/contributions/modules/swftools/swfo...

McNubblet’s picture

OK, downloaded the lastest version of that module, same thing happened :(

Had a look inside and did the following:

Function: swfobject_swftools_embed
Added:

  $methods = array();
  $methods = swfobject_swftools_methods();

below:

  static $swfobject_has_run;
  static $swfobject_id = 0;

Changed:

    drupal_add_js(swftools_get_player_path() .'/'. $methods->embed['shared_file']);

to:

    drupal_add_js(swftools_get_player_path() .'/'. $methods[SWFTOOLS_EMBED_METHOD]['swfobject_replace']['shared_file']);

Now the file is appearing in the 'Script' tag properly.

However, the player is still not showing up. It's made room for the player, and you can right click in the blank spot and get the flash player menu showing up, however, nothing is showing there.

I did take out the media directive from the setting.php, and am now using default paths and the double-slash problem has gone away.

This is the code showing up in the html now:

  <div class="content"><div class="wijering-mediaplayer "><div id="swfobject-id-11800676771" class="swftools swfobject" swftools='{ "wmode": "opaque", "bgcolor": "#FFFFFF", "menu": 0, "play": 1, "loop": 0, "quality": "autohigh", "align": "l", "salign": "tl", "scale": "showall", "swliveconnect": "default", "version": "7", "base": null, "src": "http://mcnubblet.net/modules/swftools/shared/flash_media_player/mediaplayer.swf", "flashvars": "file=http%3A//mcnubblet.net/files/remotetv_VP6_384K.flv" }' >
files</div></div></div>

The "base" var change from an actual path to 'null' now. Don't know if that has anything to do with it though.

To check out what i mean by "blank space": http://mcnubblet.net/

Cheers,
Nub.

Stuart Greenfield’s picture

Status: Active » Needs review

This error occurs if you set the option to embed js on every page.

If using swfobject then when swfobject_swftools_embed is called for embedding on every page $methods->embed['shared_file'] isn't set, so the broken script line is created.

If line 43 of swfobject is replaced with

drupal_add_js(swftools_get_player_path() .'/'. 'swfobject1-5/swfobject.js');

then it works.

I'm not sure that within swfobject the script string needs to be a parameter - if the embedding method is swfobject then this is always the script?

sime’s picture

Status: Needs review » Fixed

There is no harm in this fix. I have applied it to all three js embedding modules.
http://drupal.org/cvs?commit=68696
http://drupal.org/cvs?commit=68697

Note that IE7 is not working for js replacement. Any other problems here please reopen.

Also note that I've changed the standard path for swfobject to swfobject/swfobject.js, because the "1.5" reference was not very long-term. Note that swfobject1.5 is how the zip file unpacks which is why I had it like that.

Anonymous’s picture

Status: Fixed » Closed (fixed)