Table of Contents
Initiate Local Stream
The EnxRoom.getLocalStream()
method is used to initialize a local stream at the Client endpoint before it can be published to the Room. The initialization process comprises specifying media tracks, adding custom attributes, etc. in the form of a JSON object passed as a parameter to the method.
Class: EnxRoom
Method: public EnxStream getLocalStream( JSONObject publishStreamInfo )
Parameters: publishStreamInfo -
A JSON object with Local Stream Options as given below:
{ "audio": true, // Whether to add Audio to stream "video": true, // Whether to add Video to stream "data": true, // Whether to add Data to stream "videoSize": { // Video Frame Size - Deprecated in Android SDK v2.0.1+ "minWidth": number, "minHeight": number, "maxWidth": number, "maxHeight": number ), "audioMuted": true, // Audio muted on entry to room "videoMuted": true, // Video muted on entry to room "attributes": { // Object to carry custom data "custom1": "" }, "maxVideoBW": number, // Max Bandwidth - Deprecated in Android SDK v2.0.1+ "minVideoBW": number // Min Bandwidth - Deprecated in Android SDK v2.0.1+ }
Error Codes / Exceptions
Code | Description |
---|---|
5015 | Failed to initialize the Stream without Audio, Video, and Data track. |
5016 | Failed to initialize the Stream due to incorrect values of JSON Keys in publishStreamInfo . |
5017 | Unable to create Stream due to failure to access Camera and Microphone. |
5018 | Unable to create Video Stream due to failure to access Camera. Only Audio Stream created. |
5019 | Unable to create Stream due to failure to access Microphone. |
5084 | Invalid Video Layer. Max allowed Video Layers: 3 |
5088 | Invalid Frame Rate. Max allowed Frame Rate: 30 |
Initiate Stream with Multiple Video Layers
To help stream subscribers receive the best video quality subject to the available bandwidth, stream publishers must ensure that their streams carry multiple video layers of different quality. The Auto Bandwidth Detection feature detects the subscriber’s bandwidth and switches to the respective video layer for a smooth video experience.
JSONObject streamOpt = { audio: true, video: true, maxVideoLayers: 3 // Carry 3 layers, viz HD 720p, SD 480p & LD 240p/180p }; // Enumerated Values for maxVideoLayers: 1, 2, 3 // 1=HD 720p layer only // 2=HD 720p & SD 480p layers only // 3=HD 720p, SD 480p & LD 240p/180p layers EnxStream localStream = room.getLocalStream(streamOpt);
Error Codes / Exceptions
Code | Description |
---|---|
5084 | Illegible Value for maxVideoLayers . Max 3 Video Layers supported. |