Produce
The produce
method allows the Local Peer to produce a media stream with a given label and associated application data to share with all Remote Peers.
Parameters
Name | Type | Description |
---|---|---|
label | string | A unique identifier for the stream |
stream | MediaStream | The media stream to produce |
stopTrackOnClose | boolean (optional) | Stops the track when the producer is closed |
appData | Object (optional) | Application-level custom data which can be added to the producer for the Local Peer. This data will be available in the producer object and can be used only by the Local Peer. |
Example
const producer = await huddleClient.localPeer.produce({ label: "video", stream: mediaStream, appData: { key: "value" } });
Stop Producing
The stopProducing
method allows the Local Peer to stop producing a media stream with a given label.
Parameters
Name | Type | Description |
---|---|---|
label | string | A unique identifier for the stream |
Example
const producer = await huddleClient.localPeer.stopProducing({ label: "video" });
Events
Name | Description | Returns |
---|---|---|
new-producer | Emitted when a new producer is created | { label: string; producer: Producer } |