Window Media Player对网页上的音频发出两个请求 [英] Window Media Player issues two requests for the audio on web page

查看:178
本文介绍了Window Media Player对网页上的音频发出两个请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在网页中使用Windows Media Player.我已经安装了版本11,所以这是我现在正在测试的版本.播放器使用以下HTML嵌入在页面中:

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>

我正在使用JavaScript进行呼叫:

I'm calling in JavaScript:

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

当我查看提琴手时,我可以看到播放器实际上下载了"SomeAudioFile .mp3".我有某些设置有误吗?我试图将"autoPlay"设置为true,并避免调用"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.

更新: 第一个请求的用户代理是"Windows-Media-Player/11.0.5721.5268".第二个具有"Mozilla/4.0(兼容; 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)".看起来浏览器第二次正在运行相同的请求.不知道为什么

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

有什么想法吗?

更新(4/1/10):
仍然没有解决方案.

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

  • 我彻底调试了JS,只有一次调用MediaPlayer.URL='.....'来设置音频文件.没有其他任何事情触发媒体播放器加载文件,并且页面上没有其他地方引用音频文件.
  • 另一个有趣的事实是,当我在开发Web服务器上本地运行浏览器时,不会发生这种情况(音频的两次加载).但是,对同一Web服务器的其他远程请求会产生双重音频加载.
  • 我相信我消除了与特定IE版本或媒体播放器版本的任何关联. IE6-8和WM9-12会发生这种情况
  • 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

推荐答案

您必须仔细检查请求.有时,您会看到媒体播放器发出两个请求,因为它们正在使用HTTP Range请求(而不是请求整个文件).查找范围"请求标头.还要检查以确保两个请求都没有使用HEAD方法,因为这只是检索服务器的响应头.

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.

此外,如果Fiddler会话列表中的任何一个会话都显示为已中止(不输入图标,红色圆圈中带有一行"),则表示客户端在中间关闭了该请求.如果组件开始下载,中止下载然后重新启动,则可能会发生这种情况.我不确定为什么会这样做.

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.

您可以尝试查看其他使用WMP的站点,看看是否看到针对它们的两个请求.

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

这篇关于Window Media Player对网页上的音频发出两个请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆