Description
Provides access to the Media Control Interface (MCI), which provides standard commands for playing multimedia devices and recording multimedia resource files.
available: SWFKit Express, SWFKit, SWFKit Pro
Syntax
new MCI();
Remarks
MCI provides two ways to play multimedia devices. The first is the sendCmdString method, which represents the command-string interface of MCI. You can call it directly for it is a static method. E.g.
//opens the CD-ROM then close it.
MCI.sendCmdString("open cdaudio alias cd");
MCI.sendCmdString("set cd door open wait");
MCI.sendCmdString("set cd door closed wait");
MCI.sendCmdString("close cd");
The second is the command property, which represents the command-message interface of MCI. The MCI object provides some other properties to work with the command property. The following examples demonstrating how to use these properties:
//Example 1. Opens a cdaudio var m = new MCI; //specifies the device type m.deviceType = "cdaudio"; //open the cdaudio device m.command = "open"; //Example 2. Opens a waveform-audio file var m = new MCI; //specifies the device type m.deviceType = "waveaudio"; //specifies the file name m.fileName = "test.wav"; //open the cdaudio device m.command = "open";
var m = new MCI; m.command = "open"; if (m.error) trace(m.errorMsg);
var m = new MCI; m.wait = true; m.deviceType = "cdaudio"; m.command = "open"; //The continuous scripts won't //run until the CDAudio is opened ...
//Example.
//Closes the device after playing the wave
function on\_notify(flag)
{
m.notify = false;
m.command = "close";
if (flag == 1) trace("OK.");
}
m = new MCI;
m.deviceType = "waveaudio";
m.fileName = "d:\\1.wav";
m.command = "open";
m.notify = true;
m.onNotify = on\_notify;
m.command = "play";
//Example. Playing a CD
function on\_notify(flag)
{
m.notify = false;
m.command = "close";
}
m = new MCI;
m.deviceType = "cdaudio";
m.command = "open";
//set the time format to TMSF
m.timeFormat = 10;
//plays track 12
m.from = MCI.makeTMSF(12, 0, 0, 0);
m.to = MCI.makeTMSF(13, 0, 0, 0);
m.notify = true;
m.onNotify = on\_notify;
m.command = "play";
//Example: playing a movie m = new MCI; m.deviceType = "avivideo"; m.fileName = "D:\\1.avi"; //set the loaction of the playing window m.left = 0; m.top = 0; m.width = 320; m.height = 240; m.command = "open"; m.command = "play";
//Example: use command "seek" to //change the current position of the CD var m = new MCI; m.deviceType = "cdaudio"; m.command = "open"; m.timeFormat = 10; m.to = MCI.makeTMSF(10, 1, 0, 0); m.command = "seek"; m.to = MCI.makeTMSF(11, 0, 0, 0); m.command = "play";
m = new MCI; m.deviceType = "waveaudio"; m.fileName = ""; m.wait = true; m.command = "open"; //set the time format to milliseconds m.timeFormat = 0; //Set the record length to 10 seconds m.to = 10000; m.command = "record"; //save the recording to file m.fileName = "d:\\1.wav"; m.command = "save"; m.command = "close";