С binary на hex

This commit is contained in:
RoyceDa
2026-04-10 18:52:58 +02:00
parent ba12db3c72
commit 6554483939
2 changed files with 8 additions and 9 deletions

View File

@@ -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(","),

View File

@@ -105,6 +105,7 @@ export function MessageVoice(props: AttachmentProps) {
const waveformWidth = WAVE_BARS * BAR_WIDTH + (WAVE_BARS - 1) * BAR_GAP;
const waveformRef = useRef<HTMLDivElement | null>(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,11 +187,9 @@ export function MessageVoice(props: AttachmentProps) {
>
{!error && (
<>
{downloadStatus === DownloadStatus.DOWNLOADING &&
downloadPercentage > 0 &&
downloadPercentage < 100 && (
{downloadStatus === DownloadStatus.DOWNLOADING && (
<div style={{ position: "absolute", top: 0, left: 0 }}>
<AnimatedRoundedProgress size={40} value={downloadPercentage} />
<AnimatedRoundedProgress size={40} value={Math.max(1, downloadPercentage)} />
</div>
)}