This commit is contained in:
MomentQYC 2024-10-05 17:21:40 +08:00
parent 69b1acc1f0
commit 8d2d3617c3
3 changed files with 21 additions and 20 deletions

View File

@ -623,15 +623,15 @@ function emitUpdReaction(emoji: string, delta: number) {
} }
watch(convert, (newBlob) => { watch(convert, (newBlob) => {
if (converturl.value && converturl.value.url) { if (converturl.value && converturl.value.url) {
URL.revokeObjectURL(converturl.value.url); URL.revokeObjectURL(converturl.value.url);
} }
if (newBlob) { if (newBlob) {
converturl.value = { url: URL.createObjectURL(newBlob) }; converturl.value = { url: newBlob };
} else { } else {
converturl.value = null; converturl.value = null;
} }
}); });
console.log(converturl) console.log(converturl)

View File

@ -558,17 +558,19 @@ function loadConversation() {
} }
watch(convert, (newBlob) => { watch(convert, (newBlob) => {
/*
try { try {
if (converturl.value && converturl.value.url) { if (converturl.value && converturl.value.url) {
URL.revokeObjectURL(converturl.value.url); URL.revokeObjectURL(converturl.value.url);
} }
} catch (error) { } catch (error) {
console.error('Failed to revoke URL:', error); console.error('Failed to revoke URL:', error);
} }
*/
try { try {
if (newBlob) { if (newBlob) {
converturl.value = { url: URL.createObjectURL(newBlob) }; converturl.value = { url: newBlob };
} else { } else {
converturl.value = null; converturl.value = null;
} }

View File

@ -314,16 +314,15 @@ export function getNoteMenu(props: {
const buffers = new Uint8Array(convertdata.body._readableState.buffer[0].data).buffer; const buffers = new Uint8Array(convertdata.body._readableState.buffer[0].data).buffer;
console.log('UArray:', buffers); try {
const blob = new Blob([buffers], { type: contentType });
const blob = new Blob([buffers], { type: contentType }); props.convert.value = URL.createObjectURL(blob);
} catch (e) {
console.log('Blob:', blob); console.error('Failed to create Blob or Object URL:', e);
}
props.convert.value = URL.createObjectURL(blob); } else {
} else {
console.error('API did not return audio data.'); console.error('API did not return audio data.');
} }
props.converting.value = false; props.converting.value = false;
} }