Window Media Player issues two requests for the audio on web page

瘦欲@ 提交于 2019-12-20 02:55:15

问题


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:


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.




回答2:


See bottom of this article which explains the first request is Windows Media Player "sniffing" to determine file type, while 2nd request is real request.

https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/226315f4-1271-4694-9a0d-68da9a1414cb/media-player-dlna-request-does-not-carry-authorization-header?forum=mediafoundationdevelopment

Still working on how to use this bit of info with generic handler that doesn't expose file name....



来源:https://stackoverflow.com/questions/1376477/window-media-player-issues-two-requests-for-the-audio-on-web-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!