Class ConnectSendTransportAudio

Connects the send transport for audio by producing audio data and updating the audio producer and producer transport objects.

The parameters for connecting the send transport.

The options for the audio producer.

The parameters containing the audio producer, producer transport, and update functions.

The current audio producer.

The transport used to produce audio data.

Function to update the audio producer.

Function to update the producer transport.

Function to update the local audio producer.

Function to update the local producer transport.

Function to update the audio level.

A promise that resolves when the audio transport is successfully connected.

Will throw an error if the connection fails.

const audioParams: ProducerOptions = {
codec: 'opus',
// other options
};

const 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) },
* updateAudioLevel: (level) => { console.log(level) },
* };
*
* connectSendTransportAudio({ audioParams, parameters })
* .then(() => {
* console.log('Audio transport connected successfully');
* })
* .catch((error) => {
* console.error('Error connecting audio transport:', error);
* });
*

Constructors

Methods

  • Connects the send transport for audio by producing audio data and updating the audio producer and producer transport objects.

    Parameters

    Returns Promise<void>

    A promise that resolves when the connection is established.

    Will throw an error if the connection fails.

    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);
    });