Reputation: 17
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;
}
};
this is my code for recording and storing data in azure can anyone guide me why the data is not moving in azure? I am going live on my app and then I try to record that live with a bot user and then store that in blob service in azure storage container.
Upvotes: 1
Views: 692
Reputation: 2342
I too was struggling with Agora.io and Azure integration just yesterday, and had same-ish troubles. After asking their support, I came to understand that storageConfig for Azure Storage Account must be set as follows:
{
vendor: 5,
region = 0,
accessKey = <storage account name>,
secretKey = <access key>,
bucket = <container name>,
fileNamePrefix = ["directory", "subdirectory"]
}
Therefore if you want to save to storage account named "junaidstorageaccount", in container "azure-recordings" and directory {channelName}, the config you should use would be as follows:
{
vendor: 5,
region: 0,
accessKey: 'junaidstorageaccount',
secretKey: <access key>,
bucket: 'azure-recordings',
fileNamePrefix: [channelName]
}
Notes:
As per Agora documentation (https://docs.agora.io/en/cloud-recording/integration_best_practices?platform=RESTful#a-namestart_successaensure-the-recording-service-starts-successfully), you should call query
after calling start
to check the recording status (it should be 4 or 5), and keep checking for all the recording duration, at intervals less than maxIdleTime.
Wishing you best of luck!
Upvotes: 3