1

I'm using Icenium Mist, and the cordova.js it includes is pretty streamlined and small and I can't find the definition of the Media object I'm hoping to use.

blaster
  • 8,876
  • 11
  • 48
  • 77

2 Answers2

1

Go to the project properties in Mist and choose "plugins". Check the box to include the media plugin and you should be set.

Rob Lauer
  • 3,075
  • 1
  • 32
  • 44
0

Media object is provided in a plugin. You need to include this one: https://github.com/apache/cordova-plugin-media Not sure how to do it with Icenium Mist but with the command line tools it is: Cordova plugin add org.apache.cordova.media

See http://cordova.apache.org/docs/en/3.3.0/cordova_media_media.md.html#Media for more details. And here for http://docs.icenium.com/creating-your-project/using-plugins/working-with-plugins for more details about adding the plugin

Edit: If I read the docs for icenium correctly you need to do the following:

  1. In the Project Navigator, double-click Properties.
  2. In the Plugins tab, navigate to the Core Plugins section and expand it, if needed.
  3. Check or uncheck the plugins you need

Edit2:

Does it work when you execute it in the deviceready event like this:

document.addEventListener("deviceready", function() {
    var media = new Media(src, successcallback);
}, false);

of course changing the parameters to your need

Dick van den Brink
  • 13,690
  • 3
  • 32
  • 43
  • Hmm . . . if "Media" in core plug-ins is the same thing as the cordova-plugin-media on Github, it's already checked and turned on! – blaster Jan 19 '14 at 19:53
  • "Media is not defined" is the error I get when I try to use something like "var media = new Media(src, successCallback, etc)". This is in the Icenium Mist simulator. Would the Media object be available only when running on true iOS, perhaps? – blaster Jan 19 '14 at 20:01
  • Is you're code executed after device ready? See http://cordova.apache.org/docs/en/edge/cordova_events_events.md.html#deviceready – Dick van den Brink Jan 19 '14 at 21:50