I’m trying to get an audio file to play from the web using Cordova. I create the new media object, and on this view when I try to change my volume (on my device), the media volume changes. This leads me to be that the media is playing. However, there isn’t any audio coming out despite the volume I set on my phone.
Here’s my controller…
.controller('PlayerCtrl', function($scope, $stateParams, $cordovaMedia, $ionicLoading, MixtapeService) {
var getPromise = MixtapeService.getTapesById(1400);
var iOSPlayOptions = {
playAudioWhenScreenIsLocked : true
}
getPromise.then(function(result){
console.log(result.data[0]);
$scope.tape = result.data[0];
var media = new Media('http://releases.flowplayer.org/data/fake_empire.mp3', function() {
media.play(iOSPlayOptions);
}, function () {
// error
});
});
$scope.play = function(src) {
media.play(iOSPlayOptions);
}
var mediaStatusCallback = function(status) {
if(status == 1) {
$ionicLoading.show({template: 'Loading...'});
} else {
$ionicLoading.hide();
}
}
})