@Nasihu wrote:
why audio is not working ?
here is my code for home.html
<h3> Real time data graphes</h3> </div> <ion-toolbar > <button ion-button (click)="play()"> Play </button> </ion-toolbar> </ion-slide>
code for home.ts
…
import { Component } from ‘@angular/core’;
import { NavController } from ‘ionic-angular’;
import { FirstPage } from ‘…/first/first’;
import { NativeAudio } from ‘@ionic-native/native-audio’;@Component({
selector: ‘page-home’,
templateUrl: ‘home.html’
})
export class HomePage {onSuccess : any;
onError : any;constructor(public navCtrl: NavController, private nativeAudio : NativeAudio) {
}
play()
{
this.nativeAudio.preloadSimple(‘1’, ‘./assets/sound/manma.mp3’).then(()=>{console.log(‘Playing’)});
this.nativeAudio.play(‘1’).then(()=>{console.log(‘Playing’)});}
Posts: 2
Participants: 2