Creates a WebRTC send transport and sets up event handlers for the transport.
Supports both primary and local transports with modular handling.
The options for creating the send transport.
A promise that resolves when the send transport is created and configured.
const options = {
option: 'video',
parameters: {
islevel: '1',
member: 'John Doe',
socket: socketInstance,
localSocket: localSocketInstance,
device: deviceInstance,
producerTransport: null,
localProducerTransport: null,
transportCreated: false,
localTransportCreated: false,
updateProducerTransport: (transport) => console.log('Primary transport updated:', transport),
updateLocalProducerTransport: (transport) => console.log('Local transport updated:', transport),
updateTransportCreated: (state) => console.log('Primary transport created:', state),
updateLocalTransportCreated: (state) => console.log('Local transport created:', state),
},
};
createSendTransport(options)
.then(() => console.log('Send transport created successfully'))
.catch((error) => console.error('Error creating send transport:', error));
Creates a WebRTC send transport and sets up event handlers for the transport.
Supports both primary and local transports with modular handling.
Param: options
The options for creating the send transport.
Param: options.option
The type of transport to create.
Param: options.parameters
The parameters required for creating the transport.
Param: options.parameters.islevel
The level of the transport.
Param: options.parameters.member
The member name for the transport.
Param: options.parameters.socket
The primary socket instance.
Param: options.parameters.device
The device instance.
Param: options.parameters.producerTransport
The primary producer transport object.
Param: options.parameters.transportCreated
The state of the primary transport creation.
Param: options.parameters.updateProducerTransport
The function to update the primary transport object.
Param: options.parameters.updateTransportCreated
The function to update the primary transport creation state.
Param: options.parameters.connectSendTransport
The function to connect the send transport.
Param: options.parameters.getUpdatedAllParams
The function to get updated parameters.
Param: options.parameters.localSocket
The local socket instance.
Param: options.parameters.localProducerTransport
The local producer transport object.
Param: options.parameters.localTransportCreated
The state of the local transport creation.
Param: options.parameters.updateLocalProducerTransport
The function to update the local transport object.
Param: options.parameters.updateLocalTransportCreated
The function to update the local transport creation state.
Returns
A promise that resolves when the send transport is created and configured.
Throws
Will throw an error if there is an issue creating the send transport.
Example