NativeAudio not working on ionic 2 rc0


#1

Hello folks,

I’m in the middle of creating a Sound provider for button taps and background game music. In My Sound provider called sound.ts I’m using the “NativeAudio” plugin and have defined a function for preloading my sound data. But when I’m building my app with

ionic run android -c

I get the following Error message:

ngc: Error: Error at /home/sami/ionic_apps/LoddenThinks/.tmp/providers/sound/sound.ts:21:29: Property ‘preloadSimple’ does not exist on type ‘NativeAudio’.

sound.ts

import { Injectable } from '@angular/core';
import { NativeAudio } from 'ionic-native';
...
@Injectable()
export class Sound {

  constructor(
    public nativeAudio : NativeAudio
  ){}

  loadSounds(){
    return this.nativeAudio.preloadSimple('buttonTick', 'assets/sounds/button-tick.wav')
      .then(()=>{
        return Promise.resolve("loaded sounds successfully");
      })
      .catch(this.handleError);
  }
...

In my app.component.ts I’m firing the loadSounds() method of my Sound provider

app.component.ts

import ... //  Config/Sound/...
...

  constructor(
    public platform : Platform,
    public config   : Config,
    public sound    : Sound
  ){

    platform.ready().then(() => {

      // loading config & sounds
      config.loadDefault()
        .then(msg => {
          console.log(msg);
          return sound.loadSounds(); <----------(HERE)
        })
        .then(msg => {
          console.log(msg);
        })
        .catch(err => {
...

My app.module.ts injects the NativeAudio provider and my custom Sound provider.