That quite simple piece of code, I just need to play sound once on some action.
Here is it:
function playSound() {
$ionicPlatform.ready(function () {
$cordovaNativeAudio.preloadSimple(‘timeout’, ‘audio/timeout.mp3’)
.then(function (msg) { console.log(msg); })
.catch(function (error) { console.error(error); });
});
$cordovaNativeAudio.play('timeout')
.then(function (msg) { console.log(msg); })
.catch(function (error) { console.error(error); });
}
Unforunately I got error: missing exec: NativeAudio.play.
How should I fix this?
P.S. Sorry, but I can’t get how your code editor works.