After initializing the stream, you need to publish it in the room so that the other users in the room can see and hear the user.  The methods to publish and unpublish a local stream are explained in this section.

Table of Contents

Publish Local Stream

The EnxRoom.publish() method publishes a local stream in the connected room. 

Class: EnxRoom

Method: - (void)publish:(EnxStream *)stream;


  • stream– Initiated Stream Object

Delegate Methods:

  • - room:didPublishStream: – Acknowledgment to the Stream publisher when the stream gets published.
  • - room:didAddedStream: – Notification to everyone in the Room when a new stream is published in the Room.
[room publish:localStream];

- (void)room:(EnxRoom *)room didPublishStream:(EnxStream *)stream{
	// Your stream is published

-(void)room:(EnxRoom *)room didAddedStream:(EnxStream *)stream{
	// Announcement of a new Stream in the Room
	// You may subscribe to the Stream

Error Codes / Exceptions

5013Failed to publish Stream.
5015Unable to publish a Stream without audio, video, and data.
5016Unable to publish a Stream with illegible attributes.
5022Failed to publish Stream because Floor Access not received in lecture mode room.
5023The Stream has already been published.
5024Repeated publish() call while Stream Publishing is in process.
5025Failed to publish stream because publish() call is made on a Remote Stream.
1170The current subscription doesn’t support the publishing of Stream.

Unpublish Local Stream

The EnxRoom.unpublish() method disconnects the local stream from the room. Unpublishing a stream does not release the device access so that subsequent republishing does not require device-access-permission. 

Class: EnxRoom

Method: - (void)unpublish;

Delegate Method: – room:didRemovedStream: – Notification to everyone in the Room when a Stream is removed from the Room.

[room unpublish]; // To unpublish all Local Streams

-(void)room:(EnxRoom *)room didRemovedStream:(EnxStream *)stream{
     // To announce in the room that a stream has been removed from the Room.

Error Codes / Exceptions

5029Repeated unpublish call made while the previous request is in process.
5030Non-Contextual use of method when the user tries to unpublish a stream before publishing it.