Firefox and WMP Plugin Issue

15 02 2008

I have an issue that only occurs using the Firefox version of the WMP plugin. The intent is to change the video programatically. The following scenario causes 2 problems:

1) The video is not visible even though the player is. The audio stream is playing.

2) Subsequent attempts to set the content of the player cause the video to display, but the internal content stretches to the previous dimensions of the player. (I’m handling the PlayStateChange event.. see below) The first one I play is 360×240 and the second is 320×240.

On an html page I have the plugin created with javascript to handle cross-browser differences:

<script language="JavaScript" type="text/javascript" for="windowsMediaPlayerInstance" event="PlayStateChange(newState)">
  <!--
    onWmpPlayStateChange(newState);
  // -->
</script>

<div style="position: absolute; overflow: hidden; display: none;" id="windowsMediaPlayerHost">
  <script type="text/javascript" language="Javascript">
    <!--
      var player = createWindowsMediaPlayer();
      document.write(player);
    // -->
  </script>
</div>

The player HTML is returned from:

function createWindowsMediaPlayer()
{
  var target;

  if (isIE)  // isIE is provided by the AC_OETags.js script
  {
    target = "IE";
  }
  else
  {
    target = "FF";
  }

  if (isIE)
  {
    content = "<object id='windowsMediaPlayerInstance' classid='CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6' width='320' heigh='240'";
    content += " codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701' type='application/x-oleobject'>";
    content += " <param name='url' value=''>";
    content += " <param name='uiMode' value='none'>";
    content += " <param name='autoStart' value='true'>";
    content += " <param name='enableContextMenu' value='true'>";
    content += "</object>";
  }
  else
  {
    content = "<object id='windowsMediaPlayerInstance' type='application/x-ms-wmp' data='' width='320' heigh='240'>";
    content += " <param name='url' value=''>";
    content += " <param name='uiMode' value='none'>";
    content += " <param name='autoStart' value='true'>";
    content += " <param name='enableContextMenu' value='true'>";
    content += "</object>";
  }

  return content;
}

I set the content:

var player = document.getElementById("windowsMediaPlayerInstance");
player.URL= url;
player.FileName  = url;
player.autoSize  = "0";
player.autoStart = "true";
var host = document.getElementById("windowsMediaPlayerHost");
host.style.display = "block";

Here is how I handle the state change and look for the video to start playing so I can grab the imageSourceWidth and Height:

function onWmpPlayStateChange(newState)
{
  if (newState == 3)
  {
    if (sizeUpdated == false)
    {
      sizeUpdated = true;
      var player = document.getElementById("windowsMediaPlayerInstance");

      if (player == null)
      {
        alert("Error: The Windows Media player control could not be not found.");
      }
      else
      {
        var currentMedia = player.currentMedia;
        var w = currentMedia.imageSourceWidth;
        var h = currentMedia.imageSourceHeight;
        setPlayerSize(w, h);
        updateAppPlayerSize(player.width, player.height);
      }
    }
  }
}

Actions

Information

2 responses to “Firefox and WMP Plugin Issue”

22 07 2008
Miguel (02:27:51) :

I have the same problem, I tryed use “addEventListener” but until now no success. I looking for people reporting the same, but not much information about it. Please, let me know if you find something about this issue.
Regards,
Miguel

22 07 2008
tomschober (15:00:36) :

What problem are you seeing relative to “addEventListener?”

Due to the inefficiency of the WMP plugin for Firefox it was decided that we simply disallow WM playback in the application for now. Very disappointing.

The only good solution is to open another browser window or give it it’s own space where it isn’t floating over flash player.

Leave a comment

You can use these tags : <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>