Great!
I am no rush.
Thank you so much.
Quick Update of ProCamBase64 to version 2
Note, this version is built with FAST instead of RUSH, so it will not update the previous extension, you will need to delete the previous extension, and then install the latest version (2).
uk.co.metricrat.procambase64.aix (27.8 KB)
The only change is the addition of the maxImgLength to the preview image, allowing you to set a resize width/height. I got success going up to 1280.
Blocks I used
An example:
The containing arrangement was set to 320x180
The number of characters returned for an image taken with maxImgLength set to 0 (no resize) = 430,000
Setting the maxImgLength to 160 returned an image with 19,900 characters
Great.
I'll test it.
here is the testing:
- the block shown that when call ProCamBase64.TakeCameraImageToBase64 by BLE, phone works take picture and convert to base64 and sending but broken on half way;
if call ProCamBase64.TakeCameraImageToBase64 set maxImgLength = 120, got APP crashed,
- the maxImgLength reduce OK by button for testing; in my code's Button3 got runtime error: Not coonected to a Bluetooth...; don't know why?
can be the ProCamBase64.AfterToBase64 got difference result for:
ProCamBase64.TakeCameraImageToBase64
and:
ProCamBase64.TakeCameraImageToBase64 set maxImgLength = 120 ?
BTW. I'm using Android 14, the permission request got difference from Android 5? thanks.
Your issue is not with procam, it is what you are doing after you capture an image. Do some work on that . Break your approach down into steps, test each step, until you find where the problem is. This is much easier than trying to resolve an issue by running the whole thing at once.
Thanks for the suggestion.
I've done all steps till got: APP be trigged to take screenshot and resized and encoded and sent to ESP32 works well.
this step now is let APP to take picture by camera and then to do the same thing, tested only: ProCamBase64.TakeCameraImageToBase64 doesn't crash the APP, but crashed on the halfway sending, thats why I think the reason is the string too big (actually it is too big), its why I am looking a solution to reduce the string, the ProCamBase64.TakeCameraImageToBase64 maxImgLength setting is a good solution tested by manually, but got APP crashed as long as it take picture.
its the all story.
I guess the core of:
ProCamBase64.TakeCameraImageToBase64 and
ProCamBase64.TakeCameraImageToBase64 maxImgLength set
may be some difference?
thanks.
All I did was add the resize function for the Preview Picture. No other changes made. If maxImglength is set to 0 then the behaviour is as the previous version.
are you trying to do too many things at once here ?
Thanks.
please see the attached, nothing more, just disable one and enable another to do the thesting.
tested set maxImglength to 0 , no changes.
For the preview picture only - using 0...
Thanks.
I'll test it.
one thing is the new procambase64 can't auto updated, what I did is deleted the old one and redo the new one.
also, the new extension got two:
ProCamBase64.TakeCameraImageToBase64 maxImgLength set
and missed:
ProCamBase64.TakeCameraImageToBase64 ?
Correct, the new one is built with FAST, the previous one was built with RUSH, I will update my post.
Do you mean that the original TakePicture and TakePreviewPicture do not have maxImgLength ?
I didn't change it because you wanted to resize the base64...
I may consider adding it at some point.
I mean you have two version of:
the old one:
ProCamBase64
and the updated one:
procambase64,
the second one can't update the old one.
thanks.
Yes, I answered that above...
Hi there, I have a question. Is this Camera extension using Camera1 Api or Camera2 Api.
It uses api2
From the sources
import android.hardware.camera2.CameraAccessException;
import android.hardware.camera2.CameraCaptureSession;
import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.CameraDevice;
import android.hardware.camera2.CameraManager;
import android.hardware.camera2.CaptureRequest;
import android.hardware.camera2.CaptureResult;
import android.hardware.camera2.TotalCaptureResult
Taifun
So it can't use CameraX because it only works for Android Studio Jetpack Compose?
What are you talking about?
You can use any extension for your App Inventor project, also this one
Taifun
No, I don't mean by that. I was asking when AI2 builds your app and converts it into an .apk. APKs should be Kotlin or Java. So AI2 converts your visual blocks into Java or Kotlin files and packages them into an APK?
Thanks