I'm new to Ionic and Cordova, so I'm sure I'm missing something basic, but my problem is a packaged APK does not play sounds on an Android device. I can get the sound to play in the Ripple emulator just fine with the following code:
.controller('MainCtrl', ['$scope', function ($scope) {
$scope.playStartBell = function () {
var media = new Media('media/startBell.mp3', function () {
console.log('good');
}, function (err) {
console.log('bad: ', err);
});
media.play();
},
$scope.playStopBell = function () {
var media = new Media('media/stopBell.mp3', function () {
console.log('good');
}, function (err) {
console.log('bad: ', err);
});
media.play();
}
}])
I've used Cordova to install the media plugin: $cordova plugin add org.apache.cordova.media
According to this SO post, a value needs to be added to the config.xml, but I'm not sure how to do it properly for Ionic/Cordova.