driftyco/ng-cordova — pull request #428 by mawarnes (2014-11-10 13:21:29+00:00)
Title: Update media.js

first off great project, thanks for a superb effort.

it's taken me most of the weekend to get to the bottom of this, but after some reflection, would it be better to change the constructor to a non-promisey one, but only make certain functions....like getDuration promisey. The reasoning here is that the media callbacks need to fire every time the file is played to allow ui updates, for example the play button could change to a pause button. If you make the constructor promisey it will only fire these callbacks the first time the file is played.

therefore you might want to change the constructor to the following

newMedia: function (src,success,error,mediaStatus) {
var media = new Media(src,success,error,mediaStatus);
return media;
},

this also fixes issues with the play and stop functions not working because they are working on source and not source.media.