Connects the receiving transport to consume media from a remote producer.
The options for connecting the receiving transport.
A promise that resolves when the connection is established.
const options = {
consumerTransport,
remoteProducerId: 'producer-id',
serverConsumerTransportId: 'transport-id',
nsock: socket,
parameters: connectRecvTransportOptions,
};
connectRecvTransport(options)
.then(() => {
console.log('Transport connected and consuming media');
})
.catch((error) => {
console.error('Error connecting transport:', error);
});
Connects the receiving transport to consume media from a remote producer.
Param: options
The options for connecting the receiving transport.
Param: options.consumerTransport
The transport used for consuming media.
Param: options.remoteProducerId
The ID of the remote producer.
Param: options.serverConsumerTransportId
The ID of the server consumer transport.
Param: options.nsock
The socket used for communication.
Param: options.parameters
The parameters for the connection.
Returns
A promise that resolves when the connection is established.
Throws
Will throw an error if the connection or consumption fails.
Example