Agora 云录制不在 azure 中保存视频

Agora cloud recording not saving video in azure

static startRecording = async (resourceId, channelName, idsToUse) => {
        let startDateTime = Date.now();
        console.log("Total ID USER MAP Time = " + (Date.now() - startDateTime) / 1000);
        try {
            const request = {
                uid: '999',
                cname: `${channelName}`,
                clientRequest: {
                    token: EventService.getRecordingToken(channelName),//tocken of 999
                    recordingConfig: {
                        maxIdleTime: 120,
                        streamTypes: 2,
                        channelType: 0,
                        videoStreamType: 0,
                        subscribeVideoUids: [idsToUse.uId + ""],
                        subscribeAudioUids: [idsToUse.uId + ""],
                        subscribeUidGroup: 0
                    },
                    recordingFileConfig: {
                        avFileType: ["hls"]
                    },
                    storageConfig: {
                        accessKey: "ACCESS KEY",
                        region: 0,//The region parameter has no effect, whether or not it is set.(Ref:https://docs.agora.io/en/cloud-recording/cloud_recording_api_rest?platform=RESTful)
                        bucket: `azure-recordings/${channelName}`,
                        secretKey: "SECRET KEY",
                        vendor: 5
                    }
                }
            };
            console.log("agoraApiCallConfig", agoraApiCallConfig);
            console.log("req", request);
            const requestUrl = `${AgoraBaseUrl}/v1/apps/${AgoraAppID}/cloud_recording/resourceid/${resourceId}/mode/individual/start`;
            const start = Date.now();
            console.log("req--", requestUrl);
            const response = await axios.post(requestUrl, request, agoraApiCallConfig);

            const stop = Date.now();
            const elapsed = stop - start;

            //console.log("Total Start Recording Time = " + elapsed / 1000);
            console.log("response.data", response.data);
            if (response.status == 200 || response.status == 201) {
                return response.data;
            }
            log(response.data, "error");
            throw Error("Recording starting failed with status code: " + response.status);
        } catch (e) {
            appInsightLogHelper.trackException(e, 4);
            throw e;
        }
    };

这是我在 azure 中记录和存储数据的代码 谁能指导我为什么数据在 azure 中没有移动? 我将在我的应用程序上直播,然后尝试与机器人用户一起直播,然后将其存储在 Azure 存储容器中的 blob 服务中。

昨天我也在为 Agora.io 和 Azure 集成而苦苦挣扎,并且遇到了同样的麻烦。 询问他们的支持后,我了解到Azure存储帐户的storageConfig必须设置如下:

{
   vendor: 5,
   region = 0,
   accessKey = <storage account name>,
   secretKey = <access key>,
   bucket = <container name>,
   fileNamePrefix = ["directory", "subdirectory"]
}

因此,如果您想保存到名为“junaidstorageaccount”的存储帐户,在容器“azure-recordings”和目录 {channelName} 中,您应该使用的配置如下:

{
   vendor: 5,
   region: 0,
   accessKey: 'junaidstorageaccount',
   secretKey: <access key>,
   bucket: 'azure-recordings',
   fileNamePrefix: [channelName]
}

备注:

  • 区域未使用,您可以省略它或设置为任何值,我更喜欢设置为零
  • 替换为存储帐户的访问密钥
  • fileNamePrefix:一个数组,表示存储文件的目录路径。所以如果你想在 my/beautiful/directory 中存储文件,你必须通过 ['my'、'beautiful'、'directory']

根据 Agora 文档(https://docs.agora.io/en/cloud-recording/integration_best_practices?platform=RESTful#a-namestart_successaensure-the-recording-service-starts-successfully),您应该在调用 start 之后调用 query 检查录音状态(应该是 4 或 5),并继续检查所有记录持续时间,间隔小于 maxIdleTime。

祝你好运!