toast error when recording save failed

This commit is contained in:
an-lee
2024-02-20 09:05:40 +08:00
parent 650a00b6a4
commit ce49b68ba3
3 changed files with 11 additions and 4 deletions

View File

@@ -460,5 +460,6 @@
"preparingVideo": "Preparing video",
"itMayTakeAWhileToPrepareForTheFirstLoad": "It may take a while to prepare for the first load. Please be patient.",
"loadingTranscription": "Loading transcription",
"cannotFindMicrophone": "Cannot find microphone"
"cannotFindMicrophone": "Cannot find microphone",
"failedToSaveRecording": "Failed to save recording"
}

View File

@@ -459,5 +459,6 @@
"preparingVideo": "正在准备视频",
"itMayTakeAWhileToPrepareForTheFirstLoad": "首次加载可能需要一些时间,请耐心等候",
"loadingTranscription": "正在加载语音文本",
"cannotFindMicrophone": "无法找到麦克风"
"cannotFindMicrophone": "无法找到麦克风",
"failedToSaveRecording": "保存录音失败"
}

View File

@@ -140,8 +140,13 @@ const RecordButtonPopover = (props: {
record.on("record-end", async (blob: Blob) => {
const duration = Date.now() - startAt;
const output = await transcode(blob);
props.onRecordEnd(output, duration);
try {
const output = await transcode(blob);
props.onRecordEnd(output, duration);
} catch (e) {
console.error(e);
toast.error(t("failedToSaveRecording"));
}
});
RecordPlugin.getAvailableAudioDevices()