Const
The function to update the producer transport object.
The function to update the local audio producer object.
The function to update the local producer transport object.
const options = {
audioParams: { codec: 'opus', maxBitrate: 128000 },
parameters: {
audioProducer: null,
producerTransport: transport,
localAudioProducer: null,
localProducerTransport: localTransport,
updateAudioProducer: (producer) => console.log('Updated producer:', producer),
updateProducerTransport: (transport) => console.log('Updated transport:', transport),
updateLocalAudioProducer: (localProducer) => console.log('Updated local producer:', localProducer),
updateLocalProducerTransport: (localTransport) => console.log('Updated local transport:', localTransport),
updateAudioLevel: (level) => console.log('Updated audio level:', level),
},
};
connectSendTransportAudio(options)
.then(() => console.log('Audio transport connected successfully'))
.catch((error) => console.error('Error connecting audio transport:', error));
Connects the send transport for audio by producing audio data and updating the audio producer and producer transport objects.
If the primary connection fails, it attempts to connect using the local transport via a separate function.