media_play(STRING* name,BMAP* target, var volume)

media_loop(STRING* name,BMAP* target, var volume)

Plays a movie or audio stream from a file to the screen or to a texture or panel. Media_play plays the stream once, media_loop repeats it until it is explicitly stopped. As many movie, sound or music files as supported by the hardware can be played simultaneously - for instance, to play two midi files at the same time you'd normally need two sound cards. All files playable with the windows media player can be used with this instruction - .avi, .mpg, .wmv, .wma, .wav, .mid, .mp3, .ogg and so on, even some still image formats like .bmp or .jpg..

Parameters:

name Name of the multimedia file. The file must exist in the game folder, it won't be found in the path or in a resource .
target Pointer to a bmap that serves as target texture for the video stream, or NULL. The bmap must be a 16 bit texture without alpha channel, like from a .pcx or .bmp image. If at NULL, the video is played on the whole window or screen.
volume Individual audio volume of the stream, 0 ..100. The master volume for all streams is controlled by the midi_vol variable

Modifies:

media_handle - this variable is automatically set to the handle of the last played movie or audio file.

Returns:

Handle of the multimedia stream, or 0 if the stream couldn't be played.

Speed:

Medium

Edition:

 A6
 A7   all editions

Remarks:

Example:

// Play music "ribanna.mid" at 50% volume endlessly.
handle = media_loop("ribanna.mid",NULL,50);
// Play movie "news.avi" on the tv_model entity with maximum volume
media_play("news.avi",bmap_for_entity(tv_model,0),100); 
// Play movie "news.mpg" on the full screen with maximum volume
media_play("news.mpg",NULL,100); 

See also:

media_pause, media_playing, media_start, media_stop, media_tune, media_layer, media_handle, midi_volnum_mediastreams, snd_loop ► latest version online