Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70434

Ionic 3 Native Audio Not Working After On DB Meter

$
0
0

@leongofcom wrote:

I have a problem playing audio with native audio after trigger the db meter. The code work fine on android but not on ios. The audio can play and can set volume but after trigger the get db meter, the audio cannot play anymore and have to restart the app, the volume button also cannot be control.

Load media after platform ready

this.nativeAudio.preloadComplex('noise', 'assets/audio/noise.mp4',1, 1,0).then(() => { 
    }, (err) => {
      alert('LOAD NOISE ERROR');
    });  

Play Sound

this.nativeAudio.loop('noise').then((res) => {
    }, (err) => {
      alert('PLAY ERROR');
    });

Use DB METER

let totaldb = [];
this.interval = setInterval(()=>{
  this.subscription = this.dbMeter.start().subscribe((data) => {
    this.db = data;
    if(data>0){
      totaldb.push(data);
    }
  });

  if(totaldb.length>5){
    this.loading.dismiss();

    clearInterval(this.interval);
    this.subscription.unsubscribe();
    this.dbMeter.delete().then(() => {
    }, (error) => {
      alert('STOP DB ERROR');
    });

    this.db = 0;
    for(let a = 0;a<totaldb.length;a++){
      this.db = this.db + totaldb[a];
    }
  
    this.db = this.db/totaldb.length;
    this.db = this.db.toFixed(1);
  }
}, 1000);

Ionic Info
Ionic:
ionic (Ionic CLI) : 4.12.0
Ionic Framework : ionic-angular 3.9.9
@ionic/app-scripts : 3.2.4

Cordova:
cordova (Cordova CLI) : not installed
Cordova Platforms : android 8.1.0, browser 6.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 8 other plugins)

Any solution on this?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70434

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>