// Ionic Starter App
// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
// 'starter.services' is found in services.js
// 'starter.controllers' is found in controllers.js
angular.module('starter', ['ionic', 'starter.controllers', 'starter.services', 'ngCordova'])
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if(window.StatusBar) {
// org.apache.cordova.statusbar required
StatusBar.styleDefault();
}
$cordovaNativeAudio
.preloadSimple('test', 'audio/loop.mp3')
.then(function (msg) {
console.log(msg);
}, function (error) {
console.error(error);
});
$cordovaNativeAudio.play('test');
});
})
Uncaught ReferenceError:
$cordovaNativeAudio is not defined app.js:21
(anonymous function) app.js:21
(anonymous function) ionic.bundle.js:37388
onPlatformReady ionic.bundle.js:2241
onWindowLoad ionic.bundle.js:2220
TypeError: Cannot read property 'NativeAudio' of undefined
at Object.preloadSimple (http://127.0.0.1:8100/lib/ngCordova/dist/ng-cordova.min.js:8:28020)
at http://127.0.0.1:8100/controladores/ludofono.js:26:8
at http://127.0.0.1:8100/lib/ionic/js/ionic.bundle.js:44815:19
at Object.ionic.Platform.ready (http://127.0.0.1:8100/lib/ionic/js/ionic.bundle.js:2120:9)
at Object.IonicModule.constant.provider.$get.self.ready (http://127.0.0.1:8100/lib/ionic/js/ionic.bundle.js:44813:26)
at new <anonymous> (http://127.0.0.1:8100/controladores/ludofono.js:3:17)
at invoke (http://127.0.0.1:8100/lib/ionic/js/ionic.bundle.js:12884:17)
at Object.instantiate (http://127.0.0.1:8100/lib/ionic/js/ionic.bundle.js:12892:27)
at http://127.0.0.1:8100/lib/ionic/js/ionic.bundle.js:17161:28
at IonicModule.controller.self.appendViewElement (http://127.0.0.1:8100/lib/ionic/js/ionic.bundle.js:48253:24) <ion-nav-view class="view-container" nav-view-transition="ios">
Hey did any get this nativeaudio to work? I have tried it myself and keep running in the same problem. I looked around and haven’t had any luck Any help is appreciated