Agora 云录制未在 azure 中保存视频
Posted
技术标签:
【中文标题】Agora 云录制未在 azure 中保存视频【英文标题】:Agora cloud recording not saving video in azure 【发布时间】:2021-11-27 07:23:11 【问题描述】: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 服务中。
【问题讨论】:
【参考方案1】:就在昨天,我也在为 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]
注意事项:
region 未使用,可以省略或设置为任何值,我更喜欢设置为零 替换为存储帐户的访问密钥 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。
祝你好运!
【讨论】:
以上是关于Agora 云录制未在 azure 中保存视频的主要内容,如果未能解决你的问题,请参考以下文章
Agora 云录制无法正常工作。正常启动和获取工作,但是我没有得到任何视频文件并查询和停止返回错误404
如何在 Flutter 中实现 Agora 云录制 api?