EnxStream


A Stream carries a different type of media. Audio, Video and/or Data. This stream gets transferred towards remote endpoints through Enablex Media Servers where it’s played and interacted with.

There are essentially 2 types of streams, viz.

  1. Local Stream: A Stream which a Client End Point initiates and transfers over the network.
  2. Remote Stream: A Stream which a Client End Point receives from others over the network.

Properties:

Type Description
streamId Enx stream Id.
isLocal To indicate about localStream object or not.
screen To Check stream is screen share stream or not.
streamsByStreamId EnxStream dictionary present in the room.
delegate EnxStreamDelegate were this stream will invoke methods as events.

Methods

Method Name Description
- muteSelfAudio: To mute/unmute published stream audio.
- muteSelfVideo: To stop/start published stream video.
- hardMuteVideo: To mute remote stream video. Only for moderator use.
- hardUnMuteVideo: To unmute remote stream video. Only for moderator use.
- hardMuteAudio: To mute remote stream audio. Only for moderator use.
- hardUnMuteAudio: To unmute remote stream audio. Only for moderator use.
- sendData: To send data at stream level.
- switchCamera To switch camera rear to front and vice-versa.
- hasAudio Indicates if the stream has audio tracks.
- hasVideo Indicates if the stream has video tracks.
- hasData Indicates if the stream has data activated.
- attachRenderer : To attach a stream on PlayerView.
- detachRenderer : To detach a stream from PlayerView.

Stream Delegates

Required Delegate Name Description
- didAudioEvents: This delegate called on perform audio actions on the streams.
- didVideoEvents: This delegate called on perform video actions on the streams.
- stream:didSelfMuteVideo: This delegate called when a self mute video alert participant received from server.
- stream:didSelfUnmuteVideo: This delegate called when a self unmute video alert participant received from server.
- stream:didSelfMuteAudio: This delegate called when a self mute audio alert participant received from server.
- stream:didSelfUnmuteAudio: This delegate called when a self unmute audio alert participant received from server.
Optional Delegate Name Description
- didReceiveData: This delegate called when receive data on the streams.

Hardmute Audio Delegates

Optional Delegate Description
- didhardMuteAudio: On Success of single user mute by moderator. This delegate method is for moderator.
- didhardUnMuteAudio: On Success of single user unmute by moderator. This delegate method is for moderator.
- didRecievedHardMutedAudio: On Success of single user mute by moderator. This delegate method is for participant.
- didRecievedHardUnmutedAudio: On Success of single user unmute by moderator. This delegate method is for participant.


Hardmute Video Delegates

Optional Delegate Description
- stream:didHardVideoMute: This delegate called when a hard mute video alert moderator received from server. This delegate is for moderator.
- stream:didHardVideoUnMute: This delegate called when a hard unmute video alert moderator received from server. This delegate is for moderator.
- stream:didReceivehardMuteVideo: This delegate called when a hard mute video alert participant received from server.
- stream:didReceivehardUnmuteVideo: This delegate called when a hard unmute video alert participant received from server.



Mute Self Audio

These API stop sending user Audio to the Room during the session. [localStream muteSelfAudio:true]; Parameter:
Parameter Description
true For mute self audio
false For un-mute self audio
Delegate (Optional). If you need to handle the success or failure of the action, then implement delegates methods for the same.
-(void)didAudioEvents:(NSDictionary *_Nullable)data; Callback : Receive all other users - (void)stream:(EnxStream *_Nullable)stream didSelfMuteAudio:(NSArray *_Nullable)data;

Where jsonObject is: { "result":0, "clientId":"0086645a-463b-4c72-ba1a-0b3c808b97c0", "msg":"user muted audio" }

Callback : Receive all other users - (void)stream:(EnxStream *_Nullable)stream didSelfUnmuteAudio:(NSArray *_Nullable)data;

Where jsonObject is: { "result":0, "clientId":"0086645a-463b-4c72-ba1a-0b3c808b97c0", "msg":"user muted audio" }



Stop Video

These API stop sending user Video to the Room during the session. [localStream muteSelfVideo:true]; Parameter :
Parameter Description
true For stop video
Delegate (Optional). If you need to handle the success or failure of the action, then implement delegates methods for the same.
-(void)didVideoEvents:( NSDictionary *_Nullable)data;
Callback : Receive all other users - (void)stream:(EnxStream *_Nullable)stream didSelfMuteVideo:(NSArray *_Nullable)data;

Where jsonObject is: { "result":0, "clientId":"0086645a-463b-4c72-ba1a-0b3c808b97c0", "msg":"user muted audio" }



Start Video

These API start sending user Video to the Room during the session. [localStream muteSelfVideo:false]; Parameter :
Parameter Description
false For start video
Delegate (Optional). If you need to handle the success or failure of the action, then implement delegates methods for the same.
-(void)didVideoEvents:( NSDictionary *_Nullable)data; Where videoTrack is a RTCVideoTrack object and localView is RTCEAGLVideoView object. Callback : Receive all other users - (void)stream:(EnxStream *_Nullable)stream didSelfUnmuteVideo:(NSArray *_Nullable)data;

Where jsonObject is: { "result":0, "clientId":"0086645a-463b-4c72-ba1a-0b3c808b97c0", "msg":"user muted audio" }





Send Data

These API is for to send data at stream level. -(NSException *)sendData:(NSDictionary *_Nonnull)data; Parameter: NSDictionary NSDictionary *dictionary = @{ @"from": @"John", @"message": @"Hi,How are you?", @"timestamp": @"" }; Return : NSException object.

Delegate to receive data

This delegate method will invoke when room receives data at stream level. -(void)stream:(EnxStream *_Nullable)stream didReceiveData:(NSDictionary *_Nullable)data; Parameter:
Parameter Description
EnxStream Stream Object on which data has received.
NSDictionary Contains received data json.
Where Data is: NSDictionary *dictionary = @{ @"from": @"John", @"message": @"Hi,How are you?", @"timestamp": @"" };

Switch Camera

To switch the camera while in the call use below method: -(void)switchCamera;


hardMuteVideo

mute single video stream.

Note: Hardmute functionality is only applicable to moderator.

API: - (void) hardMuteVideo : (NSString *_Nullable)clientId

Parameters : clientId is the participant who is being mute.

Moderator Delegate: - (void)stream : (EnxStream *_Nullable)stream didHardVideoMute :(NSArray *_Nullable)data

Fired when a hard mute video alert moderator received from server.

Parameters:

stream : Instance of the stream where event happen.

data : hardVideoMute info on a stream.

Response: { "result" : 0 }


Participant Delegate: - (void) stream : (EnxStream *_Nullable) stream didReceivehardMuteVideo: (NSArray *_Nullable) data

Fired when a hard mute video alert participant received from server.

Parameters:

stream : Instance of the stream where event happen.

data : Receive hard mute video info on a stream.

Response: { "clientId" : "633607dc-fa04-4a36-819b-c6a8aa1f49e8", "msg" : "user video hard muted", "result" : 0 }

hardUnMuteVideo

unmute single video stream.

Note: Hardmute functionality is only applicable to moderator.

API: -(void) hardUnMuteVideo : (NSString *_Nullable)clientId

Parameters : clientId is the participant who is being unmute.




Moderator Delegate: - (void) stream: (EnxStream *)stream didHardVideoUnMute : (NSArray *) data ;

Fired when a hard unmute video alert moderator received from server.

Parameters:

stream : Instance of the stream where event happen.

data : hardVideoUnmute info on a stream.

Response: { "result" : 0 }


Participant Delegate: - (void) stream : (EnxStream *_Nullable) stream didReceivehardUnmuteVideo : (NSArray *_Nullable) data

Fired when a hard unmute video alert participant received from server.

Parameters:

stream : Instance of the stream where event happen.

data : Receive hard unmute video info on a stream.

Response: { "clientId" : "633607dc-fa04-4a36-819b-c6a8aa1f49e8", "msg" : "user video hard unmuted", "result" : 0 }

Audio Mute/Unmute single user

By calling the below method moderator can mute single user.

-(void)hardMuteAudio:(NSString*)clientId;

where, clientId is the participant who is being muted on the floor.

There would be listener for participant and moderator when hardmute used by moderator. For this delegates are:




Moderator Delegates: -(void)didhardMuteAudio:(NSArray *)Data; Here, Data is result from Enablex Server on hardmute events.
Response: { "result" : 0 }


Paricipant Delegates: -(void)didRecievedHardMutedAudio:(NSArray *)Data; Here, Data is result from Enablex Server on hardmute events.
Response: { "clientId" = "c5500595-866d-4f4f-94f8-8f3624bbb486", "msg" = "user audio hard muted", "result" = 0 }

By calling the below method moderator can unmute single user.

-(void)hardUnMuteAudio:(NSString*)clientId;

where, clientId is the participant who is being unmuted on the floor.

There would be listener for participant and moderator when hardmute used by moderator. For this delegates are:




Moderator Delegates: -(void)didhardUnMuteAudio:(NSArray *)Data; Here, Data is result from Enablex Server on hardunmute events.
Response: { "result" : 0 }


Paricipant Delegates: -(void)didRecievedHardUnmutedAudio:(NSArray *)Data; Here, Data is result from Enablex Server on hardmute events.
Response: { "clientId" : "c5500595-866d-4f4f-94f8-8f3624bbb486", "msg" : "user audio hard unmuted", "result" : 0 }


hasAudio

Indicates if the media stream has audio tracks.

If you want to know if the stream was initializated requesting audio look into streamOptions dictionary.

- (BOOL) hasAudio Return : Boolean value.

hasVideo

Indicates if the media stream has video tracks.

If you want to know if the stream was initializated requesting video look into streamOptions dictionary.

- (BOOL) hasVideo Return : Boolean value.

hasData

Indicates if the stream has data activated.

- (BOOL) hasData Return : Boolean value.

attachRenderer

Attach EnxPlayerView with stream .

- (void)attachRenderer :(EnxPlayerView*)ObjEnxPlayerView;

detachRenderer

Detach EnxPlayerView with stream.

- (void)detachRenderer;