According to this post on the Ionic forum, you need to add '/ android_asset / www /' to the path of your Android media file.
So your code will look like this:
$scope.media = new Media( '/android_asset/www/'+'100bpm.wav', function() { console.log("[mediaSuccess]"); }, function(err) { console.log("[mediaError]", err); }, function(status) { console.log("[mediaStatus]", status); });
In my trial version, I used the (scope) property of the $ scope controller to store the media object, and I also added successHandler, errorHandler, statusHandler
NB: note that the Media class (function) is already available when you create it using new media() in SoundCtrl. It seems to me that SoundCtrl will be created before onDeviceReady (that is, when cordova.plugin.media will be available), so I added the new Media(...) function to $scope.soundPlayer() .
source share