|
|
|
|
|
- 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
Playing a video with the MCI functions
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: // 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") Remark: To play the video (AVI type) in loop, use MCIExecute and specify "play AVI repeat" in command line: // Play the AVI video in loop MCIExécute("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") Stop // 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")
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:
|
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
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|