From 9c0c9f90f0976a420b5ef7789ebddd4fc6920cda Mon Sep 17 00:00:00 2001 From: tangtaoit Date: Fri, 15 Sep 2023 14:12:58 +0800 Subject: [PATCH] fix: voice cell crash --- packages/tsdaodaobase/src/Messages/Voice/index.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/tsdaodaobase/src/Messages/Voice/index.tsx b/packages/tsdaodaobase/src/Messages/Voice/index.tsx index 2dded1f..c01a9ff 100644 --- a/packages/tsdaodaobase/src/Messages/Voice/index.tsx +++ b/packages/tsdaodaobase/src/Messages/Voice/index.tsx @@ -69,7 +69,9 @@ export class VoiceCell extends MessageCell { this.timeRef = React.createRef() const { message } = props this.content = message.content - this.waveform = Uint8Array.from(Buffer.from(this.content.waveform, "base64")) + if(this.content.waveform && this.content.waveform.length>0) { + this.waveform = new Uint8Array(atob(this.content.waveform).split('').map(char => char.charCodeAt(0))); + } this.timeFormat = this.formatSecond(this.content.timeTrad) }