From 6554483939a5a77f328e54c4cf25c626a01231a9 Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Fri, 10 Apr 2026 18:52:58 +0200 Subject: [PATCH] =?UTF-8?q?=D0=A1=20binary=20=D0=BD=D0=B0=20hex?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/DialogInput/DialogInput.tsx | 2 +- .../MessageAttachments/MessageVoice.tsx | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/app/components/DialogInput/DialogInput.tsx b/app/components/DialogInput/DialogInput.tsx index 9734052..ff6debc 100644 --- a/app/components/DialogInput/DialogInput.tsx +++ b/app/components/DialogInput/DialogInput.tsx @@ -211,7 +211,7 @@ export function DialogInput() { } sendMessage("", [ { - blob: Buffer.from(await audioBlob.arrayBuffer()).toString('binary'), + blob: Buffer.from(await audioBlob.arrayBuffer()).toString('hex'), id: generateRandomKey(8), type: AttachmentType.VOICE, preview: duration + "::" + interpolateCompressWaves(35).join(","), diff --git a/app/components/MessageAttachments/MessageVoice.tsx b/app/components/MessageAttachments/MessageVoice.tsx index a9c1e59..618d77e 100644 --- a/app/components/MessageAttachments/MessageVoice.tsx +++ b/app/components/MessageAttachments/MessageVoice.tsx @@ -105,6 +105,7 @@ export function MessageVoice(props: AttachmentProps) { const waveformWidth = WAVE_BARS * BAR_WIDTH + (WAVE_BARS - 1) * BAR_GAP; const waveformRef = useRef(null); + const { playAudio, pause, @@ -121,7 +122,7 @@ export function MessageVoice(props: AttachmentProps) { const safeCurrent = isCurrentTrack ? currentDuration : 0; const playbackProgress = Math.max(0, Math.min(1, safeCurrent / fullDuration)); - const createAudioBlob = () => new Blob([Buffer.from(props.attachment.blob, "binary")], { type: "audio/webm;codecs=opus" }); + const createAudioBlob = () => new Blob([Buffer.from(props.attachment.blob, "hex")], { type: "audio/webm;codecs=opus" }); const ensureStarted = (seekToSec?: number) => { const blob = createAudioBlob(); @@ -186,13 +187,11 @@ export function MessageVoice(props: AttachmentProps) { > {!error && ( <> - {downloadStatus === DownloadStatus.DOWNLOADING && - downloadPercentage > 0 && - downloadPercentage < 100 && ( -
- -
- )} + {downloadStatus === DownloadStatus.DOWNLOADING && ( +
+ +
+ )} {isUploading && (