Suggestions

close search

Stream

Properties 

Specifies a stream. A stream is a representation of a published stream in a session. When a client calls the Session.publish() method, a new stream is created. Properties of the Stream object provide information about the stream.

When a stream is added to a session, the Session object dispatches a streamCreatedEvent. When a stream is destroyed, the Session object dispatches a streamDestroyed event. The StreamEvent object, which defines these event objects, has a stream property, which is an array of Stream object. For details and a code example, see StreamEvent.

When a connection to a session is made, the Session object dispatches a sessionConnected event, defined by the SessionConnectEvent object. The SessionConnectEvent object has a streams property, which is an array of Stream objects pertaining to the streams in the session at that time. For details and a code example, see SessionConnectEvent.

Properties

Name Type Description
connection Connection The Connection object corresponding to the connection that is publishing the stream. You can compare this to the connection property of the Session object to see if the stream is being published by the local web page.
creationTime Number The timestamp for the creation of the stream. This value is calculated in milliseconds. You can convert this value to a Date object by calling new Date(creationTime), where creationTime is the creationTime property of the Stream object.
frameRate Number The frame rate of the video stream. This property is only set if the publisher of the stream specifies a frame rate when calling the OT.initPublisher() method; otherwise, this property is undefined.
hasAudio Boolean Whether the stream has audio. This property can change if the publisher turns on or off audio (by calling Publisher.publishAudio()). When this occurs, the Session object dispatches a streamPropertyChanged event (see StreamPropertyChangedEvent).
hasVideo Boolean Whether the stream has video. This property can change if the publisher turns on or off video (by calling Publisher.publishVideo()). When this occurs, the Session object dispatches a streamPropertyChanged event (see StreamPropertyChangedEvent).
name String The name of the stream. Publishers can specify a name when publishing a stream (using the publish() method of the publisher's Session object).
streamId String The unique ID of the stream.
videoDimensions Object This object has two properties: width and height. Both are numbers. The width property is the width of the encoded stream; the height property is the height of the encoded stream. (These are independent of the actual width of Publisher and Subscriber objects corresponding to the stream.) This property can change if a stream published from a mobile device resizes, based on a change in the device orientation. When the video dimensions change, the Session object dispatches a streamPropertyChanged event (see StreamPropertyChangedEvent).
videoType String The type of video — either "camera" or "screen". A "screen" video uses screen sharing on the publisher as the video source; for other videos, this property is set to "camera". This property can change if a stream published from a mobile device changes from a camera to a screen-sharing video type. When the video type changes, the Session object dispatches a streamPropertyChanged event (see StreamPropertyChangedEvent).