-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathagoraApi.js
32 lines (30 loc) · 916 Bytes
/
agoraApi.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const axios = require("axios");
const getAgoraResourceId = async (req, res) => {
//const { appId } = req.body;
const appId = "85bdc13bd8584ec7a515cfd4c7a81e7f";
const channelName = "test";
const agoraUserId = "556611605";
const Authorization =
"Basic Zjc0ZDZmZDM5NTUwNDczNDg4Zjc2ZDA1Y2Q5ODAwYmU6OGQyZGRiMGUyNGQwNGY0OGFkNjVjNzRhMTM5MTZhMjQ=";
try {
const ResourceIdResponse = await axios.post(
`https://api.agora.io/v1/apps/${appId}/cloud_recording/acquire`,
{
cname: channelName,
uid: agoraUserId,
clientRequest: {
resourceExpiredHour: 24,
},
},
{ headers: { Authorization } }
);
//console.log(ResourceIdResponse.data);
res.json(ResourceIdResponse.data);
} catch (error) {
console.log(" error", error);
res.status(500).json({ error: "something Wrong" });
}
};
module.exports = {
getAgoraResourceId,
};