I don’t have any problem with this module on dev / internal test phase.
I create a .aab file, I test it with Google Play store internal sharing, everithing is fine.
I deploy THE SAME .aab file in google play store.
I install this version on the same device than the internal test version (I have uninstalled it before ^-^).
I make the same process, and the sound is not played … I have an error : “A reference does not exist for the specified audio id”.
Same code, same device, same process, different result …
Do you have any idea why this is happening ?
For more info, my code :
import {Injectable} from "@angular/core";
import {NativeAudio} from "@ionic-native/native-audio";
import {LoggerService} from "./logger.service";
import {Platform} from "ionic-angular";
/**
* Liste des sons
*/
export enum SoundEnum {
ARTICLE_INCONNU = "sound.article.inconnu",
//#18948
ARTICLE_EXISTANT = "sound.article.existant",
ERROR = "sound.error",
}
const SOUNDS = new Map<SoundEnum, string>([
[SoundEnum.ARTICLE_INCONNU, 'tidou'],
[SoundEnum.ARTICLE_EXISTANT, 'beep-02'],
[SoundEnum.ERROR, 'beep-03']
]);
@Injectable()
export class SoundService {
constructor(private audio: NativeAudio, private logger: LoggerService, platform: Platform) {
platform.ready()
.then(() => SOUNDS.forEach((filename, key) => this.load(key, filename)));
}
private async load(key: SoundEnum, filename: string) {
try {
await this.audio.preloadSimple(key, `assets/sounds/${filename}.mp3`);
} catch (e) {
this.logger.error(`Erreur lors du préchargement de ${key}`, e);
}
}
/**
* Jouer un son
* @param sound
*/
jouer(sound: SoundEnum) {
this.audio.play(sound).catch(err => this.logger.error(`Erreur lors de la lecture de la piste audio ${sound}`, err));
}
}