Nyxynyx
Nyxynyx

Reputation: 63687

Implement Camera in Custom page in Cordova iOS

In Cordova and Meteor.js, is it possible to implement the Camera function into our own custom page, getting it to look similar to the following in iOS:

enter image description here

Upvotes: 1

Views: 1060

Answers (1)

Ekta Jayswal
Ekta Jayswal

Reputation: 253

I don't know about Meteor.js but I can tell you about cordova-plugins.

Yes you can do it by using mbppower/CordovaCameraPreview plugin that allows camera interaction from HTML code. To create your custom camera what you should do is, start camera on your HTML page. You have to draw rectangle for "Camera Preview Box" with required height-width dimensions and starting point(x,y) as parameters in below code snippet.You can also make it Tap enabled and Drag-able.

cordova.plugins.camerapreview.startCamera({x: 100, y: 100, width: 200, height:200}, "front", tapEnabled, dragEnabled, toBack);

Now its on your HTML page only, so you can add Capture button, Browse picture button, Flash or anything you want. It will be like your custom camera only. A big thanks to its author, he has done a great job.. Added more stuff: you can also use donaldp24/CanvasCameraPlugin Plugin for your application, its supported in both android and iOS. For iOS its working, but in android isn't working properly for me.

UPDATE:10th Oct 2017 It used to work well during that time but, donaldp24/CanvasCamera is no longer maintained and currently fails build with the latest Cordova version.

Upvotes: 3

Related Questions