Class Index | File Index

Classes


Class Stream


Defined in: protocol.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Stream(sc, id, localId, pc, up)
Stream encapsulates a MediaStream, a set of tracks.
Field Summary
Field Attributes Field Name and Description
 
id
The id of this stream.
 
The label assigned by the originator to this stream.
 
Indicates whether we have already sent a local description.
 
Buffered local ICE candidates.
 
The local id of this stream.
 
onclose is called when the stream is closed.
 
ondowntrack is called whenever a new track is added to a stream.
 
onerror is called whenever an error occurs.
 
onnegotiationcompleted is called whenever negotiation or renegotiation has completed.
 
onstats is called when we have new statistics about the connection
 
onstatus is called whenever the status of the stream changes.
 
pc
The associated RTCPeerConnection.
 
Buffered remote ICE candidates.
 
The id of the stream that we are currently replacing.
 
sc
The associated ServerConnection.
 
For down streams, the id of the client that created the stream.
 
The statistics last computed by the stats handler.
 
The id of the periodic handler that computes statistics, as returned by setInterval.
 
The associated MediaStream.
 
up
Indicates whether the stream is in the client->server direction.
 
userdata is a convenient place to attach data to a Stream.
 
For down streams, the username of the client who created the stream.
Method Summary
Method Attributes Method Name and Description
 
abort requests that the server close a down stream.
 
close(replace)
close closes a stream.
 
flushLocalIceCandidates flushes any buffered local ICE candidates.
 
flushRemoteIceCandidates flushes any buffered remote ICE candidates.
 
gotLocalIce(candidate)
Called when we get a local ICE candidate.
 
negotiate(restartIce)
negotiate negotiates or renegotiates an up stream.
 
request(what)
request sets the list of tracks.
 
restartIce causes an ICE restart on a stream.
 
setStatsInterval sets the interval in milliseconds at which the onstats handler will be called.
 
updateStats is called periodically, if requested by setStatsInterval, in order to recompute stream statistics and invoke the onstats handler.
Class Detail
Stream(sc, id, localId, pc, up)
Stream encapsulates a MediaStream, a set of tracks. A stream is said to go "up" if it is from the client to the server, and "down" otherwise.
Parameters:
{ServerConnection} sc
{string} id
{string} localId
{RTCPeerConnection} pc
up
Field Detail
id
The id of this stream.

label
The label assigned by the originator to this stream.

localDescriptionSent
Indicates whether we have already sent a local description.

localIceCandidates
Buffered local ICE candidates. This will be flushed by flushLocalIceCandidates after we send a local description.

localId
The local id of this stream.

onclose
onclose is called when the stream is closed. Replace will be true if the stream is being replaced by another one with the same id.

ondowntrack
ondowntrack is called whenever a new track is added to a stream. If the stream parameter differs from its previous value, then it indicates that the old stream has been discarded.

onerror
onerror is called whenever an error occurs. If the error is fatal, then onclose will be called afterwards.

onnegotiationcompleted
onnegotiationcompleted is called whenever negotiation or renegotiation has completed.

onstats
onstats is called when we have new statistics about the connection

onstatus
onstatus is called whenever the status of the stream changes.

pc
The associated RTCPeerConnection. This is null before the stream is connected, and may change over time.

remoteIceCandidates
Buffered remote ICE candidates. This will be flushed by flushRemoteIceCandidates when we get a remote SDP description.

replace
The id of the stream that we are currently replacing.

sc
The associated ServerConnection.

source
For down streams, the id of the client that created the stream.

stats
The statistics last computed by the stats handler. This is a dictionary indexed by track id, with each value a dictionary of statistics.

statsHandler
The id of the periodic handler that computes statistics, as returned by setInterval.

stream
The associated MediaStream. This is null before the stream is connected, and may change over time.

up
Indicates whether the stream is in the client->server direction.

userdata
userdata is a convenient place to attach data to a Stream. It is not used by the library.

username
For down streams, the username of the client who created the stream.
Method Detail
abort()
abort requests that the server close a down stream.

close(replace)
close closes a stream. For streams in the up direction, this may be called at any time. For streams in the down direction, this will be called automatically when the server signals that it is closing a stream.
Parameters:
{boolean} replace Optional
- true if the stream is being replaced by another one with the same id

flushLocalIceCandidates()
flushLocalIceCandidates flushes any buffered local ICE candidates. It is called when we send an offer.

flushRemoteIceCandidates()
flushRemoteIceCandidates flushes any buffered remote ICE candidates. It is called automatically when we get a remote description.

gotLocalIce(candidate)
Called when we get a local ICE candidate. Don't call this.
Parameters:
{RTCIceCandidate} candidate

negotiate(restartIce)
negotiate negotiates or renegotiates an up stream. It is called automatically when required. If the client requires renegotiation, it is probably better to call restartIce which will cause negotiate to be called asynchronously.
Parameters:
{boolean} restartIce Optional
- Whether to restart ICE.

request(what)
request sets the list of tracks. If this is not called, or called with a null argument, then the default is provided by ServerConnection.request.
Parameters:
{Array} what
- a sequence of 'audio', 'video' or 'video-low'.

restartIce()
restartIce causes an ICE restart on a stream. For up streams, it is called automatically when ICE signals that the connection has failed, but may also be called by the application. For down streams, it requests that the server perform an ICE restart. In either case, it returns immediately, negotiation will happen asynchronously.

setStatsInterval(ms)
setStatsInterval sets the interval in milliseconds at which the onstats handler will be called. This is only useful for up streams.
Parameters:
{number} ms
- The interval in milliseconds.

updateStats()
updateStats is called periodically, if requested by setStatsInterval, in order to recompute stream statistics and invoke the onstats handler.

Documentation generated by JsDoc Toolkit 2.4.0 on Tue May 18 2021 01:56:38 GMT+0200 (CEST)