The local stream with audio/video needs to be started and published to the Room for other participants to see and hear you. Please use the API methods below to publish, unpublish and close local stream.

Table of Contents

Publish Local Stream

publish() method is used to publish a local stream to the connected Room. After the local stream is published to the Room, all participants are notified with an eent listener  onPublishedStream.

Method: static Future<void> publish()

Event Listener::

  • onPublishedStream – To the publisher that stream has been published.
EnxRtc.onRoomConnected = (Map<dynamic, dynamic> map) { 
	//Method calling   

EnxRtc.onPublishedStream = (Map<dynamic, dynamic> map) {

Unpublish Local Stream

To receive media streams of other participants connected to a Room, you must subscribe to the streams individually. Unless you subscribe a stream, you will not receive anything.

To unpublish, use unpublish() method. Please use the callback to handle if stream is unpublished successfully. All users connected to the room will be notified that a Published Stream is unpublished or removed from the Room using the callback named onSubscribeStream.

Method: static Future<void> subscribe(String streamId)


  • @param String streamId – Stream id to subscribe.

Event Listener:: onSubscribeStream- to all participants that a Stream is taken off the Room.

EnxRtc.onStreamAdded = (Map<dynamic, dynamic> map) {
	String streamId;
	setState(() {
		streamId = map['streamId'];

EnxRtc.onSubscribedStream= (Map<dynamic, dynamic> map) {