Skip to main content

The Client.Media package

This package can be used to play sound effects, background music or videos on the client. It copies concepts from the MUD Sound Protocol (MSP) and extends it further.

Source: Mudlet Wiki

Client.Media.Default

Sent by the server to identify to the game client a default URL directory to load media files from an external resource.
Guidance: For games that automatically download media files, perform a Client.Media.Default GMCP event once upon player login.

Client.Media.Default {"url": "https://www.example.com/media/"}
KeyRequiredValuePurpose
urlMaybeurlResource location where the media file may be downloaded.
Last character must be a / (slash).
Only required if a url was not set with Client.Media.Default.

Client.Media.Load

Load media files from an external source.
Guidance: For games that automatically download media files and have the capability to cache with the game client.

Client.Media.Load {
"name": "sword1.mp3",
"url": "hxxps://www.example.com/media/"
}
KeyRequiredValuePurpose
nameYesfile nameName of the media file.
May contain directory information (i.e. weather/lightning.mp3).
urlMaybeurlResource location where the media file may be downloaded.
Last character must be a / (slash).
Only required if a url was not set with Client.Media.Default.

Client.Media.Play

Play media files.
Guidance: Game clients could choose whether to play only one media file at one time or multiple files at one time.

Client.Media.Play {
"name": "80_Blacksmith_Shoppe.mp3",
"url": "https://www.example.com/media/",
"type": "music",
"tag": "environment",
"volume": 25,
"fadein": 5000,
"fadeout": 7000,
"start": 1000,
"finish": 20000,
"loops": 3,
"priority": 60,
"continue": true,
"key": "area-background-music",
"caption": "Blacksmith Hammering"
}
KeyRequiredValueDefaultPurpose
"name"Yesfile nameName of the media file.
May contain directory information (i.e. weather/lightning.mp3).
"url"MaybeurlResource location where the media file may be downloaded.
Last character must be a / (slash).
Only required if the file is to be downloaded remotely and a url was not set above with Client.Media.Default or Client.Media.Load.
"type"No"sound", "music" or "video""sound"Identifies the type of media.
"tag"NotagHelps categorize media.
"volume"No1 to 10050Relative to the volume set on the player's client.
"fadein"NomsecVolume increases, or fades in, ranged across a linear pattern from one to the volume set with the "volume" key.
Start position: Start of media.
End position: Start of media plus the number of milliseconds (msec) specified.
1000 milliseconds = 1 second.
"fadeout"NomsecVolume decreases, or fades out, ranged across a linear pattern from the volume set with the "volume" key to one.
Start position: End of the media minus the number of milliseconds (msec) specified.
End position: End of the media.
1000 milliseconds = 1 second.
"start"Nomsec0Begin play at the specified position in milliseconds.
1000 milliseconds = 1 second.
"finish"Nomsec0End play at the specified position in milliseconds.
1000 milliseconds = 1 second.
"loops"No-1, or >= 11Number of iterations that the media plays.
A value of -1 allows the sound or music to loop indefinitely.
"priority"No1 to 100Halts the play of current or future played media files with a lower priority while this media plays.
"continue"Notrue or falsetrueContinues playing matching new music files when true.
Restarts matching new music files when false.
"key"NokeyUniquely identifies media files with a "key" that is bound to their "name" or "url".
Halts the play of current media files with the same "key" that have a different "name" or "url" while this media plays.
"caption"NotextCaption-friendly textual representation of the media, such as onomatopoeia or sound cues (e.g., thunderclap, whoosh), enabling accessibility.>

Client.Media.Stop

Stop playing media files. Guidance: An empty body will stop all media.

Client.Media.Stop {
"name": "city.mp3",
"type": "music",
"tag": "environment",
"priority": 60,
"key": "area-background-music",
"fadeaway": true,
"fadeout": 7000
}
KeyRequiredValueDefaultPurpose
"name"Nofile nameStops playing media by name matching the value specified.
"type"No"sound", "music" or "video""sound"Stops playing media by type matching the value specified.
"tag"NotagStops playing media by tag matching the value specified.
"fadeaway"NomsecDecrease volume from the current position for a given duration, then stops the track.
Given duration is the lesser of the remaining track duration or the fadeout specified in Client.Media.Play.
If fadeout was not specified in Client.Media.Play, then the optional fadeout parameter from Client.Media.Stop or a default of 5000 milliseconds will be applied.
"fadeout"NomsecDefault duration in milliseconds to decrease volume to the end of the track.
Only used if fadeout was not defined in Client.Media.Play.
"priority"No1 to 100Stops playing media with priority less than or equal to the value.
"key"NokeyStops playing media by key matching the value specified.