cordova - Playing local file from www folder -


i'm attempting use media functions of phonegap 2.7.0 play file that's locally stored inside www folder. no matter or how reference file, can't make work.

(the app ios)

error: "cannot use audio file resource xxxx", error code 1

i've tried giving path this:

"media/rock.mp3" "www/media/rock.mp3" "file://var/mobile/applications/..../www/media/rock.mp3" "/var/mobile/applications/..../www/media/rock.mp3" 

they produce same error. playing file remotely http address works perfectly.

here's code:

function spilllyd_lokal() { var sti = window.location.pathname; sti = "file:/" + sti.replace('index.html', ''); var url = sti + "media/rock.mp3"; var my_media = new media(url,     function () {         alert("playaudio():audio success");     },     function (err) {         alert("playaudio():audio error: " + json.stringify(err));     } ); my_media.play(); 

}


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -