From e063a825b58548f89bcf36cd4c3ea5b171363fdc Mon Sep 17 00:00:00 2001 From: yj <1336058017@qq.com> Date: Tue, 16 Jul 2024 15:44:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BD=95=E5=88=B6=E6=8F=90=E7=A4=BA=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/package/agora.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/utils/package/agora.ts b/src/utils/package/agora.ts index dd122a9..4981839 100644 --- a/src/utils/package/agora.ts +++ b/src/utils/package/agora.ts @@ -205,7 +205,7 @@ const agora = { iMediaRecorder = "" }, // 开始录制音视频 - startRecording: (uid:number) => { + startRecording: (uid: number) => { iMediaRecorder = rtcEngine.createMediaRecorder({ channelId: option.channelId, uid, @@ -213,11 +213,21 @@ const agora = { iMediaRecorder.setMediaRecorderObserver({ // 录制状态发生改变回调。 onRecorderStateChanged: (channelId: any, uid: any, state: any, reason: any) => { - console.log(channelId, uid, state, reason, '录制状态发生改变回调。'); + switch (reason) { + case 1: + message.error('录制文件写入失败') + break; + case 2: + message.error('没有可录制的音视频流或者录制的音视频流中断超过 5 秒') + break; + case 3: + message.error('录制时长超出上限') + break; + } }, // 录制信息更新回调。 onRecorderInfoUpdated: (channelId: any, uid: any, info: any) => { - console.log(channelId, uid, info, '录制信息更新回调。'); + message.success(`文件已保存至${info.fileName}`) }, }) iMediaRecorder.startRecording({