@sumaris-net/ngx-components 2.4.69 → 2.4.70

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.
@@ -10530,10 +10530,14 @@ class AudioProvider extends StartableService {
10530
10530
  return this.play('startup');
10531
10531
  }
10532
10532
  async preload(sound) {
10533
+ if (!sound?.assetId)
10534
+ return; // Skip
10535
+ if (!!this._preloadedSounds[sound.assetId])
10536
+ return; // Already preloaded
10533
10537
  if (isNil(this._audioType))
10534
10538
  await this.ready();
10535
10539
  const assetPath = (this._assetPathPrefix || '') + sound.assetPath;
10536
- console.info(`[audio] Preloading audio file '${assetPath}'...`);
10540
+ console.info(`[audio] Preloading sound '${sound.assetId}', from file '${assetPath}'...`);
10537
10541
  try {
10538
10542
  if (this._audioType === 'native') {
10539
10543
  await NativeAudio.preload({
@@ -10548,10 +10552,10 @@ class AudioProvider extends StartableService {
10548
10552
  }
10549
10553
  // Add to map
10550
10554
  this._preloadedSounds[sound.assetId] = sound;
10551
- console.info(`[audio] Preloading audio file '${assetPath}' [OK]`);
10555
+ console.info(`[audio] Preloading sound '${sound.assetId}' [OK]`);
10552
10556
  }
10553
10557
  catch (err) {
10554
- console.error(`[audio] Unable to preload audio file '${assetPath}': ${err && err.message || err}\n${err?.originalStack}`);
10558
+ console.error(`[audio] Unable to preload sound '${sound.assetId}', from file '${assetPath}': ${err && err.message || err}\n${err?.originalStack || ''}`);
10555
10559
  }
10556
10560
  }
10557
10561
  async play(assetId, opts) {
@@ -10560,7 +10564,7 @@ class AudioProvider extends StartableService {
10560
10564
  await this.ready();
10561
10565
  const sound = this._preloadedSounds[assetId];
10562
10566
  if (!sound) {
10563
- throw Error(`Unable to find audio with id '${assetId}'. Please call preload() before playing a sound.`);
10567
+ throw Error(`Unable to find sound '${assetId}'. Please call preload() before playing a sound.`);
10564
10568
  }
10565
10569
  // If silent: skip
10566
10570
  if (this._audioMode === AudioManagement.AudioMode.SILENT)