ngCordova Media plugin not working

I am building a simple media player using Ionic and the Soundcloud API. However, the media plugin doesn’t play anything and doesn’t even reach the .then part. This is my controller:

.controller('PlayerCtrl', function($scope, $cordovaMedia) {
$scope.cordovaPlay = function cordovaPlay(mediaUrl) {
	console.log("Play Button clicked");
	var src = mediaUrl + '?client_id=myclientid';
	var media = $cordovaMedia.newMedia(src).then(function() {
		// success
		console.log("Media successfully loaded");
	}, function() {
		// error
		console.log("Media load error");

I just call the function on a button using ng-click, passing the stream URL:

<button class="button button-icon icon ion-play" ng-click="cordovaPlay('{{favorite.stream_url}}');;" ng-hide="isPlaying">

When I try the app on my device (I am aware that Cordova plugins won’t work in the browser) and click the play button, nothing happens. He doesn’t even log “Media successfully loaded” or “Media load error” in the console…

I also tried wrapping the function in $ionicPlatform.ready but that doesn’t change anything. The ngCordova filed gets called before cordova.js in my index file (I read somewhere that this is important).

Can anyone see where the problem is?


Bumpity bump!
Any help would be appreciated!

Anyone find solution ?

Anyone find solution ?


Have you include this snippet in index.html

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

and this in app.js

angular.module(‘starter’, [‘ionic’,‘ngCordova’])

manage in fontion of your code.