The following methods provide Stream-related information such as the Stream type, media tracks, state, etc.
Table of Contents
- Get Stream ID
- Verify availability of Media Tracks in Stream
- Know if Stream is Local or Remote
- Get Local Stream ID
- Get Stream by Stream ID
- Get list of Remote Streams
Get Stream ID
The Stream ID of a given Stream can be obtained from its property streamId
. The Stream ID is used to identify every Stream, be it a local or a remote stream, a canvas stream, or a screen-share stream.
Class: EnxStream
Property: streamId
Verify availability of Media Tracks in Stream
EnxStream
class provides the following methods to check the presence of a particular media track in the Stream.
Class: EnxStream
Methods:
- To check if Stream has an Audio Track:
- (BOOL)hasAudio
– No Parameter required.
- To check if Stream has a Video Track:
- (BOOL)hasVideo
– No Parameter required.
- To check if Stream has a Data Track:
- (BOOL)hasData
– No Parameter required.
Returns: Boolean
if ([stream hasVideo] ) { // The Stream has a Video Track in it } // Other methods are also used in the similar manner.
Know if Stream is Local or Remote
The Stream’s property isLocal
is used to know if the given Stream is a Local or a Remote Stream.
Class: EnxStream
Property: isLocal
– BOOL
if (stream.isLocal) { // It's a Local Stream } else { // It's a Remote Stream }
Get Local Stream ID
The publishStreamId
property provides the ID of your Local Stream published in the Room.
Class: EnxRoom
Property: NSString publishStreamId
NSString* publishStreamID = room.publishStreamId;
Get Stream by Stream ID
The streamsByStreamId
property provides the Stream information for the given Stream ID.
Class: EnxRoom
Property: NSDictionary streamsByStreamId
NSDictionary* streamsDict = room.streamsByStreamId; // Get Dictionary EnxStream* stream = streamsDict[@"StreamID"]; // Get specific Stream Object
Get list of Remote Streams
The remoteStreams
property provides the list of Remote Streams available in the Room.
Class: EnxRoom
Property: NSArray remoteStreams
NSArray* remoteStreams = room.remoteStreams;