stopConsuming method
Stops the underlying consuming of a stream for a particular label NOTE: This does not notify the remote peers that you are not consuming a stream
Implementation
void stopConsuming(String peerId, String label) {
final remotePeer = room.getRemotePeerById(peerId);
if (!remotePeer.hasLabel(label)) {
logger.e('❌ Remote Peer is not producing anything with label: $label');
return;
}
Consumer? consumer = getConsumer(label: label, peerId: peerId);
if (consumer == null) {
logger.e('❌ Consumer Not Found');
return;
}
socket.publish(Request_Request.closeConsumer, {
'consumerId': consumer.id,
});
remotePeer.emit('stream-closed', {
'label': label,
});
closeConsumer(label, peerId);
}