Audio not playing on ios but plays in Android

I am using the cordova media plugin to play the locally downloaded audio files. The audio runs fine on android but on IOS simulator I get the following error.

"Cannot use audio file from resource 'file:///Users/nancy/Library/Developer/CoreSimulator/Devices/75488CF8-0356-4514-B245-334FEB9B005F/data/Containers/Data/Application/4AA1A634-76B7-4EBB-B636-40694DE6429D/Documents/myApp/audioFile.mp3'"

Also if I go to this location the file is present there.
I am on cordova version 3.7 for IOS,

To get the local system root file path I have tried following

window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSystem) {
    fileSystem.root.getDirectory("myApp", {
        create: !0
    }, function(dir) {
        rootPath = dir.toURL(); // also tried toNativeUrl(), toInternalUrl()
    }, function(err) {

}, function(error) {

Once I find the rootPath I can download the file using the following code

var fileTransfer = new FileTransfer;
var filepath = rootPath + "audioFile.mp3";
var options = {};, filepath, function(result) {
    src= result.toURL(); // which is used as src for playing with cordova media api

}, function(err) {
    // whatever

No error is reported during the whole process, but when I play its only then I get this error

var media = new Media(src, success, fail); // in the fail callback the above mentioned error is captured.
1 Like