Global

Members

# (constant) AudioCodec :String

Enum of Millicast supported Audio codecs

Type:
  • String
Properties
Name Type Description
OPUS String
MULTIOPUS String

# (constant) VideoCodec :String

Enum of Millicast supported Video codecs

Type:
  • String
Properties
Name Type Description
VP8 String
VP9 String
H264 String
AV1 String
H265 String

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:
Name Type Description
report Object

JSON object which represents a report from RTCPeerConnection stats.

statsObject Object

Current stats object being parsed.

# addInboundRtpReport(report, previousStats, statsObject)

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

Parameters:
Name Type Description
report Object

JSON object which represents a report from RTCPeerConnection stats.

previousStats ConnectionStats

Previous stats parsed.

statsObject Object

Current stats object being parsed.

# addOutboundRtpReport(report, previousStats, statsObject)

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

Parameters:
Name Type Description
report Object

JSON object which represents a report from RTCPeerConnection stats.

previousStats ConnectionStats

Previous stats parsed.

statsObject Object

Current stats object being parsed.

# addPeerEvents(instanceClass, peer)

Emits peer events.

Parameters:
Name Type Description
instanceClass PeerConnection

PeerConnection instance.

peer RTCPeerConnection

Peer instance.

# calculatePacketsLostDelta(actualReport, previousReport) → {Number}

Calculate the delta packets lost

Parameters:
Name Type Description
actualReport Object

JSON object which represents a parsed report.

previousReport Object

JSON object which represents a parsed report.

Returns:

Packets lost ratio

Type
Number

# calculatePacketsLostRatio(actualReport, previousReport) → {Number}

Calculate the ratio packets lost

Parameters:
Name Type Description
actualReport Object

JSON object which represents a parsed report.

previousReport Object

JSON object which represents a parsed report.

Returns:

Packets lost ratio

Type
Number

# getBaseRtpReportData(report, mediaType) → {Object}

Get common information for RTP reports.

Parameters:
Name Type Description
report Object

JSON object which represents a report from RTCPeerConnection stats.

mediaType String

Media type.

Returns:

Object containing common information.

Type
Object

# getCodecData(codecReportId, rawStats) → {Object}

Get codec information from stats.

Parameters:
Name Type Description
codecReportId String

Codec report ID.

rawStats RTCStatsReport

RTCPeerConnection stats.

Returns:

Object containing codec information.

Type
Object

# getMediaType(report) → {String}

Get media type.

Parameters:
Name Type Description
report Object

JSON object which represents a report from RTCPeerConnection stats.

Returns:

Media type.

Type
String

# hasAudioMultichannel(mediaStream) → {Boolean}

Checks if mediaStream has more than 2 audio channels.

Parameters:
Name Type Description
mediaStream MediaStream

MediaStream to verify.

Returns:

returns true if MediaStream has more than 2 channels.

Type
Boolean

Type Definitions

# ConnectionStats

Type:
  • Object
Properties
Name Type Description
raw RTCStatsReport

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

audio TrackReport

Parsed audio information.

video TrackReport

Parsed video information.

availableOutgoingBitrate Number

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.

totalRoundTripTime Number

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.

currentRoundTripTime Number

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.

candidateType RTCIceCandidateType

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

# DirectorPublisherOptions

Type:
  • Object
Properties
Name Type Attributes Description
token String

Millicast Publishing Token.

streamName String

Millicast Stream Name.

streamType "WebRtc" | "Rtmp" <optional>

Millicast Stream Type.

Source:

# DirectorSubscriberOptions

Type:
  • Object
Properties
Name Type Attributes Description
streamName String

Millicast publisher Stream Name.

streamAccountId String

Millicast Account ID.

subscriberToken String <optional>

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

Source:

# InboundStats

Type:
  • Object
Properties
Name Type Attributes Description
id String

inbound-rtp Id.

jitter Number

Current Jitter measured in seconds.

mimeType String <optional>

Mime type if related report had codec report associated.

framesPerSecond Number <optional>

Current framerate if it's video report.

frameHeight Number <optional>

Current frame height if it's video report.

frameWidth Number <optional>

Current frame width if it's video report.

timestamp Number

Timestamp of report.

totalBytesReceived Number

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

totalPacketsReceived Number

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.

totalPacketsLost Number

Total packets lost.

packetsLostRatioPerSecond Number

Total packet lost ratio per second.

packetsLostDeltaPerSecond Number

Total packet lost delta per second.

bitrate Number

Current bitrate in bits per second.

# LayerInfo

Type:
  • Object
Properties
Name Type Description
encodingId String

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

spatialLayerId Number

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

temporalLayerId Number

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

maxSpatialLayerId Number

Max spatial layer id (default: unlimited)

maxTemporalLayerId Number

Max temporal layer id (default: unlimited)

# LayerInfo

Type:
  • Object
Properties
Name Type Description
encodingId String

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

spatialLayerId Number

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

temporalLayerId Number

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

maxSpatialLayerId Number

Max spatial layer id (default: unlimited)

maxTemporalLayerId Number

Max temporal layer id (default: unlimited)

Source:

# loggerHandler(messages, context)

Callback which handles log messages.

Parameters:
Name Type Description
messages Array.<any>

Arguments object with the supplied log messages.

context Object
Properties
Name Type Attributes Description
level LogLevel

The currrent log level.

name String <nullable>

The optional current logger name.

Source:

# LogLevel

Type:
  • Object
Properties
Name Type Description
value Number

The numerical representation of the level.

name String

Human readable name of the log level.

Source:

# MillicastCapability

Type:
  • Object
Properties
Name Type Description
codecs Array.<Object>
Properties
Name Type Attributes Description
codec String

Audio or video codec name.

mimeType String

Audio or video codec mime type.

scalabilityModes Array.<String> <optional>

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

channels Number <optional>

Only for audio, the number of audio channels supported.

headerExtensions Array.<RTCRtpHeaderExtensionCapability>

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

# MillicastDirectorResponse

Type:
  • Object
Properties
Name Type Description
urls Array.<String>

WebSocket available URLs.

jwt String

Access token for signaling initialization.

iceServers Array.<RTCIceServer>

Object which represents a list of Ice servers.

Source:

# MillicastDirectorResponse

Type:
  • Object
Properties
Name Type Description
urls Array.<String>

WebSocket available URLs.

jwt String

Access token for signaling initialization.

iceServers Array.<RTCIceServer>

Object which represents a list of Ice servers.

# OutboundStats

Type:
  • Object
Properties
Name Type Attributes Description
id String

outbound-rtp Id.

mimeType String <optional>

Mime type if related report had codec report associated.

framesPerSecond Number <optional>

Current framerate if it's video report.

frameHeight Number <optional>

Current frame height if it's video report.

frameWidth Number <optional>

Current frame width if it's video report.

qualityLimitationReason String <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.

timestamp Number

Timestamp of report.

totalBytesSent Number

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

bitrate Number

Current bitrate in bits per second.

# SignalingPublishOptions

Type:
  • Object
Properties
Name Type Attributes Default Description
codec VideoCodec <optional>
"h264"

Codec for publish stream.

record Boolean <optional>

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

sourceId String <optional>

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

events Array.<String>

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

# SignalingSubscribeOptions

Type:
  • Object
Properties
Name Type Description
vad String

Enable VAD multiplexing for secondary sources.

pinnedSourceId String

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

excludedSourceIds Array.<String>

Do not receive media from the these source ids.

events Array.<String>

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

layer LayerInfo

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

# 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>

# TrackReport

Type:
  • Object
Properties
Name Type Description
inbounds Array.<InboundStats>

Parsed information of each inbound-rtp.

outbounds Array.<OutboundStats>

Parsed information of each outbound-rtp.