The EnxRoom.subscribe() method is used to receive the media stream of other users connected to the Room. You must call this method for each participant’s media stream individually to receive it. 

You don’t need to subscribe to your Local Stream as EnableX facilitates the publisher to receive their own Screen Sharing and Canvas Streaming without explicitly subscribing to it. In short, a user must only subscribe to the Remote Streams in the Room. 

Refer to Handle Active Talkers section below for more details.

Class: EnxRoom

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

Parameters: stream – The Stream object that needs to be subscribed.

Delegate Method:

room:didSubscribeStream:  – Acknowledgment to the subscriber when they have subscribed to the Stream successfully.

// There is a new stream you may subscribe
-(void)room:(EnxRoom *)room didAddedStream:(EnxStream *)stream{
	[room subscribe:stream]; // Subscribe to it.
}

- (void)room:(EnxRoom *)room didSubscribeStream:(EnxStream *)stream {
	// You subscribed to stream.
}

Error Codes / Exceptions

CodeDescription
5014Failed to subscribe to the Stream.
5026Stream has already been subscribed.
5027Repeated subscribe() call made while a previous subscription request is in process.
5028Failed to subscribe because subscribe() call is made on the Local Stream.