Comments (4)
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.
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.
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.
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)
- Get color of touched pixel from camera preview HOT 1
- takeSnapshot return blank image HOT 1
- camera is taking entire screen height and flip and close,capture buttons are not visible in native device,Please let me know if anyone has solution for this,z index is already given same as in the code HOT 2
- is platform windows supported ? HOT 3
- is platform browser supported ? HOT 1
- error building with xcode 13.4.1 HOT 6
- How to add barcode scanning ability using another plugin?
- takePicture error only on Android 9
- How to disallow Screenshot
- Android Studio forces me to set android:exported="true" in AndroidManifest.xml HOT 1
- Image is saved as Base64 regardless of storeToFile setting
- Illegal Access HOT 1
- This plugin doesn't seem to install in Android 13, API 33 HOT 2
- takePicture does not resolve promise on iPhone 15 Pro HOT 4
- AVCaptureStillImageOutput' is deprecated: first deprecated in iOS 10.0 - Use AVCapturePhotoOutput instead.
- iPhone 13 Pro Max autofocus issue on close objects HOT 3
- Documentation wrong for takeSnapshot and takePicture
- Can not perform this action after onSaveInstanceState
- photos Android clearer
- how do i ? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cordova-plugin-camera-preview.