Hello Team,
I’ve been getting an error when I tried downloading recorded meeting from Zoom.
See the detailed explanation below.
- When I tried to download the recorded file, the downloaded is successful but file is empty and it is 0KB. But the Original file size is about 3 MB.
Programming language and Framework: NODE
Authentication method: OAuth
Errors: There is no error logged
exports.addZoomRecordingToIntaviewer = asyncHandler(async (req, res, next) => {
const { token } = req.body;
const { meetingId } = req.params;
const user = req.user;
const url = `https://api.zoom.us/v2/meetings/${meetingId}/recordings`;
const meetingData = await axios.get(url, {
headers: {
Authorization: `Bearer ${token}`,
},
});
if (!meetingData) {
return next(new ErrorResponse("Meeting Does Not Exists", 403));
}
const meeting = meetingData.data;
const { id, recording_files, duration } = meeting;
const urlDown = `${recording_files[0].download_url}?access_token=${token}`;
function downloadFile(downloadUrl, name) {
const req = https.get(downloadUrl, function (res) {
const fileStream = fs.createWriteStream(`zoomer/${name}.mp4`);
res.pipe(fileStream);
fileStream.on("error", function (err) {
console.log("Error writing to the stream");
console.log(err);
});
fileStream.on("finish", function () {
fileStream.close();
console.log("done");
});
});
req.on("error", function (err) {
console.log("Error http request");
console.log(err);
});
}
downloadFile(urlDown, id);
});