Ionic native 3 media plugin error("plugin not installed")


#1

main.js:1 ERROR Error: Uncaught (in promise): plugin_not_installed;
Uncaught (in promise): TypeError: this.media.create(…).play is not a function
TypeError: this.media.create(…).play is not a function;

even i have installed the plugin . it is asking to install the plugin.

what could the missing part from my side;

package
"@ionic-native/core": “3.6.1”,
"@ionic-native/media": “^3.6.1”,
"@ionic-native/splash-screen": “3.6.1”,
"@ionic-native/status-bar": “3.6.1”,
"@ionic/storage": “2.0.1”,


#2

followed the method but still showing install the plugin


#3

You both have the plugin and npm package installed with these commands?

ionic plugin add --save cordova-plugin-media
npm install --save @ionic-native/media


#4

yes i am following the same intsructions.
installed native core first and then native plugin package and then plugin install


#5

did you upgrade from another version? What does cordova plugin list output?


#6
 <plugin name="ionic-plugin-keyboard" spec="~2.2.1" />
    <plugin name="cordova-plugin-whitelist" spec="1.3.1" />
    <plugin name="cordova-plugin-console" spec="1.0.5" />
    <plugin name="cordova-plugin-statusbar" spec="2.2.2" />
    <plugin name="cordova-plugin-device" spec="1.1.4" />
    <plugin name="cordova-plugin-splashscreen" spec="~4.0.1" />
    <plugin name="cordova-plugin-music-controls" spec="~1.4.1" />

ordova CLI: 6.5.0
Ionic Framework Version: 3.1.1
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.7
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v7.7.1
Xcode version: Not installed


#7

Could you please run cordova plugin list from your terminal and paste the output over here?


#8

cordova plugin list
Output

cordova-plugin-compat 1.1.0 "Compat"
cordova-plugin-console 1.0.5 "Console"
cordova-plugin-device 1.1.4 "Device"
cordova-plugin-file 4.3.3 "File"
cordova-plugin-media 3.0.1 "Media"
cordova-plugin-music-controls 1.4.1 "MusicControls"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-statusbar 2.2.2 "StatusBar"
cordova-plugin-whitelist 1.3.1 "Whitelist"
ionic-plugin-keyboard 2.2.1 "Keyboard"

#9

one thing more i updated my cordova to 7 earlier but due to gradle problem i came back to cordova 6.5 and then i made new project .


#10

That’s rather odd. Where do you get that error? It has nothing to do with cordova, since I’m still using 6.5 and it works perfectly fine.


#11

after build when i run the apk in my mobile. it is giving following messages
and a white screen


main.js:10 Install the MusicControls plugin: 'ionic plugin add cordova-plugin-music-controls'
s @ main.js:10
main.js:10 Native: tried calling MusicControls.subscribe, but the MusicControls plugin is not installed.
s @ main.js:10
main.js:10 Install the MusicControls plugin: 'ionic plugin add cordova-plugin-music-controls'
s @ main.js:10
main.js:1 ERROR Error: Uncaught (in promise): plugin_not_installed


#12

Could you please reinstall the platform your testing on? Seems like the plugin isn’t added to the platform and I can’t easily figure out why. It shouldn’t be a problem to remove and readd the platform.


#13

This is a different plugin than in your first post: media is not the same as music control.


#14

i tried both plugins and reinstalled platform as well but same problem still


#15

whenever i install a plugin .it gives following message


npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

it’s all according to documentation. but still same problem . any out of box idea to do. remove or install anything


#16

If you want to use Ionic Native you have to install the Cordova plugin and the matching Ionic Native Plugin Wrapper at the same time.


#17

i am doing so. plugin and wrapper as well
ionic plugin add --save cordova-plugin-music-controls
npm install --save @ionic-native/music-controls


#18

First time you mention that, was also missing from your package.json you posted.

I would advice you to create a new, blank project and then just do these two commands and see if it works. It should.


#19

same problem in fresh project as well



main.js:10 Install the MusicControls plugin: 'ionic plugin add cordova-plugin-music-controls'
s @ main.js:10
main.js:10 Native: tried calling MusicControls.subscribe, but the MusicControls plugin is not installed.
s @ main.js:10
main.js:10 Install the MusicControls plugin: 'ionic plugin add cordova-plugin-music-controls'
s @ main.js:10
main.js:1 ERROR Error: Uncaught (in promise): plugin_not_installed
    at d (polyfills.js:3)
    at l (polyfills.js:3)
    at Object.reject (polyfills.js:3)
    at e._fireError (main.js:10)
    at e._failed (main.js:10)
    at main.js:10
    at t.invoke (polyfills.js:3)
    at Object.onInvoke (main.js:3)
    at t.invoke (polyfills.js:3)
    at n.run (polyfills.js:3)
    at polyfills.js:3
    at t.invokeTask (polyfills.js:3)
    at Object.onInvokeTask (main.js:3)
    at t.invokeTask (polyfills.js:3)
    at n.runTask (polyfills.js:3)

package json

@angular/forms”: “4.0.2”,
"@angular/http": “4.0.2”,
"@angular/platform-browser": “4.0.2”,
"@angular/platform-browser-dynamic": “4.0.2”,
"@ionic-native/core": “3.6.1”,
"@ionic-native/music-controls": “^3.6.1”,
"@ionic-native/splash-screen": “3.6.1”,
"@ionic-native/status-bar": “3.6.1”,

config.xml

 <plugin name="ionic-plugin-keyboard" spec="~2.2.1" />
    <plugin name="cordova-plugin-whitelist" spec="1.3.1" />
    <plugin name="cordova-plugin-console" spec="1.0.5" />
    <plugin name="cordova-plugin-statusbar" spec="2.2.2" />
    <plugin name="cordova-plugin-device" spec="1.1.4" />
    <plugin name="cordova-plugin-splashscreen" spec="~4.0.1" />
    <plugin name="cordova-plugin-music-controls" spec="~1.4.1" />

android json
"plugin_metadata": {
“cordova-plugin-console”: “1.0.5”,
“cordova-plugin-device”: “1.1.4”,
“cordova-plugin-music-controls”: “1.4.1”,
“cordova-plugin-splashscreen”: “4.0.3”,
“cordova-plugin-statusbar”: “2.2.2”,
“cordova-plugin-whitelist”: “1.3.1”,
“ionic-plugin-keyboard”: “2.2.1”
}


#20

How exactly did you create the project?
How exactly did you add the plugin(s)?
How exactly did you integrate it in the code?
How exactly are you running/building the project?
When and where exactly do you get the error you are posting?