Class DisconnectSendTransportAudio

Disconnects the send transport for audio by pausing the audio producer and updating the UI accordingly.

This function supports both a primary and a local audio producer, delegating local handling to a separate function.

The options for disconnecting the send transport for audio.

The parameters for disconnecting the send transport for audio.

The primary audio producer to disconnect.

The local audio producer to disconnect.

The socket instance to use for communication.

The local socket instance to use for communication.

Flag indicating if video is already on.

The level of the user.

Flag indicating if the screen is locked.

Flag indicating if the screen is shared.

Flag to update the main window.

The label for the host user.

The name of the room.

Function to update the audio producer.

Function to update the local audio producer (optional).

Function to update the main window state.

Function to prepopulate user media.

The parameters required for disconnecting the send transport for audio.

A promise that resolves when the send transport for audio is disconnected.

Will throw an error if the operation fails.

const options = {
parameters: {
audioProducer: audioProducerInstance,
localAudioProducer: localAudioProducerInstance,
socket: socketInstance,
localSocket: localSocketInstance,
videoAlreadyOn: false,
islevel: '1',
lock_screen: false,
shared: false,
updateMainWindow: true,
hostLabel: 'Host',
roomName: 'Room 1',
updateAudioProducer: (producer) => console.log('Updated audio producer:', producer),
updateLocalAudioProducer: (producer) => console.log('Updated local audio producer:', producer),
updateUpdateMainWindow: (state) => console.log('Main window state updated:', state),
prepopulateUserMedia: async ({ name, parameters }) => console.log('Prepopulating user media for', name),
},
};

disconnectSendTransportAudio(options)
.then(() => console.log("Audio send transport disconnected successfully"))
.catch((error) => console.log("Error disconnecting audio send transport:", error));

Constructors

Methods

  • Disconnects the send transport for audio by pausing the audio producer and updating the UI accordingly.

    This function supports both a primary and a local audio producer, delegating local handling to a separate function.

    Parameters

    Returns Promise<void>

    A promise that resolves when the send transport for audio is disconnected.

    Will throw an error if the operation fails.

    const options = {
    parameters: {
    audioProducer: audioProducerInstance,
    localAudioProducer: localAudioProducerInstance,
    socket: socketInstance,
    localSocket: localSocketInstance,
    videoAlreadyOn: false,
    islevel: '1',
    lock_screen: false,
    shared: false,
    updateMainWindow: true,
    hostLabel: 'Host',
    roomName: 'Room 1',
    updateAudioProducer: (producer) => console.log('Updated audio producer:', producer),
    updateLocalAudioProducer: (producer) => console.log('Updated local audio producer:', producer),
    updateUpdateMainWindow: (state) => console.log('Main window state updated:', state),
    prepopulateUserMedia: async ({ name, parameters }) => console.log('Prepopulating user media for', name),
    },
    };

    disconnectSendTransportAudio(options)
    .then(() => console.log("Audio send transport disconnected successfully"))
    .catch((error) => console.log("Error disconnecting audio send transport:", error));