优化录制结束提示

This commit is contained in:
yj 2024-08-23 15:50:57 +08:00
parent a10d357274
commit f4eceacfe9
1 changed files with 17 additions and 14 deletions

View File

@ -484,21 +484,24 @@ const Meeting: React.FC = () => {
const setting = await JSON.parse(storage.getItem('setting') as string)
const buffer = Buffer.from(reader.result);
await fs.writeFile(`${setting.recordingFilesPath}${state.roomName}_${state.channelId}_${+new Date()}.mp4`, buffer, {});
message.success(`录制成功!文件已保存至:${setting.recordingFilesPath}`)
try {
await fs.access(setting.recordingFilesPath, fs.constants.F_OK);
if (process.platform === 'win32') {
exec(`explorer "${setting.recordingFilesPath}"`);
} else if (process.platform === 'darwin') {
exec(`open "${setting.recordingFilesPath}"`);
confirm({
title: '提示',
icon: <ExclamationCircleFilled />,
content: `录制成功!文件已保存至:${setting.recordingFilesPath}`,
centered: true,
okText: '打开文件夹',
cancelText: '关闭',
async onOk() {
await fs.access(setting.recordingFilesPath, fs.constants.F_OK);
if (process.platform === 'win32') {
exec(`explorer "${setting.recordingFilesPath}"`);
} else if (process.platform === 'darwin') {
exec(`open "${setting.recordingFilesPath}"`);
}
},
onCancel() {
}
} catch (error: any) {
if (error.code === 'ENOENT') {
message.error('文件夹不存在!')
} else {
message.error(error)
}
}
})
};
reader.readAsArrayBuffer(blob);
}