Handles the switching of the audio stream upon successful stream connection.
const options = { stream: newAudioStream, // MediaStream object containing the new audio track parameters: { audioProducer: currentAudioProducer, localAudioProducer: localAudioProducerInstance, localSocket: localSocketInstance, socket: socketInstance, roomName: 'Room1', localStream: null, localStreamAudio: null, audioParams: audioProducerOptions, audioPaused: false, audioAlreadyOn: true, transportCreated: false, audioParamse: additionalAudioParams, defAudioID: 'default-audio-device-id', userDefaultAudioInputDevice: 'user-input-device-id', hostLabel: 'Host', islevel: '1', videoAlreadyOn: false, lock_screen: false, shared: false, updateAudioProducer: updateAudioProducerFunction, updateLocalAudioProducer: updateLocalAudioProducerFunction, updateLocalStream: updateLocalStreamFunction, updateAudioParams: updateAudioParamsFunction, updateDefAudioID: updateDefAudioIDFunction, updateUserDefaultAudioInputDevice: updateUserDefaultAudioInputDeviceFunction, updateUpdateMainWindow: updateMainWindowFunction, sleep: sleepFunction, prepopulateUserMedia: prepopulateUserMediaFunction, createSendTransport: createSendTransportFunction, connectSendTransportAudio: connectSendTransportAudioFunction, },};streamSuccessAudioSwitch(options) .then(() => { console.log('Audio stream switched successfully'); }) .catch(error => { console.error('Error switching audio stream:', error); }); Copy
const options = { stream: newAudioStream, // MediaStream object containing the new audio track parameters: { audioProducer: currentAudioProducer, localAudioProducer: localAudioProducerInstance, localSocket: localSocketInstance, socket: socketInstance, roomName: 'Room1', localStream: null, localStreamAudio: null, audioParams: audioProducerOptions, audioPaused: false, audioAlreadyOn: true, transportCreated: false, audioParamse: additionalAudioParams, defAudioID: 'default-audio-device-id', userDefaultAudioInputDevice: 'user-input-device-id', hostLabel: 'Host', islevel: '1', videoAlreadyOn: false, lock_screen: false, shared: false, updateAudioProducer: updateAudioProducerFunction, updateLocalAudioProducer: updateLocalAudioProducerFunction, updateLocalStream: updateLocalStreamFunction, updateAudioParams: updateAudioParamsFunction, updateDefAudioID: updateDefAudioIDFunction, updateUserDefaultAudioInputDevice: updateUserDefaultAudioInputDeviceFunction, updateUpdateMainWindow: updateMainWindowFunction, sleep: sleepFunction, prepopulateUserMedia: prepopulateUserMediaFunction, createSendTransport: createSendTransportFunction, connectSendTransportAudio: connectSendTransportAudioFunction, },};streamSuccessAudioSwitch(options) .then(() => { console.log('Audio stream switched successfully'); }) .catch(error => { console.error('Error switching audio stream:', error); });
The options for the audio stream success switch.
A promise that resolves when the audio stream switch is complete.
Handles the switching of the audio stream upon successful stream connection.
Example