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.
A promise that resolves when the send transport for audio is disconnected.
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));
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.
Param: options
The options for disconnecting the send transport for audio.
Param: options.parameters
The parameters for disconnecting the send transport for audio.
Param: options.parameters.audioProducer
The primary audio producer to disconnect.
Param: options.parameters.localAudioProducer
The local audio producer to disconnect.
Param: options.parameters.socket
The socket instance to use for communication.
Param: options.parameters.localSocket
The local socket instance to use for communication.
Param: options.parameters.videoAlreadyOn
Flag indicating if video is already on.
Param: options.parameters.islevel
The level of the user.
Param: options.parameters.lock_screen
Flag indicating if the screen is locked.
Param: options.parameters.shared
Flag indicating if the screen is shared.
Param: options.parameters.updateMainWindow
Flag to update the main window.
Param: options.parameters.hostLabel
The label for the host user.
Param: options.parameters.roomName
The name of the room.
Param: options.parameters.updateAudioProducer
Function to update the audio producer.
Param: options.parameters.updateLocalAudioProducer
Function to update the local audio producer (optional).
Param: options.parameters.updateUpdateMainWindow
Function to update the main window state.
Param: options.parameters.prepopulateUserMedia
Function to prepopulate user media.
Param: options.parameters
The parameters required for disconnecting the send transport for audio.
Returns
A promise that resolves when the send transport for audio is disconnected.
Throws
Will throw an error if the operation fails.
Example