ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Controls, pages and windows / Video functions
  • Saving a photo
  • Use conditions:
  • Required permissions
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Captures the images received from the camera:
  • as an image: take a photo.
  • as a video: record a video.
AndroidiPhone/iPad
Warning
Starting with version 27, this function is deprecated for Android and iOS applications. This function is kept only for Camera controls created with earlier versions and with the "Version-26-compatible mode" option enabled ("General" tab of the control description window).
Depending on the platform, the following photo and video formats are used:
  • WINDEVWindows BMP images or AVI videos.
    If the file extension is.jpg or.jpeg, the image is saved in JPEG format
  • Android JPEG images or videos. The format and quality of the video depend on the default device settings and may differ from one device to another.
  • iPhone/iPad JPEG images or videos. The format and quality of the video depend on the default device settings and may differ from one device to another.
AndroidiPhone/iPad Note: To obtain a photo or video directly using the device's native camera application, use the VideoStartApp function.
Example
WINDEVReports and QueriesUser code (UMC)
// Enregistre la vidéo retransmise dans le champ Caméra "CAM_Cuisine"
// sous forme d'une AVI ("C:\Temp\MaVideo.AVI") de 1 minute
ResSauvegarde = CAM_Cuisine.Capture("C:\Temp\MaVideo.AVI", viVideoCapture, 60)
IF ResSauvegarde = True THEN
	Info("Vidéo correctement sauvegardée")
ELSE
	Error(ErrorInfo())
END
Syntax
<Result> = <Camera control>.Capture(<File to create> [, <Type of capture> [, <Capture duration> [, <Images per second> [, <Preview stream>]]]])
<Result>: Boolean
  • True if the video was recorded successfully,
  • False otherwise. To get more details on the error, use ErrorInfo.
<Camera control>: Control name
Name of the Camera control to be used.
<File to create>: Character string
Name and full (or relative) path of the file to create.
WINDEVWindows When a photo is taken, a BMP file is created. When a video is recorded, an AVI file is created
Android When a photo is taken, a JPEG file is created. If a video is recorded, the format and quality of the video will depend on the default settings of the device and may differ from one device to another.
Warning: It is not possible to use a UNC path.
<Type of capture>: Optional integer constant
Type of capture:
viPictureCapture
WINDEVWindows Captures an image and saves it as a BMP file.

Android Captures an image and saves it as a JPEG file.
viVideoCapture
(Default value)
WINDEVWindows Captures a video and saves it as an AVI file.

Android If a video is recorded, the format and quality of the video will depend on the default settings of the device and may differ from one device to another.
<Capture duration>: Optional integer
Length of the video recording (in seconds). If this parameter is set to 0 or is not specified, the video recording will stop:
  • when <Camera>.Stop is called.
  • when there is no more space on the disk.
This parameter can correspond to:
  • an integer corresponding to the number of seconds,
  • a Duration variable,
  • the duration in a readable format (e.g., 1 s or 10 ms).
<Images per second>: Optional integer
Number of frames per second (15 by default). This parameter is taken into account only if <Type of capture> is equal to viVideoCapture.
<Preview stream>: Optional boolean
  • True (by default) if the video stream must be displayed in the specified Camera control,
  • False otherwise.
AndroidiPhone/iPad This parameter is ignored. The preview stream is always displayed in the Camera control.
Remarks

Saving a photo

Only the image displayed when <Camera>.Capture is executed is saved as a BMP image. To save this image, you can also use:

Use conditions:

  • WINDEVWindows To use this function, a "web camera" must be connected to the current computer.
  • Android This function requires a device equipped with a camera. It can also be used in the Android emulator (only to capture images).
  • Android To get and set the camera settings, use VideoParameter and VideoListParameter.
Android

Required permissions

This function changes the permissions required by the application.
Required permissions:
  • CAMERA: This permission allows applications to access the camera.
  • RECORD_AUDIO: This permission allows applications to record sound.
Related Examples:
The Camera functions Unit examples (WINDEV Mobile): The Camera functions
[ + ] Using the WLanguage "Camera" functions to start the native video camera application of the device in order to record a video or to take a photo.
WM System Cross-platform examples (WINDEV Mobile): WM System
[ + ] This application is an example of some of the features of WINDEV Mobile available for Android/iOS.
The following system functions are used:
- NFC
- Multimedia control
- Brightness
- Volume
- Wi-Fi
- Bluetooth
- Toast
- Compass
- Accelerometer
- Camera control
- LED
- Vibration
- Notifications
- Drawing functions
- Internet
Component: wd300obj.dll
Minimum version required
  • Version 23
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/30/2024

Send a report | Local help