Example: Playing a Video File

The following procedure uses the Media Control Interface to play a video file.

TO PLAY.AVI
  IGNORE MCI [open c:\\windows\\clock.avi alias clock]
  MCI [play clock]
  WAIT 120
  MCI [pause clock]
  WAIT 120
  MCI [resume clock]
  WAIT 720
  MCI [close clock]
END

Let's take a closer look at each instruction in the example above.

The procedure first opens "c:\windows\clock.avi" by issuing an open command. We use the alias parameter so that we can refer to this media entity as clock instead of always using the full path to clock.avi. Unlike most other commands, the open command outputs a value on success. Since Logo programs must do something with every value that is output, we simply IGNORE it.

The play command is used to start playing from one time to another. The video plays asynchornously, which means that FMSLogo doesn't wait for the video to finish playing before running the next instruction. If you wanted to wait until the track was done before moving on to the next instruction, you could add wait to the end of the MCI instruction, as in:

MCI [play clock wait]

The WAIT instructions just waits for some amount of time. They have nothing to do with MCI, they just gives you some time to see the result of the previous MCI command.

The pause and resume commands are used to pause and unpause the video.

The close command is used to tell the Media Control Interface that you are done with the video file. This closes the window in which the video was playing.


SourceForge.net Logo