Members

(constant) AudioCodec :String

Enum of Millicast supported Audio codecs

Type:
  • String
Properties
NameTypeDescription
OPUSString
MULTIOPUSString

(constant) VideoCodec :String

Enum of Millicast supported Video codecs

Type:
  • String
Properties
NameTypeDescription
VP8String
VP9String
H264String
AV1String
H265String

Only available in Safari

Methods

addCandidateReport(report, statsObject)

Parse and add incoming candidate-pair report from RTCPeerConnection to final report. Also adds associated local-candidate data to report.

Parameters:
NameTypeDescription
reportObject

JSON object which represents a report from RTCPeerConnection stats.

statsObjectObject

Current stats object being parsed.

addInboundRtpReport(report, previousStats, statsObject)

Parse and add incoming inbound-rtp report from RTCPeerConnection to final report.

Parameters:
NameTypeDescription
reportObject

JSON object which represents a report from RTCPeerConnection stats.

previousStatsConnectionStats

Previous stats parsed.

statsObjectObject

Current stats object being parsed.

addOutboundRtpReport(report, previousStats, statsObject)

Parse and add incoming outbound-rtp report from RTCPeerConnection to final report.

Parameters:
NameTypeDescription
reportObject

JSON object which represents a report from RTCPeerConnection stats.

previousStatsConnectionStats

Previous stats parsed.

statsObjectObject

Current stats object being parsed.

addPeerEvents(instanceClass, peer)

Emits peer events.

Parameters:
NameTypeDescription
instanceClassPeerConnection

PeerConnection instance.

peerRTCPeerConnection

Peer instance.

calculatePacketsLostDelta(actualReport, previousReport) → {Number}

Calculate the delta packets lost

Parameters:
NameTypeDescription
actualReportObject

JSON object which represents a parsed report.

previousReportObject

JSON object which represents a parsed report.

Returns:

Packets lost ratio

Type: 
Number

calculatePacketsLostRatio(actualReport, previousReport) → {Number}

Calculate the ratio packets lost

Parameters:
NameTypeDescription
actualReportObject

JSON object which represents a parsed report.

previousReportObject

JSON object which represents a parsed report.

Returns:

Packets lost ratio

Type: 
Number

getBaseRtpReportData(report, mediaType) → {Object}

Get common information for RTP reports.

Parameters:
NameTypeDescription
reportObject

JSON object which represents a report from RTCPeerConnection stats.

mediaTypeString

Media type.

Returns:

Object containing common information.

Type: 
Object

getCodecData(codecReportId, rawStats) → {Object}

Get codec information from stats.

Parameters:
NameTypeDescription
codecReportIdString

Codec report ID.

rawStatsRTCStatsReport

RTCPeerConnection stats.

Returns:

Object containing codec information.

Type: 
Object

getMediaType(report) → {String}

Get media type.

Parameters:
NameTypeDescription
reportObject

JSON object which represents a report from RTCPeerConnection stats.

Returns:

Media type.

Type: 
String

Type Definitions

ConnectionStats

Type:
  • Object
Properties
NameTypeDescription
rawRTCStatsReport

All RTCPeerConnection stats without parsing. Reference https://developer.mozilla.org/en-US/docs/Web/API/RTCStatsReport.

audioTrackReport

Parsed audio information.

videoTrackReport

Parsed video information.

availableOutgoingBitrateNumber

The available outbound capacity of the network connection. The higher the value, the more bandwidth you can assume is available for outgoing data. The value is reported in bits per second.

This value comes from the nominated candidate-pair.

totalRoundTripTimeNumber

Total round trip time is the total time in seconds that has elapsed between sending STUN requests and receiving the responses.

This value comes from the nominated candidate-pair.

currentRoundTripTimeNumber

Current round trip time indicate the number of seconds it takes for data to be sent by this peer to the remote peer and back over the connection described by this pair of ICE candidates.

This value comes from the nominated candidate-pair.

candidateTypeRTCIceCandidateType

Local candidate type from the nominated candidate-pair which indicates the type of ICE candidate the object represents.

DirectorPublisherOptions

Type:
  • Object
Properties
NameTypeAttributesDescription
tokenString

Millicast Publishing Token.

streamNameString

Millicast Stream Name.

streamType"WebRtc" | "Rtmp"<optional>

Millicast Stream Type.

DirectorSubscriberOptions

Type:
  • Object
Properties
NameTypeAttributesDescription
streamNameString

Millicast publisher Stream Name.

streamAccountIdString

Millicast Account ID.

subscriberTokenString<optional>

Token to subscribe to secure streams. If you are subscribing to an unsecure stream, you can omit this param.

InboundStats

Type:
  • Object
Properties
NameTypeAttributesDescription
idString

inbound-rtp Id.

jitterNumber

Current Jitter measured in seconds.

mimeTypeString<optional>

Mime type if related report had codec report associated.

framesPerSecondNumber<optional>

Current framerate if it's video report.

frameHeightNumber<optional>

Current frame height if it's video report.

frameWidthNumber<optional>

Current frame width if it's video report.

timestampNumber

Timestamp of report.

totalBytesReceivedNumber

Total bytes received is an integer value which indicates the total number of bytes received so far from this synchronization source.

totalPacketsReceivedNumber

Total packets received indicates the total number of packets of any kind that have been received on the connection described by the pair of candidates.

totalPacketsLostNumber

Total packets lost.

packetsLostRatioPerSecondNumber

Total packet lost ratio per second.

packetsLostDeltaPerSecondNumber

Total packet lost delta per second.

bitrateNumber

Current bitrate in bits per second.

LayerInfo

Type:
  • Object
Properties
NameTypeDescription
encodingIdString

rid value of the simulcast encoding of the track (default: automatic selection)

spatialLayerIdNumber

The spatial layer id to send to the outgoing stream (default: max layer available)

temporalLayerIdNumber

The temporaral layer id to send to the outgoing stream (default: max layer available)

maxSpatialLayerIdNumber

Max spatial layer id (default: unlimited)

maxTemporalLayerIdNumber

Max temporal layer id (default: unlimited)

LayerInfo

Type:
  • Object
Properties
NameTypeDescription
encodingIdString

rid value of the simulcast encoding of the track (default: automatic selection)

spatialLayerIdNumber

The spatial layer id to send to the outgoing stream (default: max layer available)

temporalLayerIdNumber

The temporaral layer id to send to the outgoing stream (default: max layer available)

maxSpatialLayerIdNumber

Max spatial layer id (default: unlimited)

maxTemporalLayerIdNumber

Max temporal layer id (default: unlimited)

LogLevel

Type:
  • Object
Properties
NameTypeDescription
valueNumber

The numerical representation of the level.

nameString

Human readable name of the log level.

MillicastCapability

Type:
  • Object
Properties
NameTypeDescription
codecsArray.<Object>
Properties
NameTypeAttributesDescription
codecString

Audio or video codec name.

mimeTypeString

Audio or video codec mime type.

scalabilityModesArray.<String><optional>

In case of SVC support, a list of scalability modes supported.

channelsNumber<optional>

Only for audio, the number of audio channels supported.

headerExtensionsArray.<RTCRtpHeaderExtensionCapability>

An array specifying the URI of the header extension, as described in RFC 5285.

MillicastDirectorResponse

Type:
  • Object
Properties
NameTypeDescription
urlsArray.<String>

WebSocket available URLs.

jwtString

Access token for signaling initialization.

iceServersArray.<RTCIceServer>

Object which represents a list of Ice servers.

MillicastDirectorResponse

Type:
  • Object
Properties
NameTypeDescription
urlsArray.<String>

WebSocket available URLs.

jwtString

Access token for signaling initialization.

iceServersArray.<RTCIceServer>

Object which represents a list of Ice servers.

OutboundStats

Type:
  • Object
Properties
NameTypeAttributesDescription
idString

outbound-rtp Id.

mimeTypeString<optional>

Mime type if related report had codec report associated.

framesPerSecondNumber<optional>

Current framerate if it's video report.

frameHeightNumber<optional>

Current frame height if it's video report.

frameWidthNumber<optional>

Current frame width if it's video report.

qualityLimitationReasonString<optional>

If it's video report, indicate the reason why the media quality in the stream is currently being reduced by the codec during encoding, or none if no quality reduction is being performed.

timestampNumber

Timestamp of report.

totalBytesSentNumber

Total bytes sent indicates the total number of payload bytes that hve been sent so far on the connection described by the candidate pair.

bitrateNumber

Current bitrate in bits per second.

SignalingPublishOptions

Type:
  • Object
Properties
NameTypeAttributesDefaultDescription
codecVideoCodec<optional>
"h264"

Codec for publish stream.

recordBoolean<optional>

Enable stream recording. If record is not provided, use default Token configuration. Only available in Tokens with recording enabled.

sourceIdString<optional>

Source unique id. Only available in Tokens with multisource enabled.*

eventsArray.<String>

Override which events will be delivered by the server ("active" | "inactive").

SignalingSubscribeOptions

Type:
  • Object
Properties
NameTypeDescription
vadString

Enable VAD multiplexing for secondary sources.

pinnedSourceIdString

Id of the main source that will be received by the default MediaStream.

excludedSourceIdsArray.<String>

Do not receive media from the these source ids.

eventsArray.<String>

Override which events will be delivered by the server ("active" | "inactive" | "vad" | "layers").

layerLayerInfo

Select the simulcast encoding layer and svc layers for the main video track, leave empty for automatic layer selection based on bandwidth estimation.

TrackReport

Type:
  • Object
Properties
NameTypeDescription
inboundsArray.<InboundStats>

Parsed information of each inbound-rtp.

outboundsArray.<OutboundStats>

Parsed information of each outbound-rtp.

loggerHandler(messages, context)

Callback which handles log messages.

Parameters:
NameTypeDescription
messagesArray.<any>

Arguments object with the supplied log messages.

contextObject
Properties
NameTypeAttributesDescription
levelLogLevel

The currrent log level.

nameString<nullable>

The optional current logger name.

tokenGeneratorCallback() → {Promise.<MillicastDirectorResponse>}

Callback invoke when a new connection path is needed.

Returns:

Promise object which represents the result of getting the new connection path.

You can use your own token generator or use the Director available methods.

Type: 
Promise.<MillicastDirectorResponse>