doLoad: function ()
{
var format;
var playableFormats = this.application.soundPlayer.probablePlayableFormats & this.type;
if (playableFormats == 0)
playableFormats = this.application.soundPlayer.maybePlayableFormats & this.type;
for (format = 0; format < 4; format++)
{
if (playableFormats & (1 << format))
{
break;
}
}
if (format < 4)
{
var ext = "";
switch (format)
{
case 0:
ext = "ogg";
break;
case 1:
ext = "m4a";
break;
case 2:
ext = "mp3";
break;
case 3:
ext = "wav"
break;
}
if (this.context)
{
var that = this;
var request = new XMLHttpRequest();
request.open('GET', this.application.resources + CServices.formatDiscName(this.handle, ext), true);
request.responseType = 'arraybuffer';
request.addEventListener('load', function (event)
{
that.response = request.response;
that.application.soundPlayer.addDataToDecode(that);
});
request.send();
}
else
{
this.sound = new Audio();
this.sound.preload = "auto";
var that = this;
this.sound.addEventListener("loadeddata", function (e)
{
that.application.dataHasLoaded(that);
that.sound.removeEventListener('loadeddata', arguments.callee, false);
}, false);
this.sound.addEventListener("error", function (e)
{
that.application.dataHasLoaded(that);
that.sound = null;
}, false);
this.sound.src = this.application.resources + CServices.formatDiscName(this.handle, ext);
this.sound.load();
this.sound.autoplay = false;
}
}
else
this.application.dataHasLoaded(this);
},
This is a function for uploading audio files. The problem arises with the part of the code where the http receive request is sent. At the same time, the first 2 audio files are loaded and after that nothing happens (the game does not start). In the developer console, no requests end in a fail, they simply do not exist. If you comment out this request and create all the audio as in the else block, then they are loaded with the answer 206, and in the game itself, when playing any sound, all audio is played at once (only on the iPhone, everything works fine on other devices). The problem only concerns iPhones, everything is fine on android. It also doesn’t matter in which browser the game opens (Chrome, Safari) the error is everywhere.
I tried to comment on some things in my code and found only this place, when commenting on which the game at least somehow works on iPhones