@carmelo42 wrote:
Hello
I’m new here, and I have a problem.
I can play sound with the native audio plugin this way :import { Component } from '@angular/core'; import { IonicPage, NavController, NavParams, Platform } from 'ionic-angular'; import { ViewController } from 'ionic-angular'; import { NativeAudio } from '@ionic-native/native-audio'; import { BackgroundMode } from '@ionic-native/background-mode'; /** * Generated class for the SonsPage page. * * See https://ionicframework.com/docs/components/#navigation for more info on * Ionic pages and navigation. */ @IonicPage() @Component({ selector: 'page-sons', templateUrl: 'sons.html', }) export class SonsPage { constructor(public navCtrl: NavController, public platform: Platform, public navParams: NavParams, public viewCtrl: ViewController, private nativeAudio: NativeAudio, private backgroundMode: BackgroundMode) { this.platform.ready().then(() => { this.nativeAudio.preloadSimple('cligno', 'assets/audio/Clignotant.mp3').then((success)=>{ console.log("success"); },(error)=>{ console.log(error); }); }); this.platform.ready().then(() => { this.nativeAudio.preloadSimple('klax', 'assets/audio/Klaxon.mp3').then((success)=>{ console.log("success"); },(error)=>{ console.log(error); }); }); this.platform.ready().then(() => { this.nativeAudio.preloadSimple('moteur', 'assets/audio/Moteur.mp3').then((success)=>{ console.log("success"); },(error)=>{ console.log(error); }); }); this.platform.ready().then(() => { this.nativeAudio.preloadSimple('demarreur', 'assets/audio/Demarreur.mp3').then((success)=>{ console.log("success"); },(error)=>{ console.log(error); }); }); } ionViewDidLoad() { console.log('ionViewDidLoad SonsPage'); this.viewCtrl.setBackButtonText('Retour'); } cligno(){ this.nativeAudio.play('cligno').then((success)=>{ console.log("success playing"); },(error)=>{ console.log(error); }); } klax(){ this.nativeAudio.play('klax').then((success)=>{ console.log("success playing"); },(error)=>{ console.log(error); }); } moteur(){ this.nativeAudio.play('moteur').then((success)=>{ console.log("success playing"); },(error)=>{ console.log(error); }); } demarreur(){ this.nativeAudio.play('demarreur').then((success)=>{ console.log("success playing"); },(error)=>{ console.log(error); }); } }But I only hear the sound when the ring button on my iPhone is ON, or when the android phone is in “ring loud” mode.
How can I hear the sound even in silent mode (I call the sound functions with a click in my html page)
Thanks !
Posts: 1
Participants: 1
