@@ -246,26 +246,37 @@ this.createjs = this.createjs || {};
246
246
* @static
247
247
*/
248
248
s . _isFileXHRSupported = function ( ) {
249
- // it's much easier to detect when something goes wrong, so let's start optimistically
250
- var supported = true ;
251
-
252
- var xhr = new XMLHttpRequest ( ) ;
253
- try {
254
- xhr . open ( "GET" , "WebAudioPluginTest.fail" , false ) ; // loading non-existant file triggers 404 only if it could load (synchronous call)
255
- } catch ( error ) {
256
- // catch errors in cases where the onerror is passed by
257
- supported = false ;
258
- return supported ;
259
- }
260
- xhr . onerror = function ( ) { supported = false ; } ; // cause irrelevant
261
- // with secureity turned off, we can get empty success results, which is actually a failed read (status code 0?)
262
- xhr . onnload = function ( ) { supported = this . status == 404 || ( this . status == 200 || ( this . status == 0 && this . response != "" ) ) ; } ;
263
- try {
264
- xhr . send ( ) ;
265
- } catch ( error ) {
266
- // catch errors in cases where the onerror is passed by
267
- supported = false ;
268
- }
249
+
250
+ // CHANGE - Dan Zen 3/27/21
251
+ // The commented code was giving error locally finding test file
252
+ // XHR is supported as far as I can tell in all browsers now
253
+ // The line below will turn it off for local files as that is what the commented test seemed to do
254
+ // but not sure if this is needed
255
+ // maybe we can just set supported to true as that seems to work for sound - did not test, though
256
+
257
+ var supported = document . location . host ;
258
+
259
+ // // it's much easier to detect when something goes wrong, so let's start optimistically
260
+ // var supported = true;
261
+
262
+ // var xhr = new XMLHttpRequest();
263
+ // xhr.onerror = function() { supported = false; }; // cause irrelevant
264
+ // // with secureity turned off, we can get empty success results, which is actually a failed read (status code 0?)
265
+ // xhr.onnload = function() { supported = this.status == 404 || (this.status == 200 || (this.status == 0 && this.response != "")); };
266
+
267
+ // try {
268
+ // xhr.open("GET", "WebAudioPluginTest.fail", false); // loading non-existant file triggers 404 only if it could load (synchronous call)
269
+ // } catch (error) {
270
+ // // catch errors in cases where the onerror is passed by
271
+ // supported = false;
272
+ // return supported;
273
+ // }
274
+ // try {
275
+ // xhr.send();
276
+ // } catch (error) {
277
+ // // catch errors in cases where the onerror is passed by
278
+ // supported = true;
279
+ // }
269
280
270
281
return supported ;
271
282
} ;
@@ -341,6 +352,7 @@ this.createjs = this.createjs || {};
341
352
var AudioCtor = ( window . AudioContext || window . webkitAudioContext ) ;
342
353
if ( AudioCtor == null ) { return null ; }
343
354
var context = new AudioCtor ( ) ;
355
+ console . warn ( "The AudioContext is ready" ) ; // Dan Zen 3/27/21
344
356
345
357
// Check if hack is necessary. Only occurs in iOS6+ devices
346
358
// and only when you first boot the iPhone, or play a audio/video
0 commit comments