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

Native audio not working

$
0
0

@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

Read full topic


Viewing all articles
Browse latest Browse all 70764

Trending Articles



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