@sumaris-net/ngx-components 2.4.70 → 2.4.71
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/esm2020/src/app/shared/audio/audio.mjs +19 -4
- package/fesm2015/sumaris-net.ngx-components.mjs +18 -3
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +18 -3
- package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -10497,17 +10497,25 @@ class AudioProvider extends StartableService {
|
|
|
10497
10497
|
this._audioType = cordova && Capacitor.isPluginAvailable('NativeAudio') ? 'native' : 'html5';
|
|
10498
10498
|
console.info(`[audio] Starting audio provider {${this._audioType}}...`);
|
|
10499
10499
|
// Listen audio mode changed
|
|
10500
|
-
if (
|
|
10500
|
+
if (cordova && this.audioManagement) {
|
|
10501
10501
|
await this.readAudioMode();
|
|
10502
10502
|
}
|
|
10503
10503
|
// Pre-loading system sounds
|
|
10504
10504
|
console.debug('[audio] Preloading audio sounds...');
|
|
10505
|
+
let errorCount = 0;
|
|
10505
10506
|
await Promise.all(SYSTEM_SOUNDS.map(s => {
|
|
10506
10507
|
// Disable vibration in HTML 5 mode
|
|
10507
10508
|
if (this._audioType === 'html5')
|
|
10508
10509
|
s.vibration = undefined;
|
|
10509
|
-
return this.preload(s)
|
|
10510
|
+
return this.preload(s)
|
|
10511
|
+
.catch(_ => errorCount++);
|
|
10510
10512
|
}));
|
|
10513
|
+
if (errorCount > 0) {
|
|
10514
|
+
console.warn('[audio] Preloading audio sounds [OK] with ${errorCount} errors during preload.');
|
|
10515
|
+
}
|
|
10516
|
+
else {
|
|
10517
|
+
console.debug('[audio] Preloading audio sounds [OK]');
|
|
10518
|
+
}
|
|
10511
10519
|
}
|
|
10512
10520
|
playBeepConfirm() {
|
|
10513
10521
|
return this.play('beep-confirm', {
|
|
@@ -10555,7 +10563,14 @@ class AudioProvider extends StartableService {
|
|
|
10555
10563
|
console.info(`[audio] Preloading sound '${sound.assetId}' [OK]`);
|
|
10556
10564
|
}
|
|
10557
10565
|
catch (err) {
|
|
10558
|
-
|
|
10566
|
+
const errorMsg = err?.message || err;
|
|
10567
|
+
if (errorMsg === 'Audio Asset already exists') {
|
|
10568
|
+
console.info(`[audio] Preloading sound '${sound.assetId}': Skipped (${errorMsg})`);
|
|
10569
|
+
}
|
|
10570
|
+
else {
|
|
10571
|
+
console.error(`[audio] Unable to preload sound '${sound.assetId}', from file '${assetPath}': ${errorMsg}\n${err?.originalStack || ''}`);
|
|
10572
|
+
throw err;
|
|
10573
|
+
}
|
|
10559
10574
|
}
|
|
10560
10575
|
}
|
|
10561
10576
|
async play(assetId, opts) {
|