2

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
Ron Harlev
  • 16,227
  • 24
  • 89
  • 132
  • I see the same issue when opening a WAV file directly from the media player application (over the web). It will load the file 2 or 3 times (observed by Fiddler). For some reason this doesn't happen when the file has an MP3 extension. – Ron Harlev Apr 05 '10 at 20:29
  • I have finally found a solution (actually, a work-around) for this: simply drop the 1st request that is made. For me, the 1st request came in with a `User-Agent: Windows-Media-Player/12.x.y.z`, and the 2nd would come in as `User-Agent: NSPlayer/12.x.y.z WMFSDK/12.x.y.z`. The 2nd seems to be the only one that matters. I have PHP completely ignore the first request, and everything streams fine still. YMMV. I think this is internal WMP behavior, so we can't prevent it, only mitigate it. – ken Aug 13 '13 at 16:11

1 Answers1

1

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
  • 56,563
  • 7
  • 151
  • 196
  • 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 Sep 04 '09 at 16:17
  • 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 Sep 04 '09 at 20:17
  • Nothing on the HTML page is requesting the audio file, except for the WMP itself :( – Ron Harlev Sep 04 '09 at 21:06
  • You mentioned the "Range" issue in the request. Is there anything I can do to prevent the range requests? – Ron Harlev Apr 02 '10 at 16:08
  • 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 Apr 03 '10 at 00:49
  • 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 Apr 08 '10 at 00:03
  • I must confess that I don't know what "distorted" means. – EricLaw Apr 08 '10 at 02:09
  • @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 Apr 08 '10 at 15:14