blaster
blaster

Reputation: 8937

What .js Do I Need to Include to Access Cordova's Media object?

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.

Upvotes: 1

Views: 110

Answers (2)

Dick van den Brink
Dick van den Brink

Reputation: 14509

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

Upvotes: 0

Rob Lauer
Rob Lauer

Reputation: 3171

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

Upvotes: 1

Related Questions