PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • 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
  • Stopping the video
  • Controlling the volume
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Playing a video with the MCI functions
Overview
The MCI functions allow you to easily handle the multimedia 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:
// Select the video file
sFile is string
sFile = fSelect(EDT_FILE, "Select a video file...",...
"Video files (*.avi)"+ TAB + "*.avi" + CR + ...
"MPEG video files (*.mpg)" + TAB + "*.mpg" + CR + ...
"Quick Time files (*.mov)" + TAB + "*.mov" + CR + ...
"All files (*.*)" + TAB + "*.*", ...
"*", fselOpen + fselExist)
// If a file was selected
IF sFile <> "" THEN
 EDT_FILE = sFile
 // Close the previous Video file if there is one
 // No action otherwise
 MCIClose("MyVideo")
 // Open the selected Video file
 // "MyVideo" is the logical name (alias) chosen arbitrarily
 // this name will be used to handle the file thereafter
 // IMG_VIDEO is the Image control where the video will be displayed
 MCIOpen(EDT_FILE, "MyVideo", MciStyleChild, IMG_VIDEO)
 // If the opening failed
 IF ErrorOccurred = True THEN
 // Display the status report
  Error(ErrorInfo())
 END
END

Playing a video file

To play a video file, all you have to do is use MCIPlay.
// Play the selected video
// Reminder: "MyVideo" is the logical name chosen for this file when it is opened
MCIPlay("MyVideo")
Note: To play the video (AVI type) in loop, use MCIExecute and specify "play AVI repeat" in command line:
// Play the AVI video in loop
MCIExecute("play AVI repeat")
Pausing or stopping the video

Pausing the video

To pause the video, all you have to do is call MCIPause.
// Pause the selected video
// Reminder: "MyVideo" is the logical name chosen for this file when it is opened
MCIPause("MyVideo")

Stopping the video

To stop playing the video, all you have to do is call MCIStopPlaying.
// Stop the selected video
// Reminder: "MyVideo" is the logical name chosen for this file when it is opened
MCIStopPlaying("MyVideo")
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.
// Reposition at the beginning of the file
// When the user asks to read the file again, the read operation will start from the beginning
MCIBegining("MyVideo")
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 explains how to play videos (AVI, MPEG, and so on), sounds (AUDIO CD, MP3, WAV) and animations (Flash) with the WLanguage functions. The following topics are presented in this example:
1/ how to handle the sounds and the videos in WLanguage
2/ how to exploit a "Flash" animation
3/ how to clip windows
4/ how to manage a playlist
5/ how to generate playlists with the XML functions
Summary of the example supplied with WINDEV:
This example is used to read all types of multimedia files. It manages a playlist that can be modified, saved and opened.
This example helps you include multimedia resources in your applications.
See also
Minimum required version
  • Version 10
Comments
Click [Add] to post a comment