fix(录音): gameui_play/stop_voice 的 user 强转字符串(H5传数字座位号致data丢失)
真机日志:gameui_play_voice 回投消息无 data 字段,H5 handler 读 data[0] 报 TypeError(reading '0')、座位动画不播。根因:H5 以数字下发 user(座位号), number.length=undefined 致桥 doSend 判空丢弃 data。改为强转字符串,对齐 Android json.getString(user)+""+uservoice。参见 jsbridge-data-object-coercion 同类坑。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
64c0c621bc
commit
1eb1ef985d
@@ -133,7 +133,9 @@ export class AudioProvider implements CapabilityProvider {
|
||||
if (req.audiourl === '') {
|
||||
return;
|
||||
}
|
||||
const user: string = req.user;
|
||||
// user 可能被 H5 以数字(座位号)下发;须强转字符串再用于回投——对齐 Android json.getString("user")+""+uservoice。
|
||||
// 否则 number 的 .length 为 undefined,桥 doSend 判空丢弃 data → H5 gameui_play_voice 收到 undefined 报错(reading '0')、座位动画不播。
|
||||
const user: string = (req.user === undefined || req.user === null) ? '' : String(req.user);
|
||||
// 打断正在播的旧语音:先通知 H5 停旧座位动画,再释放(对齐"同一时刻只播一条")。
|
||||
if (this.voicePlayer !== undefined && this.currentVoiceUser !== '') {
|
||||
this.bridge?.callHandler(OutboundHandlers.GameUiStopVoice, this.currentVoiceUser);
|
||||
|
||||
Reference in New Issue
Block a user