0

I am using Phonegap 2.8. I have copied and pasted their example for the play method in to a page and deployed it to my Nexus S running Android 4.1.2. I have checked, and double checked my config.xml and the androidmanifest.xml. The only lines not present in my androidmanifest.xml are

<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Before I click the play button, and after the deviceready event, I get an error:

08-20 13:06:13.574: MediaPlayer(878): Error (1,-1004)

What am I missing?

update: I have created a brand new PhoneGap 2.9 android project and have copy/pasted the play example from the link above and it still gives the same error. Also, it seems the OnSuccess and OnError methods do not get fired.

update 2 Using the emulator, this example works fine, so it seems it maybe my phone? What settings could cause that?

Mike_G
  • 16,237
  • 14
  • 70
  • 101
  • What file format are you playing? – ashes999 Aug 20 '13 at 18:13
  • Its an exact copy/paste of their example in the link above, so its MP3 – Mike_G Aug 20 '13 at 18:14
  • Try ogg. My hoary old Android 1.5 phone couldn't play MP3s for some reason. – ashes999 Aug 20 '13 at 18:47
  • Well... my mighty Google skills tell me that this MediaPlayer error code translates into English as I/O error. Since your audio source is on the web there may be three possible reasons: 1. that resource does not exist or is not accessible; 2. Your app does not declare the INTERNET permission; 3. Your Android device / emulator does not have an Internet connection.. Well I tried to open that URL and it seems to redirect to localhost. Just replace that URL with an existing and accessible MP3 – tiguchi Aug 20 '13 at 19:37
  • @NobuGames 1. I am using the url in the phonegap example, and it exists. 2. It does have the INTERNET permission. 3. It does have a connection, able to browse sites fine. – Mike_G Aug 20 '13 at 19:50
  • @Mike_G When I try to download that URL with "wget" I get a "302 Moved Temporarily" HTTP status header that redirects to localhost. So the MP3 cannot be downloaded from my end here. It's maybe the same problem with your Android device / emulator. Can you access that URL from the internet browser app? – tiguchi Aug 20 '13 at 19:58
  • That is not the URL provided in the PhoneGap example, and is only supplied to show that when I use the Audio html tag, pointed at a different MP3, the same error occurs. I will delete as to not cause confusion. – Mike_G Aug 20 '13 at 20:04
  • @NobuGames and what did you search terms did you use in order to find the meaning of the error? – Mike_G Aug 20 '13 at 20:15
  • My search phrase was: MediaPlayer "Error(1, -1004)" (note the quotation marks, they are important here, otherwise you won't get any good results). To cut it short, I found the interpretation of that error code from here: http://stackoverflow.com/questions/16672568/mediaplayer-error-1-1004-aka-media-error-io-trying-to-stream-music-on-samsun I looked again at it and it may be incorrect. Try and find the (native) source of MediaPlayer with its error constant definitions. There could be some "define" name that clarifies the error code. – tiguchi Aug 20 '13 at 20:27

0 Answers0