MCI command

Example 1 : play a media file
Depending on installed MCI devices on your computer, you can play media files from different formats. Especially the device MPEGVideo supports many formats, such as ogg, mp3, wmv, avi, mpeg, ... Please note that this device is not installed on all Windows computers. It is a software device, though, and can be used by installing the mciqtz32 driver and changing some registry settings.

First, you need to open an MCI device and preferrably assign an alias to it. Suppose we want to open the waveaudio device to play a wave file called sound.wav MCI_command('open "sound.wav" type waveaudio alias "audio"');

Now the device is opened and the file sound.wav is loaded into the device. Do not expect that it will automatically play the wave file.

The following command will perform that action:

MCI_command('play "audio"');

Important: remember to use the alias you provided instead of the device name!

Example 2 : check the status of a device
You can check the status of an open device to check whether it is playing, stopped, recording, paused or seeking.

In the following example, the device alias "device" will be used to indicate the device.

var status; status=MCI_command('status "device" mode'); return status;

If you use this piece of code in a script, the status of the device will be returned.

Remarks
This function, when used correctly, can also return a value.