Multimedia Guide and Reference

Recommended connections

You can make any connection between objects. The following explains certain key connections that can be made.

Getting the buttons to work

Only two connections are necessary. First, connect the player attribute of any button or button block to the self attribute of the audio wave player or digital video player. When this connection exists, the button can communicate with the player and take action when a button is pressed.

Next, connect the stateChanged event of the player to the setEmphasis action of the buttons. This enables and disables the buttons based on the state of the player. This connection is optional but gives your application a common look and feel.

Opening and closing the application

When your application opens, you should make a connection to open the digital video player. The easiest way to open the digital video player is by connecting the openedWidget event of your window to the openFile action of the digital video player. Then, connect the name of the file you want to open to the aFileName parameter of the openFile connection.

When your application is finished working with the digital video player, we recommend that you close it. Then, when your application terminates, the player doesn't remain open. Closing the digital video player ensures that other applications that use digital video will have access to the player. One example is to connect the aboutToCloseWidget event of your window to the close action of the digital video player.

Tip icon
It is important that, once opened, a multimedia player close before it, or another player, opens again. Otherwise, your system might hang or another unexpected result might occur.

Error handling

The easiest way for you to add error handling to your application is to tear off the lastError attribute and connect the errorOccured event of lastError to the display action of lastError. Now, whenever an error occurs, a message box displays.

There are three different types of errors: critical, warning and information. You can control which errors are displayed in the message box by setting errorThreshold. There are three values that you can set:

1
Displays only critical errors.
2
Displays both critical and warning errors.
3
Displays critical, warning and information errors.

The default error threshold is 2. To change this, you can connect the aboutToOpenWidget event of your window to the errorThreshold attribute of lastError. Set the argument to be either 1, 2, or 3.

Performance improvement

Depending on how your application's user interface is designed, you may want to take advantage of the fileToLoad attribute. For example, you may build a user interface that contains both a list box which lists the digital video files and the motion buttons. If you want to play the selected file, you have two alternatives. The first is that every time you make a selection from the list, you open up the file. When the digital video player receives an open, it loads up the file and prepares for playback. For large files, this could be time consuming. A better alternative is to update the fileToLoad attribute as the user maneuvers through the list. The file will be loaded only when the user presses one of the buttons, such as Play.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]