Cannot read property ‘capture’ of undefined – cordova plugin media capture


I’m trying to use the cordova plugin Media Capture to register video with my mobile application, but I can’t do what I would like because of this error : « Cannot read property ‘capture’ of undefined ».

I created a module with extensibility configuration :




"url": ""



In that module, I created a public client action with this code :

This client action is used in my application (another), when the user activate a button.

Does anyone know what’s my mistake, and what do I have to do to fix this issue ?

Thanks for your help.


What is your target OS?  Android or iOS?

To test this I created a plugin as well.  There's been a horrible dependency mess in the cordova plugin world recently, so I'm using the last working, no issues that I know of, plugin version.

        "url": ""

Here's my plugin Javascript code.  Note the $resolve() - I believe that's required.

I'm not sure about this part... but... in the plugin I have included the dependency Common Plugin.

In my Test App I have dependencies: Common Plugin, File Plugin, Media Capture Plugin (that's mine), Silk UI Mobile.

It works without error.  I tap my button and the camera starts and I can record a video.  When I stop, that video is in the file system.  I've only tested on Android.


Hi David,

Thank you for your answer, it worked for me.

I have exactly same issue. Did what is described above, so I used and also applied the $resolve().

But no luck.

Anyone a clue?

Here's my app OML and the plugin wrapper OML I used.  I just re-published both and then re-generated the Android app... re-installed... and tested again.  All good.

Here's the media plugin wrapper OML I created...

Sorry David, no luck. Both error on my mobile and when simulating in the browser. Also your test went wrong. Probably something with my hardware then. I will try again after a full reboot.

I tried to upload a screendump here, but then went wrong also.

Simulating in the browser ???  If I understand what you're doing... you can't do that.  Plugins (usually) interact directly with Hardware... and in this case, definitely with the camera on the device.  The browser has no concept of your device camera.

Build the app and install on your device... and then give it a shot.

Also, properly written wrappers will always test to ensure PhoneGap/Cordovo is loaded and will issue an error and message if not.  Mine is just a test... so I didn't bother.  I'll add that in and re-post it so that you can see how it would then run in a browser.

I understand David. Of course I test the stuff directly with my mobile. But as said, that doesn't work either. The Forge contains two other VideoCapture plugins which I both tried. All these address the same I made sure it address the #1.4.3. as you proposed. But no luck. 

Fun thing is that I noticed by occasion the browser throw the same error. But that's no surprise.

Continue tomorrow.

Ow, my mobile is a Lenovo P2 running Android 7.0. But should not be an issue.

When in the world of Android... anything is possible I find.  I have tested on my Nexus 7 (2013) running Android 6 and on my Nexus 6P running Android 8... both ok.

Davidk wrote:

When in the world of Android... anything is possible I find.  I have tested on my Nexus 7 (2013) running Android 6 and on my Nexus 6P running Android 8... both ok.

Thanks for your effort David. I just build a new mobile app with only the screen you offered. Contains the correct dependencies (your test-plugin, common plugin having Cordova). Ran it in OutSystems Now on my phone.

No luck.

I guess it ends here. Hopefully OutSystems will deliver a solid solution soon.


You're not having any luck because I believe your method of testing is not valid.

You cannot use the OutSystems Now app because it does not contain that media plugin... and it must contain any plugin the app uses... regardless of what the app is including as a dependency.

Here is a list of the OutSystems Now plugins...

Open and publish the media plugin I included in this thread.  Then open the app I included and confirm the media plugin dependency.  Then build your own Android app and install that.

Hi all,

I've downloaded both modules (MediaCapturePlugin and MediaCaptureTest). Then I've compiled them (replacing 1.4.3 version with the current one (3.0.2) and created the target application (apk). But when I click the "Video Capture" button I get exactly the same message as in the original post: Cannot read property 'capture' of undefined. It seems that in the sequence: navigator.device.capture, the navigator object has been created but the device object - not. Should I add some logic to do it (what one?)? Some additional configuration? Something else?

Platform version is 10.0.816.0. Android version is 7.1.1.