Win32::MultiMedia::Mci - Perl extension for the MCI MultiMedia system on Win32 platforms.
use Win32::MultiMedia::Mci; my $k = Win32::MultiMedia::Mci->open("..\\k.wav"); $k->play(wait); $k->close; #Play the the cd-rom my $k = Win32::MultiMedia::Mci->open("cdaudio"); $k->play; print "press enter to stop\n"; $t= <STDIN>; $k->stop; $k->close;
Win32::MultiMedia::Mci::SendString("command string", bool); You can import this with: use Win32::MultiMedia::Mci(SendString); If bool is true, it returns an array containing the result of the action along with the error code. my ($value, $errornumber) = SendString("status mode cdaudio",1); For valid command strings, goto: http://msdn.microsoft.com/library/default.asp?URL=/library/psdk/multimed/mci_04dv.htm Example: SendString("open count.avi alias avi1"); SendString("play avi1 wait"); SendString("close avi1");
All methods return 0 if sucessfull or an error number on failure. Use $obj->error($num) to get the error string. All methods can take a flag called "wait" which tells the command not to return until done. $mci = Win32::MultiMedia::Mci->open( device, [option => value]* ); Opens the device with the the given attributes. "device" can be: The name of a sound file of a MediaPlayer-recognized type such as WAV, MP3, MID, AU, AVI etc. A system device such as "cdaudio", "sequencer", or "digitalvideo". The keyword "new". options: "type": used with a device of "new" can take values like "waveaudio". "alias": used to give the device opened an alias, this option isn't very useful in the OO form. "buffer": number of seconds to buffer. "style": used with digitalvideo (AVI). values can be "child", "overlapped", or "popup" "parent": used with digitalvideo (AVI) to specify the container window. Value is a hwnd. In perlTk, get this with "hex($widget->id)" "shareable": used with cdaudio and devices. Takes 0/1 value. "wait": tells the command not to return until done. Takes 0/1 value. $mci->play( [option [=> value]]* ); All devices: "from": start at the position given. "to": stop at the position given. "wait": tells the command not to return until done. digitalvideo: "fullscreen": use fullscreen mode for compressed files. "repeat": loop the playback. "reverse": play backward. "from" does not work with this flag. videodisc: "fast": play the disc faster than normal. "slow": play the disc slower than normal. "speed": specify the exact frames/sec to go. "scan": play as fast as possible with video. "reverse": reverse play. vcr (What? You don't have a VCR on *your* computer?): "at": specify "scan": play as fast as possible with video. "reverse": reverse play. $mci->record( options ) records on the device. waveaudio: from => position : start at position to => position : stop at position insert : new data is added overwrite : overwrite the old data digitalvideo: from => position : start at position to => position : stop at position insert : new data is added overwrite : overwrite the old data $mci->save(filename) Saves the recorded/modified data to filename. $mci->seek( to => position ) "position" can be the keywords "start" or "end" or a number. Equivilent to $mci->play(from => position); vcr can take: at => time or mark => marknum or "reverse" videodisc can take "reverse" $mci->stop() Stops the device. $mci->close() Closes the open device and all resources used by it. $mci->set(options) $mci->set("time format tmsf");
A. U. Thor, firstname.lastname@example.org