IE 9和10产生意外的和不一致的MediaError的 [英] IE 9 and 10 yield unexpected and inconsistent MediaError's

查看:208
本文介绍了IE 9和10产生意外的和不一致的MediaError的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一组HTML块 - 说其中约50 - 这是反复解析,并有音频对象动态添加的:

We have a set of HTML blocks -- say around 50 of them -- which are iteratively parsed and have Audio objects dynamically added:

var SomeAudioWrapper = function(name) {

  this.internal_player = new Audio();

  this.internal_player.src = this.determineSrcFromName(name);
     // ultimately an MP3

  this.play = function() {
    if (someOtherConditionsAreMet()) {
      this.internal_player.play();
    }
  }

}

假设我们生成的这些约40至80页上的负荷,但总是为特定配置同一组。在测试的所有浏览器,这个基本的策略似乎工作。音频负载并成功玩了。

Suppose we generate about 40 to 80 of these on page load, but always the same set for a particular configuration. In all browsers tested, this basic strategy appears to work. The audio load and play successfully.

在IE的9和10,一过性缺陷的表面。有时,调用 .play()在内音频对象失败。经检查,内音频对象有一个 .error。code 4 (<一个href=\"http://msdn.microsoft.com/en-us/library/ie/ff974742%28v=vs.85%29.aspx\">MEDIA_ERR_SRC_NOT_SUPPORTED).该文件的 .duration 显示 NaN的

In IE's 9 and 10, a transient bug surfaces. On occasion, calling .play() on the inner Audio object fails. Upon inspection, the inner Audio object has a .error.code of 4 (MEDIA_ERR_SRC_NOT_SUPPORTED). The file's .duration shows NaN.

但是,这仅偶尔发生,并以音频文件的一些随机子集。例如,一般 file_abc.mp3 剧本,但有时它会产生错误。网络监视器显示在这两种情况下成功下载。并试图重新加载该文件通过控制台也没有 - 没有请求出现在IE的网络监控:

However, this only happens occasionally, and to some random subset of the audio files. E.g., usually file_abc.mp3 plays, but sometimes it generates the error. The network monitor shows a successful download in either case. And attempting to reload the file via the console also fails -- and no requests appears in IE's network monitor:

var a = new Audio();
a.src = "the_broken_file.mp3";
a.play(); // fails
a.error.code; // 4

即使追加查询值未能重新获取音频或触发任何网络请求:

Even appending a query value fails to refetch the audio or trigger any network requests:

var a = new Audio();
a.src = "the_broken_file.mp3?v=12345";
a.play(); // fails
a.error.code; // 4

然而,使用相同的code试图负载在新标签破音频文件作品:不支持SRC中扮演完美

However, attempting the load the broken audio file in a new tab using the same code works: the "unsupported src" plays perfectly.

有没有我们可以打任何资源限制? (可能是不支持的音频下载结束晚了吗?)是否有任何已知的bug?解决方法?

Are there any resource limits we could be hitting? (Maybe the "unsupported" audio finishes downloading late?) Are there any known bugs? Workarounds?

我想,我们可以很容易地pretty当一个文件失败检测。对于其他兼容性原因,我们运行一个循环通过应用程序来检查音频进度和完成情况的统计,以prevent进展(评估),直到声音结束。我们可以很容易地寻找 .error 值 - !?但如果我们找到一个,我们该怎么做吧。

I think we can pretty easily detect when a file fails. For other compatibility reasons we run a loop to check audio progress and completion stats to prevent progression through the app (an assessment) until the audio is complete. We could easily look for .error values -- but if we find one, what do we do about it!?

附录:我刚刚发现了一个相关的问题(的 IE 9/10/11声音文件额度)这表明,有41个未公开的限制 - 不知道这是否是41请求音频文件的限制,41内存音频对象,或的什么的。我还没有找到这方面的任何M $的文档 - 或已知的解决方案

Addendum: I just found a related question (IE 9/10/11 sound file limit) that suggests there's an undocumented limit of 41 -- not sure whether that's a limit of "41 requests for audio files", "41 in-memory audio objects", or what. I have yet to find any M$ documentation on the matter -- or known solutions.

推荐答案

你见过在IE内的音频文件限制这些网页?这些是特定于Sound.js,但信息可能适用于您的问题:

Have you seen these pages on the audio file limits within IE? These are specific to Sound.js, but the information may be applicable to your issue:

https://github.com/CreateJS/SoundJS/issues/40 。 ..

在过去的评论中提及了可能的解决方法:控制取决于平台的音频标签的最大数量和重复使用而不是重新创建这些他们

Possible solution as mentioned in the last comment: "control the maximum number of audio tags depending on the platform and reuse these instead of recreating them"

附加信息: http://community.createjs.com/kb/faq/soundjs -faq (见我打开了很多的声音,为什么我遇到了错误,在Internet Explorer中?一节)

Additional Info: http://community.createjs.com/kb/faq/soundjs-faq (see the section entitled "I load a lot of sounds, why am running into errors in Internet Explorer?")

这篇关于IE 9和10产生意外的和不一致的MediaError的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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