LH-276: Fix audio when initiator is not set yet(at start)
This commit is contained in:
parent
29a4cd7227
commit
9b3f2f94c8
12
app.js
12
app.js
@ -500,11 +500,11 @@ 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)) {
|
||||
if (isInitiator(callId, socketId) && videoCalls[callId].receiverAudioProducer) {
|
||||
console.log('1videoCalls[callId].receiverAudioProducer', videoCalls[callId].receiverAudioProducer);
|
||||
const producerId = videoCalls[callId].receiverAudioProducer.id;
|
||||
if (!canConsume({ callId, producerId, rtpCapabilities })) return null;
|
||||
|
||||
|
||||
videoCalls[callId].initiatorConsumerAudio = await videoCalls[callId].initiatorConsumerTransport.consume({
|
||||
producerId,
|
||||
rtpCapabilities,
|
||||
@ -518,11 +518,11 @@ const consumeAudio = async ({ callId, socketId, rtpCapabilities }) => {
|
||||
};
|
||||
console.log('audio returnData', returnData);
|
||||
return returnData;
|
||||
} else {
|
||||
} else if (videoCalls[callId].initiatorAudioProducer) {
|
||||
console.log('2videoCalls[callId].initiatorAudioProducer', videoCalls[callId].initiatorAudioProducer);
|
||||
const producerId = videoCalls[callId].initiatorAudioProducer.id;
|
||||
if (!canConsume({ callId, producerId, rtpCapabilities })) return null;
|
||||
|
||||
|
||||
videoCalls[callId].receiverConsumerAudio = await videoCalls[callId].receiverConsumerTransport.consume({
|
||||
producerId,
|
||||
rtpCapabilities,
|
||||
@ -536,9 +536,11 @@ const consumeAudio = async ({ callId, socketId, rtpCapabilities }) => {
|
||||
};
|
||||
console.log('audio returnData', returnData);
|
||||
return returnData;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`[consumeAudio] | ERROR | error: ${error}`)
|
||||
console.error(`[consumeAudio] | ERROR | error: ${error}`);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user