Create a Local Stream
The EnxRoom.getLocalStream()
method initializes a local stream at the client endpoint before publishing it to a room. The initialization process comprises specifying media tracks, adding custom attributes, and so on in the form of a JSON object passed as a parameter to the method.
Class: EnxRoom
Method: –(EnxStream *)getlocalStream:(NSDictionary *)publishStreamInfo
Parameter: publishStreamInfo
: JSON Object. A JSON object with the local stream options.
Sample Code for Local Stream Options
{"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 iOS 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 iOS SDK v2.0.1+"minVideoBW": number // Min Bandwidth - Deprecated in iOS SDK v2.0.1+}
Error Codes and Exceptions
Code | Description |
---|---|
5015 | Failed to initialize a stream without audio, video, and data track. |
5016 | Failed to initialize a stream due to incorrect values of JSON keys in publishStreamInfo. |
5017 | Unable to create a stream due to failed access to camera and microphone. |
5018 | Unable to create a video stream due to failed access to camera. Only audio stream is created. |
5019 | Unable to create a stream due to failed access to microphone. |
5084 | Invalid video layer. A maximum of 3 layers is allowed. |
5088 | Invalid Frame Rate. A maximum of 30 frame rate is allowed. |