Subscribing to a stream

In this guide you will learn to subscribe users to a stream within your application.

To subscribe to all streams in the session, add an OTSubscriber object as a chile of the OTSession object:

After the client connects to the session, the OTSubscriber object adds views for subscriber videos when other clients streams become available in the session.

The OTSubscriber object dispatches a connected event when a subscriber successfully starts streaming. It dispatches an error event if there is an error subscribing. Set an eventHandlers prop of the OTSubscriber component, and set the connected and error properties of that object to callback functions: