Windows Media Format SDK banner art
PreviousNext

To Write Windows Media Script Files

Scripts are formed from two Unicode strings, a type and argument string.

The script data must be formatted before it is sent to the writer. The strings should be concatenated together, separated by a NULL character, and terminated with a NULL character. For example, a legitimate script would be:

'U', 'R', 'L', '\0', 'h', 't', 't', 'p', ':', '/', '/', 'm', 's', 'w', '\0'

Each script should be written out by a call to WriteSample, using a pointer to the buffer containing the scripts as the input parameter. For more information on the script format, see the Media Input and Output Formats section. For the main procedure for writing files, see the To Write Windows Media Files section.

Typical uses of script streams are for URL flips and event-driven stream switching.

URL flips are used both when using the Microsoft® PowerPoint® presentation broadcast feature and for synchronized media content that is rendered with an embedded player. An URL flip can be achieved using the FILE script type. With a series of these it is possible to present a series of slides (through PowerPoint or Microsoft Internet Explorer) at the appropriate times during an audio presentation. Animation is not currently a practical goal for this technique, as each slide will need to be downloaded before being rendered.

Event-driven stream switching is used when creating playlists that require real-time advert insertion, for example.

If more sophisticated presentations are required of a player, then developers should consider defining their own script types, and developing their player's to respond to them accordingly. The following table lists script types that are supported by Microsoft Windows Media Player.

Script type Description
URL The player sends the specified URL to the browser for display to the user. If an embedded player control is being used, you can add a specific frame reference to the URL by using the &&framename syntax.
FILENAME A URL to another media file to be played.
CAPTION A text string that is displayed in the captions area of the media player. This type supports standard HTML formatting, so the text can be formatted as you wish. An example of use is closed captioning.
EVENT The name of an event that is to occur. The EVENT type supports customization for your own uses. The code for the specified event must be defined in the Windows Media Metafile (see the Windows Media Metafile reference in this document) for the stream in order for the player to perform the specified event. An example of use is ad insertion.
OPENEVENT This script precedes the actual EVENT. The OPENEVENT allows the player to pre-buffer the content so that when the EVENT occurs the switch between streams appears to be seamless.

See Also

PreviousNext


© 1999 Microsoft Corporation. All rights reserved.