0
votes

I need to load an mp3 on iOS from the www folder next to my HTML. I'm using phonegap and my code is basically the same as the example from : http://docs.phonegap.com/en/2.0.0/cordova_media_media.md.html

Its working on iOS and android when I use an mp3 from the web but if I try to load one from the www then I am getting a window saying I can't use the ressource (on ios).

I added this in my config.xml :

<feature name="http://api.phonegap.com/1.0/device" />
<feature name="http://api.phonegap.com/1.0/file" />
<feature name="http://api.phonegap.com/1.0/media" />
<gap:plugin name="org.apache.cordova.media" />

I am testing with the phonegap app for ios (http://app.phonegap.com/) from my phonegap server on windows and debuging with wienre. The rest of the app is working just the sound doesn't start.

I tried several different path :

"mySound.mp3"
"file://mySound.mp3"
"file:///mySound.mp3"

I also tried changing to an older phonegap version with no more luck.

Looking at the doc (same page as before) i should be able to just use the name of my file :

order of file search: When only a file name or simple path is provided, iOS searches in the www directory for the file, then in the application's documents/tmp directory:

var myMedia = new Media("audio/beer.mp3") myMedia.play() // first looks for file in www/audio/beer.mp3 then in /documents/tmp/audio/beer.mp3

I spent hours looking on internet and testing and i can't get that sound to start :/

Help would be much appreciated!

2

2 Answers

0
votes

From what I know, iOS works with .wav file type. Maybe you should change your file type from .mp3 to .wav. Add the following to your config.xml

<plugin name="Media" value="CDVSound" />
0
votes

iOS plays mp3 files. He only records in wav.