gdmp.voice
Esta página aún no está disponible en tu idioma.
Runs on: server and client. Since API level 122.
Capability: voice. Voice chat in the experience (the manifest’s "voice": {"mode": "global" | "proximity", "range": 30..30000}). The
server owns channels and mutes; a client reads who speaks and sets its own volumes. A player can always mute anyone
for themselves.
| Server | |
|---|---|
setChannel(playerId, name) |
"" = the default channel; a name is up to 23 of A-Z a-z 0-9 _ - and spaces |
getChannel(playerId) → string |
|
setMuted(playerId, muted) / isMuted(playerId) |
the server’s mute (nobody hears them) |
isSpeaking(playerId) → boolean |
a voice frame in the last 300 ms |
| Client | |
|---|---|
isEnabled() → boolean |
voice runs on this PC |
isSpeaking(playerId) → boolean |
|
onSpeaking(callback) |
callback(playerId, speaking) |
setVolume(playerId, 0..2) / getVolume(playerId) |
the game’s own volume for that player |
channel() → string |
the channel this player is in |
playSound("join" | "leave" | "mute" | "unmute") |
a voice sound (if the player has them on) |
TypeScript
Section titled “TypeScript”The declarations from the GDMP types (namespace GDMP), comments included:
interface VoiceServer { /** `""` = the default channel. */ setChannel(playerId: PlayerId, name: string): void; getChannel(playerId: PlayerId): string; setMuted(playerId: PlayerId, muted: boolean): void; isMuted(playerId: PlayerId): boolean; isSpeaking(playerId: PlayerId): boolean;}
interface VoiceClient { isEnabled(): boolean; isSpeaking(playerId: PlayerId): boolean; onSpeaking(cb: Callback<[playerId: PlayerId, speaking: boolean]>): void; /** 0..2. */ setVolume(playerId: PlayerId, volume: number): void; getVolume(playerId: PlayerId): number; channel(): string; playSound(sound: 'join' | 'leave' | 'mute' | 'unmute'): void;}