Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
webrtc-issue-detector
Advanced tools
WebRTC diagnostic tool that detects issues with network or user devices
Diagnostic tool for WebRTC JS applications that analyzes WebRTC getStats() result in realtime and generates a report on possible issues.
yarn add webrtc-issue-detector
import WebRTCIssueDetector from 'webrtc-issue-detector';
// create it before the first instance of RTCPeerConnection is created
const webRtcIssueDetector = new WebRTCIssueDetector({
onIssues: (issues) => issues.map((issue) => {
console.log('Issues type:', issue.type); // eg. "network"
console.log('Issues reason:', issue.reason); // eg. "outbound-network-throughput"
console.log('Stats:', issue.statsSample); // eg. "packetLossPct: 12%, avgJitter: 230, rtt: 150"
}),
onNetworkScoresUpdated: (scores) => {
console.log('Inbound network score', scores.inbound); // eg. 3.7
console.log('Outbound network score', scores.outbound); // eg. 4.5
console.log('Network stats', scores.statsSamples); // eg. { inboundStatsSample: { avgJitter: 0.1, rtt: 30, packetsLoss: 8 }, ... }
}
});
// start collecting getStats() and detecting issues
webRtcIssueDetector.watchNewPeerConnections();
// stop collecting WebRTC stats and issues detection
webRtcIssueDetector.stopWatchingNewPeerConnections();
By default, WebRTCIssueDetector can be created with minimum of mandatory constructor parameters. But it's possible to override most of them.
import WebRTCIssueDetector, {
QualityLimitationsIssueDetector,
FramesDroppedIssueDetector,
FramesEncodedSentIssueDetector,
InboundNetworkIssueDetector,
OutboundNetworkIssueDetector,
NetworkMediaSyncIssueDetector,
AvailableOutgoingBitrateIssueDetector,
UnknownVideoDecoderImplementationDetector,
FrozenVideoTrackDetector,
} from 'webrtc-issue-detector';
const widWithDefaultConstructorArgs = new WebRTCIssueDetector();
// or you can fully customize WebRTCIssueDetector with constructor arguments
const widWithCustomConstructorArgs = new WebRTCIssueDetector({
detectors: [ // you are free to change the detectors list according to your needs
new QualityLimitationsIssueDetector(),
new FramesDroppedIssueDetector(),
new FramesEncodedSentIssueDetector(),
new InboundNetworkIssueDetector(),
new OutboundNetworkIssueDetector(),
new NetworkMediaSyncIssueDetector(),
new AvailableOutgoingBitrateIssueDetector(),
new UnknownVideoDecoderImplementationDetector(),
new FrozenVideoTrackDetector(),
],
getStatsInterval: 10_000, // set custom stats parsing interval
onIssues: (payload: IssueDetectorResult) => {
// your custom callback for detected issues handling
},
onNetworkScoresUpdated: (payload: NetworkScores) => {
// your custom callback for networks score updates handling
},
ignoreSSRCList: [
// in case you need to skip some ssrc from parsing, add its numbers to the array
],
});
Detects issues with outgoing network connection.
const exampleIssue = {
type: 'network',
reason: 'outbound-network-throughput',
statsSample: {
availableOutgoingBitrate: 1234,
videoStreamsTotalBitrate: 1234,
audioStreamsTotalTargetBitrate: 1234,
},
}
Detects issues with decoder.
const exampleIssue = {
type: 'cpu',
reason: 'decoder-cpu-throttling',
statsSample: {
deltaFramesDropped: 100,
deltaFramesReceived: 1000,
deltaFramesDecoded: 900,
framesDroppedPct: 10,
},
ssrc: 1234,
}
Detects issues with outbound network throughput.
const exampleIssue = {
type: 'network',
reason: 'outbound-network-throughput',
statsSample: {
deltaFramesSent: 900,
deltaFramesEncoded: 1000,
missedFramesPct: 10,
},
ssrc: 1234,
}
Detects issues with inbound network connection.
const exampleIssue = {
type: 'network',
reason: 'inbound-network-quality' | 'inbound-network-media-latency' | 'network-media-sync-failure',
iceCandidate: 'ice-candidate-id',
statsSample: {
rtt: 1234,
packetLossPct: 1234,
avgJitter: 1234,
avgJitterBufferDelay: 1234,
},
}
Also can detect server side issues if there is high RTT and jitter is ok.
const exampleIssue = {
type: 'server',
reason: 'server-issue',
iceCandidate: 'ice-candidate-id',
statsSample: {
rtt: 1234,
packetLossPct: 1234,
avgJitter: 1234,
avgJitterBufferDelay: 1234,
},
}
Detects issues with audio synchronization.
const exampleIssue = {
type: 'network',
reason: 'network-media-sync-failure',
ssrc: 1234,
statsSample: {
correctedSamplesPct: 15,
},
}
Detects issues with outbound network connection.
const exampleIssue = {
type: 'network',
reason: 'outbound-network-quality' | 'outbound-network-media-latency',
iceCandidate: 'ice-candidate-id',
statsSample: {
rtt: 1234,
avgJitter: 1234,
packetLossPct: 1234,
},
}
Detects issues with encoder and outbound network. Based on native qualityLimitationReason.
const exampleIssue = {
type: 'cpu',
reason: 'encoder-cpu-throttling',
ssrc: 1234,
statsSample: {
qualityLimitationReason: 'cpu',
},
}
const exampleIssue = {
type: 'network',
reason: 'outbound-network-throughput',
ssrc: 1234,
statsSample: {
qualityLimitationReason: 'bandwidth',
},
}
Detects issues with decoding stream.
const exampleIssue = {
type: 'stream',
reason: 'unknown-video-decoder',
ssrc: 1234,
trackIdentifier: 'some-track-id',
statsSample: {
mimeType: 'video/vp9',
decoderImplementation: 'unknown'
},
}
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
FAQs
WebRTC diagnostic tool that detects issues with network or user devices
The npm package webrtc-issue-detector receives a total of 5,312 weekly downloads. As such, webrtc-issue-detector popularity was classified as popular.
We found that webrtc-issue-detector demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.