ObserveRTC Client Integration Core Library
UNDER DEVELOPMENT, NO STABLE VERSION IS AVAILABLE AT THE MOMENT!
@observertc/client-observer-js is a client side library for observertc integration.
Qucik Start
npm i @observertc/client-observer-js
Collect WebRTC Stats
import { ClientObserver } from "@observertc/client-observer-js";
const observer = ClientObserver.create({
collectingPeriodInMs: 5000,
});
observer.addStatsCollector({
id: "collectorId",
getStats: () => peerConnection.getStats(),
});
observer.events.onStatsCollected(() => {
for (const transport of observer.stats.transports()) {
console.log(transport.stats.packetsSent);
}
})
The above example collect stats in every 5s.
When stats are collected and stored it emits an event to notify the
application.
You can navigate through related stats:
for (const outboundRtp of observer.stats.outboundRtps()) {
const remoteInboundRtp = outboundRtp.getRemoteInboundRtp();
console.log(outboundRtp.stats, remoteInboundRtp.stats);
}
The example above shows how to get the remote inbound rtp stats related to the outbound rtp stats.
Sample & Send
UNDER DEVELOPMENT
Configurations
const config = {
collectingPeriodInMs: 5000,
samplingPeriodInMs: 10000,
statsExpirationTimeInMs: 60000,
collectors: {
adapter: {
browserType: "chrome",
browserVersion: "97.1111.111",
},
},
sampler: {
roomId: "testRoom",
clientId: "clientId",
callId: "callId",
userId: "testUser",
incrementalSampling: true,
},
};