B4A Library CameraKit

This is a wrap for this Github project.

CameraKit helps you add reliable camera to your app quickly. Our open source camera platform provides consistent capture results, service that scales, and endless camera possibilities.

With CameraKit you are able to effortlessly do the following:

  • Image and video capture seamlessly working with the same preview session.
  • Automatic system permission handling.
  • Automatic preview scaling.
    • Create a CameraView of any size (not just presets!).
    • Automatic output cropping to match your CameraView bounds.
  • Multiple capture methods.
    • METHOD_STANDARD: an image captured normally using the camera APIs.
    • METHOD_STILL: a freeze frame of the CameraView preview (similar to SnapChat and Instagram) for devices with slower cameras.
    • METHOD_SPEED: automatic capture method determination based on measured speed.
  • Built-in continuous focus.
  • Built-in tap to focus.
  • Built-in pinch to zoom. Even while recoding a Video.

CameraKit
<link>...|https://www.b4x.com</link>
Author: DonManfred
Version: 0.52
  • CameraKit
    • Events:
      • onError (error As String)
      • onEvent (event As String)
      • onImage (image() As Byte)
      • onTextDetect (detectedText As String)
      • onVideo (video As String)
    • Functions:
      • addController (controller As com.wonderkiln.camerakit.CameraKitController)
      • bindCameraKitListener (object As Object)
      • BringToFront
      • captureImage
      • captureImage2
      • captureVideo (path As String, filename As String)
        Starts capturing a Video. The Video is saved
        to the given path using the given filename
        The duration is set to endless. You need to stop
        the capture using stopVideo().
      • captureVideo2 (path As String, filename As String, maxDuration As Int)
        Starts capturing a Video. The Video is saved
        to the given path using the given filename
        The maximum duration is set to maxDuration seconds.
      • DesignerCreateView (base As Panel, lw As Label, props As Map)
      • Initialize (EventName As String)
      • Invalidate
      • Invalidate2 (arg0 As android.graphics.Rect)
      • Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
      • isFacingBack As Boolean
      • isFacingFront As Boolean
      • IsInitialized As Boolean
      • isStarted As Boolean
      • RemoveView
      • RequestFocus As Boolean
      • SendToBack
      • SetBackgroundImage (arg0 As android.graphics.Bitmap) As BitmapDrawable
      • SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
      • SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
      • SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
      • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
      • start
      • stop
      • stopVideo
      • toggleFacing As Int
      • toggleFlash As Int
    • Properties:
      • Background As android.graphics.drawable.Drawable
      • CameraProperties As com.wonderkiln.camerakit.CameraProperties [read only]
      • CaptureSize As com.wonderkiln.camerakit.Size [read only]
      • Color As Int [write only]
      • CropOutput As Boolean [write only]
      • Enabled As Boolean
      • Facing As Int
      • Flash As Int
        0 = FLASH_OFF,
        1 = FLASH_ON,
        2 = FLASH_AUTO,
        3 = FLASH_TORCH
      • Focus As Int [write only]
        0 = FOCUS_CONTINUOUS,
        1 = FOCUS_TAP,
        2 = FOCUS_OFF,
        3 = FOCUS_TAP_WITH_MARKER
      • Height As Int
      • JpegQuality As Int [write only]
      • Left As Int
      • LockVideoAspectRatio As Boolean [write only]
      • Method As Int [write only]
        0 = METHOD_STANDARD, 1 = METHOD_STILL
      • Padding As Int()
      • Parent As Object [read only]
      • PinchToZoom As Boolean [write only]
      • PreviewSize As com.wonderkiln.camerakit.Size [read only]
      • Tag As Object
      • Top As Int
      • VideoBitRate As Int [write only]
      • VideoQuality As Int [write only]
        0 = VIDEO_QUALITY_QVGA, 1 = VIDEO_QUALITY_480P,
        2 = VIDEO_QUALITY_720P, 3 = VIDEO_QUALITY_1080P,
        4 = VIDEO_QUALITY_2160P,5 = VIDEO_QUALITY_HIGHEST,
        6 = VIDEO_QUALITY_LOWEST
      • Visible As Boolean
      • Width As Int
      • Zoom As Float [write only]

Known issues:
It depends on Google Playservice Vision but the Textrecognition seems to freeze the app. So for now i´ve removed the ability to activate it but the reference must still be there.


Setup:

Download
CameraKit1.zip and rename it to CameraKit.zip.001
CameraKit2.zip and rename it to CameraKit.zip.002

Extract it with 7Zip.
 

Attachments

  • CameraKit1.zip
    500 KB · Views: 909
  • CameraKit2.zip
    422.2 KB · Views: 962
  • CameraExample.zip
    10.8 KB · Views: 885

Peter Simpson

Expert
Licensed User
Longtime User
I'm going to have a play with this library later on today, cheers Don :cool:
 

johndb

Active Member
Licensed User
Longtime User
Thank you very much for this library @DonManfred. I'd like to test it but am having difficulty unzipping your split zip using 7zip. Any chance of you uploading a standard zip (one archive) with all the library files? Thanks.
 

JanG

Member
Licensed User
Longtime User
Thanks!

Compiling: OK
Installation: OK
Running: Crash while starting. No GUI. Nothing. Just crash...

Device: Samsung A40, Android 9

Any ideas?
 

DonManfred

Expert
Licensed User
Longtime User
Any ideas?
- You should always create a new thread in the questionsforum for any issue you have.
- You need to provide more informations in that thread. Post the full error. There is no such thing in android like Crash while starting. No GUI. Nothing. There is always a error in the Log. Maybe you need to check the unfiltered log but the error must be there.
 

DonManfred

Expert
Licensed User
Longtime User
1. You should always create a NEW thread in the Questionsforum for any Issue/Question you have. Posting to existing threads is a mistake.
2. Widgets are limited in B4A. CameraKit can not be used in a Widget. It needs an Activitycontext as it accesses the device Camera.
 

Javier Garrido

Member
Licensed User
Is it possible to add a label or an imageview to the camerakit panel so that it appears in the photograph or in the video? thanks
 

Nkalampika

Active Member
Licensed User
hello i get an error
Landroid/support/v4/util/SparseArrayCompat;
 

Nkalampika

Active Member
Licensed User
I had already done it. i have all jetify but .. still have the same problem
 

Nkalampika

Active Member
Licensed User
Please help me ..
if there is also another camera with the functions i want ... i will use it
 

Nkalampika

Active Member
Licensed User
thank you erel
I want a camera with the functions:
- change the dimensions of the video
-the quality
- the bitrate .. :)
 
Top