I am trying to record my live stream with Agoa Cloud Recording. It keeps in aws bucket, however I need it to give me mp4 file format, but I get m3u8 format. how to fix ?
This is doc
This is my code
async function startRecording(resourceId, channelName, token, uId) { try { const Authorization =
Basic ${ Buffer.from(${ REACT_APP_AGORA_CUSTOMER_KEY }:${ REACT_APP_AGORA_CUSTOMER_SECRET }
).toString("base64") }`;
const response = await axios.post(
`${ REACT_APP_AGORA_API_URL }${ REACT_APP_AGORA_APP_ID }/cloud_recording/resourceid/${ resourceId }/mode/mix/start`,
{
cname: channelName,
uid: uId,
clientRequest: {
token: '007eJxTYFis56zfwqsZ61umPjM+klfudPUJZdNf7vy3L8iaPj99eqYCg4GlhYVxkrmhaUpqkkmypVFiorG5uZFJqlmaWYqFqYnFpcqC1IZARoY7YscYGRkgEMTnZ8jNTC0uKcrXDXIJNzT1M2VgAADd+yDV',
recordingConfig: {
maxIdleTime: 30,
audioProfile: 1,
subscribeVideoUids: [],
subscribeAudioUids: [],
streamTypes: 2,
streamMode: "original",
channelType: 0,
videoStreamType: 0,
subscribeUidGroup: 0,
},
recordingFileConfig: {
avFileType: ["hls", "mp4"],
},
storageConfig: {
vendor: 1,
region: 3,
bucket: REACT_APP_AWS_BUCKET,
secretKey: REACT_APP_AWS_SECRET_KEY,
accessKey: REACT_APP_AWS_KEY,
fileNamePrefix: [
app.uuid,
"livestream",
],
},
},
},
{ headers: { Authorization, 'Content-Type': 'application/json' } }
);
const options = {
uid: uId,
sid: response.data.sid,
resourceId,
channelName,
token,
uniqId: user.uuid,
};
localStorage.setItem('items', JSON.stringify(options));
} catch (error) {
console.error("Error in startRecording:", error);
}
} `
I cannot get mp4 from this request. and this is my stop request
const realCallEnd = async () => { const Authorization =
Basic ${ Buffer.from(${ REACT_APP_AGORA_CUSTOMER_KEY }:${ REACT_APP_AGORA_CUSTOMER_SECRET }
).toString("base64") }; const resourceId = itemsInfo.resourceId; const sid = itemsInfo.sid; const url =
${ REACT_APP_AGORA_API_URL }${ REACT_APP_AGORA_APP_ID }/cloud_recording/resourceid/${ resourceId }/sid/${ sid }/mode/mix/stop`;
const cname = itemsInfo.channelName;
const uid = itemsInfo.uid;
// sessionStorage.removeItem('timer');
// endLiveStream(dataInfo.id).then(r => r.status >= 200 && history.push('/')).catch(() => toast.error('an error occurred'));
// localStorage.removeItem('live_stream_token_name');
try {
await axios.post(
url,
{
cname,
uid,
clientRequest: {
async_stop: true,
},
},
{ headers: { Authorization, 'Content-Type': 'application/json;charset=utf-8' } }
);
} catch (error) {
console.error('Error stopping recording:', error.response ? error.response.data : error.message);
}
}; `
How to fix this issue ?
I am trying to get mp4 format with m3u8, but I only get m3u8 format.