ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing an application or website / Controls, windows and pages / Controls: Available types / Camera control
  • Overview
  • Control of a WINDEV Mobile window
  • Creating a Camera control
  • Smart control
  • Available features
  • Camera control in version 27 and later
  • Camera control in version 26 and earlier
  • Managing thumbnails
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Overview

Control of a WINDEV Mobile window

The Camera control is used to:
You can save this video or save a video snapshot.
Remark: You can use the native camera of the device to record a video or take a photo (CameraRunApp).

Creating a Camera control

To create a Camera control:
  1. On the "Creation" tab, in the "Graphic controls" group, click "Camera".
  2. Click at the desired location to create the control. The control appears in the editor.
To view the characteristics of the control, select "Description" in the context menu.
The Camera control can be handled programmatically using the Camera functions.
Remark: These functions are also available with a prefix syntax. For more details, see Camera functions (Prefix syntax).
Remarks:
  • A single Camera control can be used in a window.
  • The Camera control exists in 2 versions:
    • Mode 27 or higher: Camera control created in version 27. It allows using all the new functions and properties available from version 27 onwards (see below).
    • Version-26-compatible mode: Camera control created before version 26. It uses features deprecated by Google. The "Version-26-compatible" mode, available in the control description window, is used to keep the same behavior as in previous versions. If this option is unchecked, the control will be set to mode 27 or higher.

Smart control

WINDEV Mobile features a Smart control to use the camera of the device. All the main functionalities are integrated in this Smart control. It has a Button control (to be added in the window that will open the camera of the device) and a window (opened by the Button control).
To add the Smart control in your window:
  1. In the editor, open the window in which the camera button will be integrated.
  2. On the "Creation" tab, in the "Graphic controls" group, expand "Camera".
  3. Click the control that appears and then click in the window to set the position of the button. The button is created and the "WIN_Mobile_Camera_UI" window is added to the project. This window contains different planes that allow you to manage photo capture and video recording.
Available features

Camera control in version 27 and later

From version 27 onwards, all new Camera controls can be handled programmatically:
  • via the following functions:
    CameraPhotoCaptures a photo via a Camera control in an Android or iOS application.
    CameraStartDecodingStarts decoding bar codes in a Camera control.
    CameraStopDecodingStops decoding bar codes in a Camera control.
    CameraVideoStartStarts recording a video via a Camera control in an Android or iOS application.
    CameraVideoStopStops the video recording previously started by CameraVideoStart.
  • via the following specific properties:
    CameraThe Camera property is used to identify and change the camera used (back or front).
    DisplayModePreviewThe DisplayModePreview property gets and sets the camera preview mode.
    FlashThe Flash property determines and changes the flash mode in a Camera control.
    MaxZoomThe MaxZoom property is used to get the maximum zoom value that can be used for the Camera control (for the camera in use).
    MinZoomThe MinZoom property is used to get the minimum zoom value that can be used for the Camera control (for the camera in use).
    TapToFocusThe TapToFocus property is used to:
    • Determine if tap to focus is enabled in a Camera control.
    • Enable or disable tap to focus in a Camera control.
    TorchThe Torch property is used to determine and change how a Camera control uses the torch.
    WorkingDirectoryThe WorkingDirectory property is used to:
    • get or change the directory used by the HTML Editor control to store the images and CSS sheets of an HTML page.
    • get the directory used by the HTML Display control to store the images and CSS sheets of an HTML page.
    • get the directory used by the Camera control to save photos and videos.
    ZoomThe Zoom property gets or sets the zoom value:
    • in an Image control.
    • in a Map control.
    • in an Organization Chart control.
    • in a Table, TreeView Table, Pivot Table, Spreadsheet or List Box control.
    • in a Word Processing control.
    • in a PDF Reader control.
    • in a Camera control.
    • in a Diagram Editor control;
    • in a window.
    ZoomWithFingerThe ZoomWithFinger property is used to:
    • determine if an Image or Camera control supports pinch zoom.
    • enable or disable pinch zoom in an Image or Camera control.
Only the video being captured can be viewed in a Camera control.
Audio recording:
  • Android Audio is always recorded.
  • iPhone/iPad Audio recording can be enabled or disabled via the "Enable audio recording" option.
To view:
Remark: If you are using a Camera control created in version 27 (or if the "Version-26-compatible" option is unchecked):
  • The VideoParameter function is ignored by the Camera control.
  • The following functions are not available:
    CameraCaptureCaptures the images received from the camera:
    • as an image: takes a photo.
    • as a video: records a video.
    AndroidiPhone/iPad Function kept for "Version-26-compatible" Camera controls.
    CameraDisplayDisplays the video being captured by a web camera or by the camera of a mobile device in a "Camera" control.
    AndroidiPhone/iPad Function kept for "Version-26-compatible" Camera controls.
    CameraStatusReturns the status of a Camera control.
    AndroidiPhone/iPad Function kept for "Version-26-compatible" Camera controls.
    CameraStopStops the video preview or video recording in a Camera control.
    AndroidiPhone/iPad Function kept for "Version-26-compatible" Camera controls.

Camera control in version 26 and earlier

If you used the Camera control in previous versions, the control is automatically set to "Version-26-compatible" mode when you upgrade the project to version 27. In this mode:
  • The new properties and functions in version 27 are not available and cause a fatal error.
  • When taking a photo:
    • the autofocus is taken into account if it is enabled.
    • the orientation of the camera is taken into account for the final orientation of the photo.
  • The click code on the Camera control allows you to trigger the photo capture or to start recording a clip (and to stop).
Only the video being captured can be viewed in a Camera control.
To view:
Android

Managing thumbnails

If photos must be used in Android applications, we advise you to work with thumbnails and not with the initial photos taken by the device. These thumbnails can be generated by CameraGenerateThumbnail.
This example presents how to take photos and generate thumbnails.
sImageFile is string
sThumbnail is string
 
// Takes a photo with the camera of the Android device
sImageFile = CameraRunApp(viVideoCapture)
IF sImageFile = "" THEN
Error("Unable to take the photo.", ErrorInfo())
RETURN
END
 
// Generates a thumbnail from the photo taken by the device
// and displays the thumbnail in an Image control
sThumbnail = fExtractPath(sImageFile, fDrive + fDirectory + fFile) + "_thumb.jpg"
IF CameraGenerateThumbnail(sImageFile, sThumbnail) = True THEN
IMG_Photo = sThumbnail
ELSE
Error("Unable to generate the thumbnail.", ErrorInfo())
END
Minimum version required
  • Version 27
Comments
Click [Add] to post a comment

Last update: 06/26/2023

Send a report | Local help