I am new to phonegap/cordova. This is my first App. My target is Android 5.1 or better. I'm using Cordova CLI.
I am building an app which uses the cordova media plugin. I installed the plugin and although I see all the required files declarations in config.xml, the javascript gives an error 'ReferenceError: Media is not defined' when I create the Media object. The changes I have done are as follows.
1). Installed media plugin using cordova CLI cordova plugin add org.apache.cordova.media
2). In platforms\android\res\xml\config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.phonegap.HelloWorld" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">
<preference name="loglevel" value="DEBUG" />
<feature name="File">
<param name="android-package" value="org.apache.cordova.file.FileUtils" />
<param name="onload" value="true" />
</feature>
<feature name="Media">
<param name="android-package" value="org.apache.cordova.media.AudioHandler" />
</feature>
3). In platforms\android\AndroidManifest.xml
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
4). In index.html
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" media = "screen and (orientation: landscape)" href="css/index.css" type="text/css">
<link rel="stylesheet" media = "screen and (orientation: portrait )" href="css/index_portrait.css" type="text/css">
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript" src="cordova.js"></script>
5). In index.js, I create a media object on deviceready which gives the following error - ReferenceError: Media is not defined'
I checked the points mentioned in a previous post [Cordova plugins not working
[1]: Cordova plugins not working and the plugins are listed. Still javascript cannot use the plugin.
Am I missing something?
<feature>
. There is also no reason to look at you AndroidManifest.xml, unless you try a special configuration. As such, please read the next comment. – user3255670