Skip to content

Instantly share code, notes, and snippets.

@mpconley
Last active November 24, 2019 22:44
Show Gist options
  • Save mpconley/589687f0d7b63a954c5ced2916472693 to your computer and use it in GitHub Desktop.
Save mpconley/589687f0d7b63a954c5ced2916472693 to your computer and use it in GitHub Desktop.
GMCP Sound Protocol

Enable Sound

The client will enable sound by including "Client.Media 1" as part of the initial Core.Supports messages.

Core.Supports.Set ["Client.Media 1", ...]

Load File

Send a Client.Media.Load event to load a music, video or sound file. Mudlet uses "tag" to store media in folders as well as for categorizing sounds.

Client.Media.Load {
  "file": "sword1.wav",
  "url": "https://www.example.com/combat/",
  "tag": "combat",
}
Required Key Value Example Purpose
Yes "file" media file name "sword1.wav" Media source
Yes "url" URL to media file "https://www.example.com/media/combat/" Download URL path
No "tag" media organization "combat" Media organization

Play File

Send a Client.Media.Play event to load sound, music, or video files. Mudlet uses "tag" to store media in folders as well as for categorizing sounds. Mudlet and Grapevine could use "target" to direct the "where" for video files.

Client.Media.Play {
  "file": "rip.mp4",
  "type": "video",
  "url": "https://www.example.com/combat/",
  "tag": "death",
  "key": "rest-in-peace",
  "target": "modal",
  "volume": 50,
  "loops": 3,
  "priority": 50,
  "continue": true,
}
Required Key Value Example Purpose
Yes "file" media file name "sword1.wav" Media source
Yes "type" sound or music or video "music" Media type
No "url" URL to media file "https://www.example.com/media/combat/" Download URL path
No "tag" media organization "combat" Media organization
No "key" media unique key "callandor" Stops matches
No "target" modal or window reference "GUI.VideoPlayer" For video
No "volume" 1 through 100 50 Media volume
No "loops" -1 (Repeat) or 1+ 3 Media repeating
No "priority" 1 through 100 50 Media priority
No "continue" true (Continue) false (Restart) true For music

Stop File(s)

Send a Client.Media.Stop event to stop sound, music, video files. No arguments stops all sound, music and video media. Mudlet and Grapevine could use "target" to direct the "where" for video files.

Client.Media.Stop {
  "file": "sword1.wav",
  "type": "sound",
  "tag": "combat",
  "key": "callandor",
  "target": "modal",
  "priority": 50,
}
Required Key Value Example Purpose
No "file" media file name "sword1.wav" Stops matches
No "type" sound or music or video "music" Stops matches
No "tag" media organization "combat" Stops matches
No "key" media unique key "callandor" Stops matches
No "target" modal or window reference "GUI.VideoPlayer" Stops matches
No "priority" 1 through 100 50 Stops <= matches
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment