-1

Possible Duplicate:
access files from assets/www directory

I'm writing android app using phonegap and want to play mp3 on click in the button, my mp3 is located in the www folder. Unfortunately I tried to use "android_asset/ww/sample.mp3" as a src for new Media(src, Succ, Err); and file is not played. Is that path correct ? I'm using Cordova 2.0.0 and Eclipse.

Community
  • 1
  • 1
Conrad
  • 121
  • 12
  • See the answer posted here - http://stackoverflow.com/questions/11559763/phonegap-unable-to-play-local-sound-file/11563390#11563390 – codemonkey Aug 28 '12 at 13:41

2 Answers2

1

use :

window.resolveLocalFileSystemURI("file:///android_asset/www/foo.html", onResolveSuccess, onFail);
Duke
  • 1,731
  • 2
  • 17
  • 33
  • I've no idea how to use it, trying to run example from http://docs.phonegap.com/en/2.0.0/cordova_file_file.md.html#LocalFileSystem , but only thing I get is the fileSystem.name is persistent. I use "file:///android_asset/www/sample.mp3" , any idea ? – Conrad Aug 28 '12 at 08:34
0

I've sorted this out, looks like from cordova version 2.0.0 there is some bug that doesn't allow to play local files (remote works fine). I took a step back and used cordova-1.9.0 and it works fine with path "/android_asset/www/sample.mp3"

Conrad
  • 121
  • 12