Consume
The consume
method allows the Local Peer to consume a stream from a Remote Peer. This method receives the producerId
, peerId
, and optional application data.
The consumed stream can be played on the Local Peer's device.
Parameters
Name | Type | Description |
---|---|---|
peerId | string | The peer ID of the Remote Peer to consume from. |
label | string | The label of the stream to be consumed. |
appData | AppData (optional) | Custom application data for the consumer. |
Example
// Consume a stream from a Remote Peer
final stream = await localPeer.consume({
'peerId': "remotePeerID",
'label': "streamLabel",
'appData': { "key": "value" },
});
Stop Consuming
The stopConsuming method stops the Local Peer from consuming a specific stream with a given label. It does not notify Remote Peers about stopping the consumption.
Parameters
Name | Type | Description |
---|---|---|
peerId | string | The peer ID of the Remote Peer. |
label | string | The label of the stream to stop consuming. |
Example
// Stop consuming a specific stream
await huddleClient.localPeer.stopConsuming(
remotePeerID,
streamLabel, // stream label can be 'video', 'audio', 'screen'
);