-
-
Notifications
You must be signed in to change notification settings - Fork 0
Voice Forwarding
Cursor Agent edited this page Sep 18, 2026
·
2 revisions
voice_enabled: true 时在 voice_port(默认 8082)提供实时语音。全频道 Opus 解码为 48kHz 单声道 float32 PCM。
| 版本 | 方式 |
|---|---|
| 2.5 |
GET /ws?key=control_token 或 X-Control-Token
|
| 2.6 | 握手头 Authorization: Bearer / X-SLDataAPI-Key;ACL voice:/ws、voice:/status
|
| 路径 | 说明 |
|---|---|
GET /ws |
升级 WebSocket,语音流 |
GET /status |
JSON:当前说话玩家(1.5s 无包视为静音) |
- 文本
{"type":"hello","sampleRate":48000,"channels":1,"format":"float32"} - 文本
speaker:昵称、userid、playerid、role、channel(频道/角色变化时) - 二进制语音:
[0]=0x01 [1]=channel [2-3]=playerId LE [4-7]=seq LE [8..]=float32 PCM(约 10ms/帧)
- 事件:
SendingVoiceMessage/VoiceTransceiver.ServerReceiveMessage - 解码器按 netId 维护;异常重建;不用
ReferenceHub作长期键 - 发送:
Poll可写检查,满则丢帧;持续不可写断连;主线程不阻塞 - 连接上限 8;握手超时 10s
录音存档见 Voice-Recording(需 voice_record_enabled)。