Since Firefox 3 came out I found an error in video size with the asset bonus module.

As an example you can see it at http://www.amnesty.org/en/news-and-updates/video-and-audio/close-guantan.... (I already fixed my issues)

It seems the flash player isn't respecting the object size. A fix for this is to pass the size in as flashvars and the player will adjust to the size passed in. To do this the $options array (passed to the theme calls for the swfobject player) needs to have something that looks like:

$options['vars'] = array(
  'height' => '123',
  'width' => '456',
);

Notice no px on the size. If px is there is won't work. I'll try to roll a patch later this week.

Comments

wmostrey’s picture

Hey Matt,

I'm in the process of tackling this but I'm unsure what to change. I'm passing the width and height to the flvplayer already, right?

var oSwf = new SWFObject("myfile","swfobject-object-782","320","240","0","#FFFFFF");

What should be added?

mfer’s picture

First, I'd love to throw a patch together but I don't have a setup to do so where I'm at so I'll try to explain in detail. If you can wait I'll write up a patch over the weekend.

There are two sizing components to displaying the flash video player and they are the size listed in the object tag and the size passed to the JW flv flash player.

In the line var oSwf = new SWFObject("myfile","swfobject-object-782","320","240","0","#FFFFFF"); the 320 width and 240 height are only passed into the object tag for sizing. In firefox 3 that means the object tag will render at the right size but the flash video player won't. The solution I found was to additionally pass the size into the flv flash video player so it would know what size to render at (there is documentation for this).

To do this we can add a height and width to the variables to the object. Here is an example of how we can change it (in theme_asset_bonus_swfobject()):

...

  if ($asset->extension=="flv") {
    $addVariable .="oSwf.addVariable('file', '". $asset->url ."');";
    $addParam .="oSwf.addParam('allowfullscreen', 'true');\n";
    $asset->url = base_path() . drupal_get_path('module', 'asset_bonus') .'/swfobject/flvplayer.swf';
    // if (arg(2)!="edit" && (arg(0)!="node" || $options['width']==0)) {
    if (arg(2)!="edit" && ($options['height']=="112.5" || $options['height']=="100")) {
      // Set a default width/height if none is available or when we're looking at an asset gallery (panels)
      $options['width']  = 204;
      $options['height'] = 145;
    }
    elseif (arg(2)=="edit") {
      // Set a static width/height to keep the asset cck gui clean
      $options['width']  = 120;
      $options['height'] = 80;
    }
  }
  elseif (substr($asset->url, 0, 4) !="http") {
    $asset->url = '/'. $asset->url;
  }

  // Start of addition to fix firefox 3 issue
  if (!empty($options['width'])) $addVariable .= "oSwf.addVariable('width', '{$options['width']}');\n";
  if (!empty($options['height'])) $addVariable .= "oSwf.addVariable('height', '{$options['height']}');\n";
  // End of addition to fix firefox 3 issue

  // build a list of addParam statements for known params
  if ($options['transparent']) {
    $addParam .= "oSwf.addParam('wmode', 'transparent');\n";
  }

...

This code is untested but the concept is solid.

wmostrey’s picture

Status: Active » Fixed

Works as expected and it doesn't interfere with FF2 or other browsers. http://drupal.org/cvs?commit=132928

Thanks so much Matt, your contributions are highly appreciated, and also a late congratulation on launching The Fishbowl!

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.