Global

Members

(constant) Request

Use XMLHttpRequest to get a network resource.
Source:

Methods

calcMos(sample, fractionLost) → {number}

Calculate the mos score of a stats object
Parameters:
Name Type Description
sample object Sample, must have rtt and jitter
fractionLost number The fraction of packets that have been lost Calculated by packetsLost / totalPackets
Source:
Returns:
mos - Calculated MOS, 1.0 through roughly 4.5
Type
number

convertMsToSeconds(inMs) → {number}

Parameters:
Name Type Description
inMs number A time in milliseconds
Source:
Returns:
The time in seconds
Type
number

createRTCCertificateStats(report) → {RTCIceCertificateStats}

Parameters:
Name Type Description
report RTCLegacyStatsReport
Source:
Returns:
Type
RTCIceCertificateStats

createRTCCodecStats(report) → {RTCCodecStats}

Parameters:
Name Type Description
report RTCLegacyStatsReport
Source:
Returns:
Type
RTCCodecStats

createRTCDataChannelStats(report) → {RTCDataChannelStats}

Parameters:
Name Type Description
report RTCLegacyStatsReport
Source:
Returns:
Type
RTCDataChannelStats

createRTCIceCandidatePairStats(report) → {RTCIceCandidatePairStats}

Parameters:
Name Type Description
report RTCLegacyStatsReport
Source:
Returns:
Type
RTCIceCandidatePairStats

createRTCIceCandidateStats(report, isRemote) → {RTCIceCandidateStats}

Parameters:
Name Type Description
report RTCLegacyStatsReport
isRemote boolean Whether to create for a remote candidate, or local candidate.
Source:
Returns:
Type
RTCIceCandidateStats

createRTCInboundRTPStreamStats(report) → {RTCInboundRTPStreamStats}

Parameters:
Name Type Description
report RTCLegacyStatsReport
Source:
Returns:
Type
RTCInboundRTPStreamStats

createRTCMediaStreamTrackStats(report) → {RTCMediaStreamTrackStats}

Parameters:
Name Type Description
report RTCLegacyStatsReport
Source:
Returns:
Type
RTCMediaStreamTrackStats

createRTCOutboundRTPStreamStats(report) → {RTCOutboundRTPStreamStats}

Parameters:
Name Type Description
report RTCLegacyStatsReport
Source:
Returns:
Type
RTCOutboundRTPStreamStats

createRTCRTPStreamStats(report, isInbound) → {RTCRTPStreamStats}

Parameters:
Name Type Description
report RTCLegacyStatsReport
isInbound boolean Whether to create an inbound stats object, or outbound.
Source:
Returns:
Type
RTCRTPStreamStats

createRTCTransportStats(report) → {RTCTransportStats}

Parameters:
Name Type Description
report RTCLegacyStatsReport
Source:
Returns:
Type
RTCTransportStats

getStatistics(peerConnection, options) → {Promise.<RTCSample>}

Collects any WebRTC statistics for the given PeerConnection
Parameters:
Name Type Description
peerConnection PeerConnection Target connection.
options StatsOptions List of custom options.
Source:
Returns:
Universally-formatted version of RTC stats.
Type
Promise.<RTCSample>

MediaDevicesShim()

Make a custom MediaDevices object, and proxy through existing functionality. If devicechange is present, we simply reemit the event. If not, we will do the detection ourselves and fire the event when necessary. The same logic exists for deviceinfochange for consistency, however deviceinfochange is our own event so it is unlikely that it will ever be native. The w3c spec for devicechange is unclear as to whether MediaDeviceInfo changes (such as label) will trigger the devicechange event. We have an open question on this here: https://bugs.chromium.org/p/chromium/issues/detail?id=585096
Source:

setAudioSource(audio, stream) → {boolean}

Set the source of an HTMLAudioElement to the specified MediaStream
Parameters:
Name Type Description
audio HTMLAudioElement
stream MediaStream
Source:
Returns:
Whether the audio source was set successfully
Type
boolean

translateCandidateType(type) → {string}

Parameters:
Name Type Description
type string A type in the legacy format
Source:
Returns:
The type adjusted to new standards for known naming changes
Type
string

Type Definitions

RTCSample

A sample containing relevant WebRTC stats information.
Type:
  • Object
Properties:
Name Type Attributes Description
timestamp Number <optional>
codecName String <optional>
MimeType name of the codec being used by the outbound audio stream
rtt Number <optional>
Round trip time
jitter Number <optional>
packetsSent Number <optional>
packetsLost Number <optional>
packetsReceived Number <optional>
bytesReceived Number <optional>
bytesSent Number <optional>
localAddress Number <optional>
remoteAddress Number <optional>
audioInputLevel Number <optional>
Between 0 and 32767
audioOutputLevel Number <optional>
Between 0 and 32767
Source:

StatsOptions

Used for testing to inject and extract methods.
Type:
  • Object
Properties:
Name Type Attributes Description
createRTCSample function <optional>
Method for parsing an RTCStatsReport
Source: