Unable to create surface instance and open camera using library https://github.com/Glamdring/EasyCamera


Hi, Iam trying to create a plugin using library https://github.com/Glamdring/EasyCamera. which has usage mentioned as below:

EasyCamera camera = DefaultEasyCamera.open();
CameraActions actions = camera.startPreview(surface);
PictureCallback callback = new PictureCallback() {
public void onPictureTaken(byte[] data, CameraActions actions) {
// store picture

When i convert the first line of code to net.bozho.easycamera.DefaultEasyCamera.open(1);
gives result
Can anyone suggest me how to make use of the result and open the camera and if camera.startPreview(surface); will actually display the camera, then how to create the surface instance and pass it to startPreview method?


Hey @Manasa

Did you follow through all the steps? What have you tried so far? From what I can tell by just looking at the plugin, it should be pretty straightforward to write the code sample in JavaScript.


Hi Pete.K,

I created a plugin in nativescript and added the library Easycamera into it. Converted code added in Js file is

var camera;
camera = net.bozho.easycamera.DefaultEasyCamera.open();
console.log("camera: " + camera);
var actions = camera.startPreview(new android.graphics.SurfaceTexture(android.opengl.GLES20.GL_ACTIVE_ATTRIBUTES));
console.log("actions: " + actions);

When this code is executed, camera is not opened but i can see the console values as
camera: net.bozho.easycamera.DefaultEasyCamera@7b78969
actions: net.bozho.easycamera.DefaultCameraActions@cf66b1c