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

NameTypeDescription
peerIdstringThe peer ID of the Remote Peer to consume from.
labelstringThe label of the stream to be consumed.
appDataAppData (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

NameTypeDescription
peerIdstringThe peer ID of the Remote Peer.
labelstringThe 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'
);
Audio/Video Infrastructure designed for developers to empower them to ship simple yet powerful Audio/Video Apps.
support
company
Copyright © 2024 Graphene 01, Inc. All Rights Reserved.