@galacean/engine-loader 2.0.0-alpha.37 → 2.0.0-alpha.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -6288,8 +6288,7 @@ var AudioLoader = /*#__PURE__*/ function(Loader) {
6288
6288
  resourceManager// @ts-ignore
6289
6289
  ._request(url, requestConfig).then(function(arrayBuffer) {
6290
6290
  var audioClip = new engineCore.AudioClip(resourceManager.engine);
6291
- // @ts-ignore
6292
- engineCore.AudioManager.getContext().decodeAudioData(arrayBuffer).then(function(result) {
6291
+ AudioLoader._getDecodeContext().decodeAudioData(arrayBuffer).then(function(result) {
6293
6292
  // @ts-ignore
6294
6293
  audioClip._setAudioSource(result);
6295
6294
  if (url.indexOf("data:") !== 0) {
@@ -6305,6 +6304,12 @@ var AudioLoader = /*#__PURE__*/ function(Loader) {
6305
6304
  });
6306
6305
  });
6307
6306
  };
6307
+ AudioLoader._getDecodeContext = function _getDecodeContext() {
6308
+ var _AudioLoader;
6309
+ // length/channels are decode-only placeholders; 44100 is the safest cross-browser rate.
6310
+ // decodeAudioData resamples once to this rate then again to the playback rate, so pitch/duration are unaffected
6311
+ return (_AudioLoader = AudioLoader)._decodeContext || (_AudioLoader._decodeContext = new OfflineAudioContext(1, 1, 44100));
6312
+ };
6308
6313
  return AudioLoader;
6309
6314
  }(engineCore.Loader);
6310
6315
  AudioLoader = __decorate([