Fixing the video-to-file conversion error and audio appearance changes.
This commit is contained in:
@@ -9,6 +9,7 @@ import type {
|
||||
} from '@mento/shared';
|
||||
import { formatClockFa, toFaDigits } from '@/lib/jalali';
|
||||
import {
|
||||
classifyChatFile,
|
||||
onRoomLiveEvent,
|
||||
useOrgChat,
|
||||
type ChatDelivery,
|
||||
@@ -121,11 +122,7 @@ function closeMobileChat() {
|
||||
const mobileChatOpen = computed(() => Boolean(activeRoom.value));
|
||||
|
||||
function classifyPending(file: File): PendingAttach['kind'] {
|
||||
const mime = (file.type || '').toLowerCase();
|
||||
if (mime.startsWith('image/')) return 'image';
|
||||
if (mime.startsWith('audio/')) return 'voice';
|
||||
if (mime.startsWith('video/')) return 'video';
|
||||
return 'file';
|
||||
return classifyChatFile(file);
|
||||
}
|
||||
|
||||
function clearPendingAttaches() {
|
||||
@@ -220,7 +217,15 @@ async function toggleVoiceRecord() {
|
||||
const blob = new Blob(recordChunks, { type });
|
||||
recordChunks = [];
|
||||
const ext = type.includes('ogg') ? 'ogg' : type.includes('mp4') ? 'm4a' : 'webm';
|
||||
const file = new File([blob], `voice-${Date.now()}.${ext}`, { type });
|
||||
// Force audio/* so classify never treats MediaRecorder output as video
|
||||
const audioMime = type.startsWith('audio/')
|
||||
? type.split(';')[0]
|
||||
: ext === 'ogg'
|
||||
? 'audio/ogg'
|
||||
: ext === 'm4a'
|
||||
? 'audio/mp4'
|
||||
: 'audio/webm';
|
||||
const file = new File([blob], `voice-${Date.now()}.${ext}`, { type: audioMime });
|
||||
addFiles([file]);
|
||||
recordSecs.value = 0;
|
||||
};
|
||||
@@ -1045,13 +1050,17 @@ onUnmounted(() => {
|
||||
font-size: 0.9rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
.media-audio,
|
||||
.media-audio {
|
||||
display: block;
|
||||
width: min(280px, 72vw);
|
||||
max-width: 100%;
|
||||
height: 40px;
|
||||
border-radius: 20px;
|
||||
}
|
||||
.media-video {
|
||||
display: block;
|
||||
width: min(280px, 72vw);
|
||||
max-width: 100%;
|
||||
}
|
||||
.media-video {
|
||||
border-radius: 12px;
|
||||
background: #0f172a;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user