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
  • Photos and videos saved
  • Backup directories
  • Application in the background: Specific case from Android 10
  • Required permissions
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Starts the device's native camera application to record a video or to take a photo.
Remarks:
  • iPhone/iPadIOS WidgetMac Catalyst Syntax 2, which uses a non-locking call, is recommended, especially from iOS 8.
  • In a WINDEV application, VidéoCapture can be used to record a video or to take a photo with the camera of the device.
  • This function is equivalent to CameraRunApp.
Example
sPhoto is string
sPhoto = VideoStartApp(viPictureCapture)
IF sPhoto <> "" THEN
	Info("Photo sauvegardée dans le fichier " + sPhoto)
END
nTypeEnregistrement is int
// Laisse l'utilisateur décider du type de capture
IF Dialog("Souhaitez-vous enregistrer une image ou une vidéo ?", ...
	["Une image", "Une vidéo"], 1, 2, dlgIconQuestion) = 1 THEN
	nTypeEnregistrement = viPictureCapture
ELSE
	nTypeEnregistrement = viVideoCapture
END
// Lance l'application
VideoStartApp(nTypeEnregistrement, CB_VideoLanceAppli)

INTERNAL PROCEDURE CB_VideoLanceAppli(sChemin is string)
	// Si le retour vaut chaîne vide (""), une erreur a eu lieu
	IF sChemin ~= "" THEN
		Error(ErrorInfo())
		RETURN
	END
	// Message de fin d'enregistrement
	Info("Le fichier a été enregistré ici : " + sChemin)
END
Syntax

Starting the native camera application (locking call) Hide the details

<Result> = VideoStartApp([<Type of capture>])
<Result>: Character string
  • Full path of file where the photo or the video was saved,
  • Empty string ("") if an error occurred. To get more details on the error, use ErrorInfo.
<Type of capture>: Optional integer constant
Type of capture:
viPictureCaptureRecord a photo.
viVideoCapture
(Default value)
Camera preview stream snip.

Starting the native camera application (non-locking call) Hide the details

<Result> = VideoStartApp([<Type of capture> [, <WLanguage procedure>]])
<Result>: Boolean
  • True if the photo or video was saved.
  • False otherwise. To get more details on the error, use ErrorInfo.
<Type of capture>: Optional integer constant
Type of capture:
viPictureCaptureRecord a photo.
viVideoCapture
(Default value)
Camera preview stream snip.
<WLanguage procedure>: Procedure name
Name of the WLanguage procedure ("callback") called when the photo or video is recorded.
This procedure has the following format:
PROCEDURE <Procedure name> (<Path>)

where <Path> corresponds to the backup path of image or video.
Remarks

Photos and videos saved

The photo and video settings (format, resolution, size) are the ones defined in the native camera application.

Backup directories

AndroidAndroid Widget In Android applications, the photo or video is stored on the SD Card of the device and is automatically added to the album.
If photos must be used in your Android applications, we advise you to work with thumbnails and not with the initial photos taken by the device. To generate the thumbnails, use VideoGenerateThumbnail.
iPhone/iPadIOS WidgetMac Catalyst In iPhone/iPad applications:
By default:
  • the photos are saved in the "Documents" directory of application.
  • the videos are saved in the "tmp" directory of application.
For the images, you can also:
  • store the binary content of the image in a database, via a Memo item.
  • add the photo to the photo album of the device with AlbumSave. In this case, the image can be re-used via AlbumPicker.
The path returned by the function (syntax 1) or found in the procedure (syntax 2) has the following format:
/private/var/mobile/Containers/Data/Application/D235EF25-455B-4362-8941-0FD09C1D693D/Documents/photo504031018058.jpg
The directory (identified by "D235EF25-455B-4362-8941-0FD09C1D693D") can be renamed whenever the application is installed and updated.
In an iPhone/iPad application, you must only store the file name and extension in order to recreate the path through programming to access the photo.
Reminder: To reconstruct the complete path of the photo, simply use the fDataDir function.
AndroidAndroid Widget

Application in the background: Specific case from Android 10

Starting with Android 10, it is no longer possible to open a window when the application is in the background.
VideoStartApp can open a window. If this function is used while the application is in the background, a fatal error will occur.
Tips:
  • It is possible to determine if the application is in the background using InBackgroundMode.
  • If an application needs to interact with the user while it is in the background, the solution is to display a notification (via the Notification type). The application will be brought back to the foreground when the notification is clicked, if the ActivateApplication property is set to True. You can also open a window from the procedure passed to the ActionClick property.
AndroidAndroid Widget

Required permissions

Using this function automatically changes the permissions required by the application.
Required permissions:
  • READ_EXTERNAL_STORAGE: This permission allows an application to read from external storage (memory card, etc.).
  • WRITE_EXTERNAL_STORAGE: This permission allows an application to write to external storage (memory card, etc.).
  • New in version 2025
    READ_MEDIA_VIDEO: This permission allows an application to read video files from external storage.
  • New in version 2025
    READ_MEDIA_IMAGES: This permission allows an application to read image files from external storage.
New in version 2025
Note: From Android 13, when publishing to Google Play Store, READ_MEDIA_VIDEO, READ_MEDIA_IMAGES and READ_MEDIA_AUDIO permissions require a justification in the Google Play console. If necessary, you can remove permissions from the generation wizard. For more details, see Storing files in Android.
Note: This feature is only available from version 2025 Update 1.
Related Examples:
WM Expense Account Cross-platform examples (WINDEV Mobile): WM Expense Account
[ + ] This example allows you to manage your fees.

Let's see the main features of this application:
- The input of invoices
- Management of foreign currencies
- Inclusion of photo document for the invoices
- Ability to email the expense account
- Ability to track the expense accounts
- ...
Business / UI classification: UI Code
Component: wd300android.aar
Minimum version required
  • Version 16
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/27/2025

Send a report | Local help