后在IE加载6个音频MEDIA_ERR_SRC_NOT_SUPPORTED HTML5音频返回错误 [英] Html5 audio return error MEDIA_ERR_SRC_NOT_SUPPORTED after 6 audio loaded in IE

查看:1324
本文介绍了后在IE加载6个音频MEDIA_ERR_SRC_NOT_SUPPORTED HTML5音频返回错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要近20的声音载入我的网页上。我想也许我需要所以这就是为什么你会看到INPROGRESS属性只有2元分装

i need to load near 20 sounds on my page. i thought maybe i need to load only 2 element separately so that's why you will see inProgress property

loadAudio: function () {
        if (this.inProgress <= 1) {
            this.inProgress++;
            var elem = this.audioQueue.pop();
            if (elem != null) {
                var path = elem.Path + elem.Fileid + ((this.canPlayMp3) ? '.mp3' : '.wav');

                audio = new Audio();
                audio.src = "http://localhost:55578/~/x.mp3";
                audio.addEventListener('loadedmetadata', function (e) { AudioPlayer.audioLoaded(e); }, false);
                //audio.addEventListener('loadeddata', function (e) { AudioPlayer.audioLoaded(e); }, false);
                audio.addEventListener('error', function (e) { AudioPlayer.audioLoaded(e); }, false);
                if (elem.AudioType == AudioPlayerTypes.Keyboard) {
                    this.keyboardAudio[elem.Id] = audio;
                }
            }
        }



 audioLoaded: function (e) {
        var t = e.target;
        if (e.type == "error") {
            var code = e.target.error.code;

            console.log("error" + t.currentSrc + e.target.error.code);
        } else {
            console.log("loaded" + t.currentSrc);
        }
        this.inProgress--;
        this.loadAudio();
    }

正如你可以看到我加载相同的声音只是为了测试,但同样的问题后6个音频我得到误差

As you can see i am loading the same sound just for test but the same problem after 6 audio i got error

LOG: loadedhttp://localhost:55578/~/x.mp3 
LOG: loadedhttp://localhost:55578/~/x.mp3 
LOG: loadedhttp://localhost:55578/~/x.mp3 
LOG: loadedhttp://localhost:55578/~/x.mp3  
LOG: loadedhttp://localhost:55578/~/x.mp3  
LOG: loadedhttp://localhost:55578/~/x.mp3  
LOG: errorhttp://localhost:55578/~/x.mp3 (4 - is error code)

它的工作原理pretty酷在Chrome,火狐但不是在IE浏览器。
我无法找到任何限制和解决方案。

it works pretty cool in Chrome, Firefox but not in IE. I cant find any limitations, and solutions.

还有另一个问题:我读了一些时间是最好避免DOM元素,所以这就是为什么我与音频对象干活,因为我需要扮演不同的元素很多次

Also additional question: I read that some times is better avoid DOM elements so thats why i am workin with audio object because i need to play different elements lots of times.

推荐答案

好了真的很奇怪,一般的错误是正确的,因为IE不免费资源。
在我的笔记本电脑是有问题的充电器,电脑真的很慢,今天我改变了它,并且计算机工作速度更快,声音都在浏览器中正确加载:)

Well its really strange, generally error is correct because IE Doesn't have free resources. On my laptop was issue with charger, computer was really slow, and today i changed it, and computer works faster and sounds are loaded in explorer properly :)

这篇关于后在IE加载6个音频MEDIA_ERR_SRC_NOT_SUPPORTED HTML5音频返回错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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