Connects the send transport for audio by producing audio data and updating the audio producer and producer transport objects.
The options for connecting the send transport.
A promise that resolves when the connection is established.
const options = {
audioParams: { codec: 'opus' },
parameters: {
audioProducer: null,
producerTransport: transport,
updateAudioProducer: (producer) => { console.log(updated) },
updateProducerTransport: (transport) => { console.log(updated) },
updateLocalAudioProducer: (localProducer) => { console.log(updated) },
updateLocalProducerTransport: (localTransport) => { console.log(updated) },
},
};
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.
Param: options
The parameters for connecting the send transport.
Param: options.audioParams
The options for the audio producer.
Param: options.parameters
The parameters containing the audio producer, producer transport, and update functions.
Param: options.parameters.audioProducer
The current audio producer.
Param: options.parameters.producerTransport
The transport used to produce audio data.
Param: options.parameters.updateAudioProducer
Function to update the audio producer.
Param: options.parameters.updateProducerTransport
Function to update the producer transport.
Param: options.parameters.updateLocalAudioProducer
Function to update the local audio producer.
Param: options.parameters.updateLocalProducerTransport
Function to update the local producer transport.
Param: options.parameters.updateAudioLevel
Function to update the audio level.
Returns
A promise that resolves when the audio transport is successfully connected.
Throws
Will throw an error if the connection fails.
Example