Window Media Player 对网页上的音频发出两个请求

发布于 2024-08-04 08:53:06 字数 1562 浏览 12 评论 0原文

我在网页中使用 Windows Media Player。我安装了版本 11,所以这是我现在正在测试的版本。播放器使用以下 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 调用:

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

当我查看 Fiddler 我可以看到播放器实际上下载了“SomeAudioFile.mp3”两次。是不是我的设置有什么错误?我试图将“autoPlay”设置为 true 并避免调用“play()”。得到相同的结果 - 两次下载。

更新: 第一个请求的用户代理是“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)”。看起来浏览器正在第二次运行相同的请求。不知道为什么

有什么想法吗?

更新(2010 年 4 月 1 日):
还是没有解决办法。

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鯉魚旗 2024-08-11 08:53:06

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

此外,如果其中一个会话在 Fiddler 会话列表中显示为已中止(“不要输入图标,带有一条线的红色圆圈”),则意味着客户端在中间关闭了请求。如果组件开始下载,中止下载,然后重新启动,则可能会发生这种情况。为什么它会这样做,我不确定。

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

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文