iMedia library v1.10 includes a new type of object named LLCamera. LLCamera provides low level camera access, similar to B4A Camera library. If you just want to allow the user to take a picture then it will probably be better to use Camera instead of LLCamera.
LLCamera allows you to embed the preview video in your layout, adjust the camera settings and it also allows you to work with the preview frames.
The first step is to initialize the LLCamera object. You need to pass a Panel. The preview video will be displayed on this panel.
Note that you need to call LLCamera.Resize whenever the panel is resized or the orientation changes.
The next step is to call LLCamera.StartPreview. The preview video will start and now you can call TakePicture to take a picture.
Unlike in B4A, you do not need to call StartPreview again after a picture is taken.
There are several "presets" which you can choose from by setting the Preset property:
These presets will change the image quality and size.
The following properties can only be changed inside a configuration block: FlashMode, Zoom and TorchMode.
See the ConfigureCamera sub in the attached example for more information.
The Preview event allows you to work with the preview frames. You must call ReleaseFrame at the end of this sub:
Otherwise new frames will not arrive.
An example of a CCTV client is also attached. The server code is available here: https://www.b4x.com/android/forum/threads/server-cctv-server.37382/#content
Starting from iOS 10 you need to add an explanation on the camera usage:
LLCamera allows you to embed the preview video in your layout, adjust the camera settings and it also allows you to work with the preview frames.
The first step is to initialize the LLCamera object. You need to pass a Panel. The preview video will be displayed on this panel.
Note that you need to call LLCamera.Resize whenever the panel is resized or the orientation changes.
The next step is to call LLCamera.StartPreview. The preview video will start and now you can call TakePicture to take a picture.
Unlike in B4A, you do not need to call StartPreview again after a picture is taken.
There are several "presets" which you can choose from by setting the Preset property:
B4X:
llc.Preset = llc.PRESET_640x80
The following properties can only be changed inside a configuration block: FlashMode, Zoom and TorchMode.
See the ConfigureCamera sub in the attached example for more information.
The Preview event allows you to work with the preview frames. You must call ReleaseFrame at the end of this sub:
B4X:
Private Sub cam_Preview (Image As Bitmap)
'work with the image
'...
cam.ReleaseFrame(Image)
End Sub
An example of a CCTV client is also attached. The server code is available here: https://www.b4x.com/android/forum/threads/server-cctv-server.37382/#content
Starting from iOS 10 you need to add an explanation on the camera usage:
B4X:
#PlistExtra:<key>NSCameraUsageDescription</key><string>Taking a photo and attach to the task.</string>
Attachments
Last edited: