Giter Club home page Giter Club logo

Comments (4)

mbppower avatar mbppower commented on June 9, 2024

Hello,

Yes I'll make the black background transparent (You can change it too, if you see the layout xml file). For the dimension changing I think it depends on the aspect ratio of the provided dimension. Could you please send me your configuration and device OS version?
Thanks

from cordova-plugin-camera-preview.

bogomips avatar bogomips commented on June 9, 2024

Hi, actually it was pretty easy changing the alpha channel in camera_activity.xml :)
I'm also trying to understand what's going on about sizes and aspect ratio i mean,
what I noticed is that the live preview appears like zoomed and when I click to take the picture the aspect ratio changes (like squashed on vertical), the picture I get as file is not zoomed and I can see a bigger area than I can see during the (zoomed) preview.

I checked logcat and I found the supported resolutions:

D/CameraHal( 101): Support Preview sizes: 640x480,1280x720,960x544,800x448,640x360,424x240,352x288,320x240,800x600,176x144,160x120,1280x800
D/CameraHal( 101): Support Picture sizes: 640x480,1280x720,960x544,800x448,640x360,424x240,352x288,320x240,800x600,176x144,160x120,1280x800

So I tested using one of those resolutions, same issue.
With a vertical rect:
cordova.plugins.camerapreview.startCamera({x: 30, y: 32, width: 800, height:1280}, "front", tapEnabled, dragEnabled);

Even with an orizontal rect
cordova.plugins.camerapreview.startCamera({x: 30, y: 32, width: 1200, height:800}, "front", tapEnabled, dragEnabled);

I'd even like to add a countdown so i'm wondering if is possible add an html layer
over the preview surface.

I'm using Microsoft LifeCam HD-5000 as camera
Istick A200 with android 4.1.1 onboard
orientation vertical (portrait)

Thanks

from cordova-plugin-camera-preview.

bogomips avatar bogomips commented on June 9, 2024

Hi,
about the issue that i described above is probably related to non squared frame sizes.
I setted (in the js) 1080x1600 as surface, the following lines make it a square of 1600x1600 and that square is just what i get while i take the picture (this is why it become larger)
unfortunately I didn't have time to go deeper in the issue.

int size = Math.max(frameContainerLayout.getHeight(), frameContainerLayout.getWidth());
FrameLayout.LayoutParams camViewLayout = new FrameLayout.LayoutParams(size, size);

About the countdown I had to hardcode something in a not elegant way just to delivery in time my project.
Anyway i think would be quite easy to integrate this function in a better and customizable way from js.
So I write down the lines of code i wrote to do it, maybe can make the implementation faster:

Inside the relativeLayout i had this xml

In cameraActivity.java

import android.widget.TextView;
import android.os.CountDownTimer;

I modified the mothod takePicture()

final TextView vistaTesto = (TextView) view.findViewById(getResources().getIdentifier("countnum", "id", appResourcesPackage));

new CountDownTimer(6000, 1000)  {
    private int count=5;
    public void onTick(long millisUntilFinished) {
            if (count==1) {
                vistaTesto.setText(count + " :-)");
            }
            else {                                                                                         
                vistaTesto.setText("" + count);
            }
            count--;
        }

        public void onFinish() {            

            vistaTesto.setText("");
                     public void onPreviewFrame(final byte[] data, final Camera camera) { 
                          [...]

    }
        }.start();   

Thanks

from cordova-plugin-camera-preview.

mbppower avatar mbppower commented on June 9, 2024

Hi.. now it's possible to add the preview at the back of the webview. Please see the last release.
I think that there are more issues with the frame aspect ratio on Android, unfortunately I haven't had much time to spend on this project yet.

from cordova-plugin-camera-preview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.