views:

342

answers:

1

I'm using Windows Media Player in a web page. I have version 11 installed so that is the version I'm testing with right now. The player is embedded on the page with this HTML:

<OBJECT id='MS_mediaPlayer' width="400" height="45" classid='CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6' 
  codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'
  standby='Loading Microsoft Windows Media Player components...' type='application/x-oleobject'>
  <param name='autoStart' value="false">
  <param name='uiMode' value="invisible">
  <param name='loop' value="false">
</OBJECT>

I'm calling in JavaScript:

  MS_mediaPlayer.URL = "SomeAudioFile.mp3"
  MS_mediaPlayer.controls.play();

When I look at Fiddler I can see that the player actually downloads "SomeAudioFile.mp3" twice. Is there some setting I have wrong? I was trying to set the "autoPlay" to true and avoid calling "play()". Got the same result - two downloads.

UPDATE: The first request's user-agent is "Windows-Media-Player/11.0.5721.5268". The second has "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; GTB6; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)". Looks like the browser is running the same request the second time. No Idea why

Any ideas?

UPDATE (4/1/10):
Still no solution.

  • I debugged the JS thoroughly and there is only one call to MediaPlayer.URL='.....' to set the audio file. Nothing else triggers the media player to load the file and there is no other place referencing the audio file on the page.
  • One other interesting fact is that this doesn't happen (the double loading of the audio) when I run the browser locally on my development web server. But other remote requests to the same web server generate the double audio loading.
  • I believe I eliminated any correlation with specific IE version or media player version. This happens with IE6-8 and WM9-12
+1  A: 

You have to examine the requests carefully. Sometimes, you'll see a media player make two requests because they are using HTTP Range requests (and not requesting the whole file). Look for a "Range" request header. Also check to make sure that neither of the requests uses the HEAD method, because that simply retrieves the server's response headers.

Also, if either of the sessions shows as aborted in the Fiddler Session List ("do not enter icon, red circle with a line through it") it means that the client closed the request in the middle. That might occur if the component starts the download, aborts it, and then restarts it. Why it might do that, I'm not sure.

You might try looking at other sites that use WMP and see whether you see two requests for them.

EricLaw -MSFT-
Both requests are successful and both have the same size (which is the whole audio file size). Both a a GET request. I found one difference though. The first request's user-agent is "Windows-Media-Player/11.0.5721.5268". The second has "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; GTB6; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)".Looks like the browser is running the same request the second time. No Idea why
Ron Harlev
With the HTML you've provided, the browser itself never sees the URL of the audio file. So it's either referenced in a different part of the HTML, or WMP is causing the browser to make this request in some other way.
EricLaw -MSFT-
Nothing on the HTML page is requesting the audio file, except for the WMP itself :(
Ron Harlev
You mentioned the "Range" issue in the request. Is there anything I can do to prevent the range requests?
Ron Harlev
Do you see a "Range" header in the request? If so, then WMP is only trying to download a part of the file. What Range does it ask for?
EricLaw -MSFT-
Looks like the Window Media Player is handing over the request to the IE component in it. That's why I see two requests. The data presented by fiddler is distorted though. The total data transfer has the total size on the file only once. Although I don't see a "range" in the request in every case.
Ron Harlev
I must confess that I don't know what "distorted" means.
EricLaw -MSFT-
@EricLaw -MSFT- Fiddler is showing two requests, each one with the full size of the audio file transferred to the client. This is not the reality. Using a tool like wireshark shows that the two requests together total the size of the audio file (plus some headers overhead)
Ron Harlev