Sets up and connects a screen sharing transport for sending video streams.
This function supports both a primary and a local screen producer, delegating local handling to a separate function.
The configuration options for setting up the screen transport.
await connectSendTransportScreen({
stream: screenStream,
targetOption: "all",
parameters: {
screenProducer: null,
localScreenProducer: null,
device: mediaDevice,
screenParams: { encodings: [{ maxBitrate: 1500000 }] },
producerTransport: sendTransport,
localProducerTransport: localSendTransport,
params: { track: screenStream.getVideoTracks()[0] },
updateScreenProducer: setScreenProducer,
updateLocalScreenProducer: setLocalScreenProducer,
updateProducerTransport: setProducerTransport,
updateLocalProducerTransport: setLocalProducerTransport,
getUpdatedAllParams: getParams,
},
});
Sets up and connects a screen sharing transport for sending video streams.
This function supports both a primary and a local screen producer, delegating local handling to a separate function.
Param: options
The configuration options for setting up the screen transport.
Param: options.targetOption
The target option for connecting the transport.
Param: options.stream
The screen stream to be shared.
Param: options.parameters
The parameters required for setting up the screen transport.
Param: options.parameters.screenProducer
The screen producer object to be updated.
Param: options.parameters.device
The device object for media capabilities.
Param: options.parameters.screenParams
The parameters for the screen producer.
Param: options.parameters.producerTransport
The producer transport object.
Param: options.parameters.params
The parameters for the producer.
Param: options.parameters.updateScreenProducer
The function to update the screen producer object.
Param: options.parameters.updateProducerTransport
The function to update the producer transport object.
Param: options.parameters.updateLocalScreenProducer
The function to update the local screen producer object.
Param: options.parameters.updateLocalProducerTransport
The function to update the local producer transport object.
Param: options.parameters.getUpdatedAllParams
The function to get updated parameters.
Param: options.parameters.*
Additional parameters for future use.
Returns
Throws
Will throw an error if there is an issue with the connection or setup process.
Example