LH-276: Add close-producer event handler; Update client #30
14
app.js
14
app.js
@ -498,6 +498,7 @@ const consumeVideo = async ({ callId, socketId, rtpCapabilities }) => {
|
||||
};
|
||||
|
||||
const consumeAudio = async ({ callId, socketId, rtpCapabilities }) => {
|
||||
try {
|
||||
// Handlers for consumer transport https://mediasoup.org/documentation/v3/mediasoup/api/#consumer-on-transportclose
|
||||
if (isInitiator(callId, socketId)) {
|
||||
const producerId = videoCalls[callId].receiverAudioProducer.id;
|
||||
@ -508,13 +509,14 @@ const consumeAudio = async ({ callId, socketId, rtpCapabilities }) => {
|
||||
rtpCapabilities,
|
||||
paused: true,
|
||||
});
|
||||
|
||||
return {
|
||||
const returnData = {
|
||||
id: videoCalls[callId].initiatorConsumerAudio.id,
|
||||
producerId,
|
||||
kind: 'audio',
|
||||
rtpParameters: videoCalls[callId].initiatorConsumerAudio.rtpParameters,
|
||||
};
|
||||
console.log('audio returnData', returnData);
|
||||
return returnData;
|
||||
} else {
|
||||
const producerId = videoCalls[callId].initiatorAudioProducer.id;
|
||||
if (!canConsume({ callId, producerId, rtpCapabilities })) return null;
|
||||
@ -524,13 +526,17 @@ const consumeAudio = async ({ callId, socketId, rtpCapabilities }) => {
|
||||
rtpCapabilities,
|
||||
paused: true,
|
||||
});
|
||||
|
||||
return {
|
||||
const returnData = {
|
||||
id: videoCalls[callId].receiverConsumerAudio.id,
|
||||
producerId,
|
||||
kind: 'audio',
|
||||
rtpParameters: videoCalls[callId].receiverConsumerAudio.rtpParameters,
|
||||
};
|
||||
console.log('audio returnData', returnData);
|
||||
return returnData;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`[consumeAudio] | ERROR | error: ${error.message}`)
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user