wechaty / puppet-padlocal

Puppet PadLocal is a Pad Protocol for WeChat
https://wechaty.js.org/docs/puppet-providers/padlocal
Apache License 2.0
607 stars 85 forks source link

发送语音消息,遇到 runtime 报错 SERVER_ERROR: 13 INTERNAL: Request message serialization failure: Failure: Type not convertible to Uint8Array #273

Open mevernom opened 8 months ago

mevernom commented 8 months ago

问题描述:

执行时以 FileBox 发送语音文件 (扩展名 .sil)会遇到 SERVER_ERROR: 13 而失败。 同样的文件,扩展名改掉再打包,则会作为一般的文件而正常发送。

该文件是以 wx-voice 将 wav 转为 silk 文件,原声音时长是 24 秒。与代码片段的 .metadata.voiceLength: 24000 一致。 文件格式以线上服务 aconvert 分析确认是 WeChat Audio message (SILK codec)截圖 2023-10-23 16 59 27

预期结果:

silk 语音文件顺利发送并被渲染为语音消息。

配置:

客户端应用是 electron 构建的 Mac 桌面应用。

代码片段:

const voice = FileBox.fromFile('/tmp/output.sil');
voice.mimeType = 'audio/silk';
// voice.mediaType = "audio/silk";
voice.metadata = {
    voiceLength: 24000,
};
const result = await message.say(voice);

错误信息:

ERROR
[tid:8d96c0ef] request has been cancelled for reason: SERVER_ERROR: 13 INTERNAL: Request message serialization failure: Failure: Type not convertible to Uint8Array.
VError: [tid:8d96c0ef] request has been cancelled for reason: SERVER_ERROR: 13 INTERNAL: Request message serialization failure: Failure: Type not convertible to Uint8Array.
    at Request._failAllPendingRequest (/Users/mevernom/Workspace/***/node_modules/padlocal-client-ts/dist/Request.js:265:19)
    at ClientDuplexStreamImpl.<anonymous> (/Users/mevernom/Workspace/***/node_modules/padlocal-client-ts/dist/Request.js:56:18)
    at ClientDuplexStreamImpl.emit (events.js:315:20)
    at Object.onReceiveStatus (/Users/mevernom/Workspace/***/node_modules/@grpc/grpc-js/build/src/client.js:419:28)
    at Object.onReceiveStatus (/Users/mevernom/Workspace/***/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:323:181)
    at /Users/mevernom/Workspace/***/node_modules/@grpc/grpc-js/build/src/resolving-call.js:99:78
    at processTicksAndRejections (internal/process/task_queues.js:75:11)
GZ315200 commented 7 months ago

兄弟,这个解决了吗?

aqpmzngldh commented 2 months ago

wx-voice

解决了没有呀

aqpmzngldh commented 2 months ago

兄弟,这个解决了吗?

你搞定了没