ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Standard functions / Windows functions / MCI functions
  • Overview
  • Opening and playing a video in an Image control
  • Opening a Video file
  • Playing a video file
  • Pausing or stopping the video
  • Pausing the video
  • Stop
  • Controlling the volume
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Playing a video with the MCI functions
Overview
MCI functions are used to easily handle media files. This help page presents the different operations that can be performed by the MCI functions.
To easily handle a video in WINDEV, all you have to do is use an Image control.
The following operations can be performed:
  • Open and play a video in an Image control,
  • Pause or stop the video,
  • Control the volume.
Opening and playing a video in an Image control

Opening a Video file

To open a video file, all you have to do is call MCIOpen. Most of the video files can be handled by the MCI functions.
Example:
// Sélection du fichier Vidéo
sFic is string
sFic = fSelect(SAI_FIC, "Sélectionnez un fichier vidéo...",...
	"Fichiers vidéo (*.avi)"+ TAB + "*.avi" + CR + ...
	"Fichiers vidéo MPEG (*.mpg)" + TAB + "*.mpg" + CR + ...
	"Fichiers Quick Time (*.mov)" + TAB + "*.mov" + CR + ...
	"Tous les fichiers (*.*)" + TAB + "*.*", ...
	"*", fselOpen + fselExist)
// Si un fichier a été sélectionné
IF sFic <> "" THEN
	 SAI_FIC = sFic
	 // Fermeture du fichier Vidéo précédent s'il y en a un
	 // Ne fait rien sinon 
	 MCIClose("MaVidéo") 
	 // Ouverture du fichier Vidéo sélectionné 
	 // "MaVidéo" est le nom logique (alias) choisi arbitrairement 
	 // c'est ce nom que l'on utilisera par la suite pour manipuler le fichier 
	 // IMG_VIDEO est le champ Image où va s'afficher la vidéo 
	 MCIOpen(SAI_FIC, "MaVidéo", MciStyleChild, IMG_VIDEO) 
	 // Si l'ouverture a échoué
	 IF ErrorOccurred = True THEN
		 // Affichage du compte-rendu
		  Error(ErrorInfo()) 
	 END
END

Playing a video file

To play a video file, all you have to do is use MCIPlay.
// Lecture de la vidéo sélectionnée
// Rappel : "MaVidéo" est le nom logique choisi pour ce fichier lors de son ouverture
MCIPlay("MaVidéo")
Note To play the AVI video in a loop, simply use the MCIExecute function, specifying the "play AVI repeat" command line:
// Jouer la vidéo de type AVI en boucle
MCIExecute("play AVI Repeat")
Pausing or stopping the video

Pausing the video

To pause the video, all you have to do is call MCIPause.
// Mise en pause de la vidéo sélectionnée
// Rappel : "MaVidéo" est le nom logique  choisi pour ce fichier lors de son ouverture
MCIPause("MaVidéo")

Stop

To stop the playback, simply use MCIStopPlaying.
// Arrêt de la vidéo sélectionnée
// Rappel : "MaVidéo" est le nom logique choisi pour ce fichier lors de son ouverture
MCIStopPlaying("MaVidéo")
Tip Don't forget to reposition the video at the beginning of the file. Therefore, the video will start from the beginning the next time it is played.
// Repositionnement au début du fichier
// Lorsque l'utilisateur redemandera de lire le fichier, la lecture recommencera au début
MCIBeginning("MaVidéo")
Controlling the volume
To control the volume, all you have to do is call MCIVolume. The right volume, the left volume, the treble volume and the bass volume can be turned up and down.
Related Examples:
Play a video Unit examples (WINDEV): Play a video
[ + ] Playing a video from a WINDEV application:
- Load a video
- Playing a video
- Pause a video
- Stop a video
WD Multimedia Complete examples (WINDEV): WD Multimedia
[ + ] This example shows how to play animations, audio and video files (MP3, WAV, AVI, MPEG, etc.) using the Multimedia control in WINDEV.
See also
Minimum version required
  • Version 10
Comments
Click [Add] to post a comment

Last update: 03/27/2025

Send a report | Local help