Playing sound with Phonegap/Cordova

Let me save you a lot of time: The Cordova Media plugin ( does not work well on Android and Windows Phone 8, at least in the version released with Cordova 3.1 (and I don’t see any indication of a change in the latest release either).

On Android I assume media resources are not released by the plugin since after a few plays, the audio does not play anymore unless the application is restarted. On Windows Phone 8, the audio sort of plays, but causes the application to behave very strangely (unrelated Javascript callbacks are not invoked, probably due to threading issues and extremely sluggish behaviour in general)

What I did to play audio in a Cordova application was the following:

For Android, iPhone – use the following plugin:
cordova plugin add

For Windows Phone 8, create a static HTML5 audio tag, get a pointer to it from the DOM (e.g, by getElementById) and just use the ‘play’ method on the returned object whenever you want to play the audio.


  1. Hi,
    I’m building an cordova application on winphone 8.1 and get an issue with playing audio. I apply as you recommended below. I can play it on winphone8 but not on winphone8.1.
    I don’t why this issue happens. Could you please help me recheck and give me some suggestions to fix it!

    • I haven’t tested this in a while so I don’t have any suggestions yet, but have you tried the latest version of Cordova’s media player? It has been updated since this blog entry so maybe they fixed some things.

Leave a Reply

Your email address will not be published. Required fields are marked *