Create a simple player by using cordova media plugin


I’m trying to create an app just for listening audio files. So I need to set up a very simple audio player that plays, gets pause and stops.

I’m a really beginner for using « Ionic », but I already know how to build with html/css. For days, I try to find a solution by reading the forum and testing my app on my device. But it still doesn’t work.

I’ve already tested by using « cordova native audio plugin » - I’ve followed a very good tuto here
It works fine but, it seems not possible to get pause ; the player may just play and stop… so, I began to use « cordova media plugin » ; it’s really a nightmare. I finally don’t know how to build the js file, even with doc from Cordova.
Thanks a lot for your help ! :relaxed:
Below copies of my app.js and index.html files.

angular.module(‘test’, [‘ionic’])

.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
if(window.cordova && window.cordova.plugins.Keyboard) {

if(window.StatusBar) {


.controller(‘AudioCtrl’, function($scope, $ionicPlatform) {

var src = "/audio/muzik1.mp3";
var media = $cordovaMedia.newMedia(src);

$ = function(src) {;


$scope.pause = function() {

$scope.stop = function() {


<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">

<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/" rel="stylesheet">

<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>

<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>

<!-- your app's js -->
<script src="js/app.js"></script>


 <button ng-click="play('muzik1.mp3')">Lecture</button>
 <button ng-click="pause()">Pause</button>
 <button ng-click="stop()">Stop</button>