С binary на hex
This commit is contained in:
@@ -211,7 +211,7 @@ export function DialogInput() {
|
|||||||
}
|
}
|
||||||
sendMessage("", [
|
sendMessage("", [
|
||||||
{
|
{
|
||||||
blob: Buffer.from(await audioBlob.arrayBuffer()).toString('binary'),
|
blob: Buffer.from(await audioBlob.arrayBuffer()).toString('hex'),
|
||||||
id: generateRandomKey(8),
|
id: generateRandomKey(8),
|
||||||
type: AttachmentType.VOICE,
|
type: AttachmentType.VOICE,
|
||||||
preview: duration + "::" + interpolateCompressWaves(35).join(","),
|
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 waveformWidth = WAVE_BARS * BAR_WIDTH + (WAVE_BARS - 1) * BAR_GAP;
|
||||||
const waveformRef = useRef<HTMLDivElement | null>(null);
|
const waveformRef = useRef<HTMLDivElement | null>(null);
|
||||||
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
playAudio,
|
playAudio,
|
||||||
pause,
|
pause,
|
||||||
@@ -121,7 +122,7 @@ export function MessageVoice(props: AttachmentProps) {
|
|||||||
const safeCurrent = isCurrentTrack ? currentDuration : 0;
|
const safeCurrent = isCurrentTrack ? currentDuration : 0;
|
||||||
const playbackProgress = Math.max(0, Math.min(1, safeCurrent / fullDuration));
|
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 ensureStarted = (seekToSec?: number) => {
|
||||||
const blob = createAudioBlob();
|
const blob = createAudioBlob();
|
||||||
@@ -186,11 +187,9 @@ export function MessageVoice(props: AttachmentProps) {
|
|||||||
>
|
>
|
||||||
{!error && (
|
{!error && (
|
||||||
<>
|
<>
|
||||||
{downloadStatus === DownloadStatus.DOWNLOADING &&
|
{downloadStatus === DownloadStatus.DOWNLOADING && (
|
||||||
downloadPercentage > 0 &&
|
|
||||||
downloadPercentage < 100 && (
|
|
||||||
<div style={{ position: "absolute", top: 0, left: 0 }}>
|
<div style={{ position: "absolute", top: 0, left: 0 }}>
|
||||||
<AnimatedRoundedProgress size={40} value={downloadPercentage} />
|
<AnimatedRoundedProgress size={40} value={Math.max(1, downloadPercentage)} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user