简体   繁体   中英

Microsoft Edge 123 audio limit

I have ran into a weird error unique to only Edge.

It seems that you can only have 123 new Audio() instances. The next one will have an error MediaError.code of MEDIA_ERR_SRC_NOT_SUPPORTED . Edge starts to think the the file is unsupported or something - so it never loads. networkState will be equal to NETWORK_NO_SOURCE and readystate to HAVE_NOTHING .

I've made a jsFiddle. Open the link bellow in Edge, open Developer Tools. Then press "Start 123" button (it should work without errors). After it's done, press "Start 124" button, and then errors will appear in your Console.

https://jsfiddle.net/rqg0xsw7/5/

Same as snippet:

 var curIntervalId = 0; function startDownload(sndMax) { var sndFile = "http://freesound.org/data/previews/33/33245_65091-lq.mp3"; var sndIndex = []; for (var i = 0; i < sndMax; i++) { var snd = new Audio(); snd.src = sndFile + "?v=" + Math.random(); snd.load(); sndIndex.push(snd); } function checkSounds() { var completed = 0; var errored = 0; for (var i = 0; i < sndIndex.length; i++) { var sndError = sndIndex[i].error; if (sndError !== null) { errored++; console.log(sndError); } if (sndIndex[i].readyState === 4) { completed++; } } $("#completed").html(completed + "/" + sndIndex.length); $("#errored").html(errored); if ((completed + errored) === sndIndex.length) { $('#done').html('Yes'); $("button").prop('disabled', false); clearInterval(curIntervalId); } } return setInterval(function() { return checkSounds(); }, 1000); } $("#start123").click(function() { $("#completed").html("0/0"); $("#errored").html(0); $('#done').html('No'); $("button").prop('disabled', true); curIntervalId = startDownload(123); }); $("#start124").click(function() { $("#completed").html("0/0"); $("#errored").html(0); $('#done').html('No'); $("button").prop('disabled', true); curIntervalId = startDownload(124); }); 
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <button id="start123">Start 123</button> <button id="start124">Start 124</button> <table> <tr> <td>Completed</td> <td> <div id="completed">0/0</div> </td> <tr> <tr> <td>Errors</td> <td> <div id="errored">0</div> </td> <tr> <tr> <td>Done</td> <td> <div id="done">0</div> </td> <tr> </table> 

The only difference between those 2 buttons is the amount of new Audio being loaded (123 versus 124). I've also tried loading new Audio() elements separately instead of all at once - that made no difference. Also, file size makes no difference either.

Any idea how to bypass this bug?

You had mentioned that,"Open the link bellow in Edge, open Developer Tools. Then press "Start 123" button (it should work without errors). After it's done, press "Start 124" button, and then errors will appear in your Console."

I try to make a test with your JS Fiddle code in EDGE. I did not get any error but I got a warning message.

Below is my testing result.

Click here to see the testing result.

You can see that it is working without any error.

I suggest you to install the latest Windows Updates and again try to reproduce the issue. It is possible that, In latest updates the issue is solved.

You can make a test and let us know about your testing results.

We will try to provide further suggestions, If needed.

Regards

Deepak

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM