Habib
Habib

Reputation: 11

Can't play audio file using code from Phonegap example, says "Media is not defined". What to do?

I'm new to phonegap and wanted to ask you some question. I successfully built a local app using node.js and the console. What I want to do is to play an audio file from an url. Problem is it's not working! I've used the example from the phonegap site: http://docs.phonegap.com/en/3.3.0/cordova_media_media.md.html

Permissions and feature for the plugin (config.xml) are already in the code. I just can't get the audio playing. All I get is "Media is not defined". It's frustating, but I thought maybe you guys could help me.

Upvotes: 0

Views: 335

Answers (1)

QuickFix
QuickFix

Reputation: 11721

If you're building locally, adding plugin is not done in config.xml but by running the command :

phonegap local plugin add org.apache.cordova.media

(configuring plugins in config.xml is only if you want to use the phonegap build service on build.phonegap.com)

The error "media is not defined" really sounds like the plugin is not added.

Upvotes: 1

Related Questions