С binary на hex
This commit is contained in:
@@ -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(","),
|
||||
|
||||
@@ -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>
|
||||
)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user