@camstack/ui-library 1.1.12 → 1.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +19 -0
- package/dist/index.js +19 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -37361,8 +37361,12 @@ function CameraStreamPlayer({ serverUrl, streamKey, label, autoPlay = true, mute
|
|
|
37361
37361
|
updateState("connecting");
|
|
37362
37362
|
const abort = new AbortController();
|
|
37363
37363
|
connectAbortRef.current = abort;
|
|
37364
|
+
const t0 = performance.now();
|
|
37365
|
+
const ms = () => Math.round(performance.now() - t0);
|
|
37366
|
+
const timing = {};
|
|
37364
37367
|
try {
|
|
37365
37368
|
const iceServers = await getIceServers?.();
|
|
37369
|
+
timing.iceServersMs = ms();
|
|
37366
37370
|
if (!mountedRef.current || abort.signal.aborted) return;
|
|
37367
37371
|
const pc = new RTCPeerConnection({ iceServers: [...iceServers ?? [], { urls: "stun:stun.l.google.com:19302" }] });
|
|
37368
37372
|
if (!seamless) pcRef.current = pc;
|
|
@@ -37385,6 +37389,7 @@ function CameraStreamPlayer({ serverUrl, streamKey, label, autoPlay = true, mute
|
|
|
37385
37389
|
}
|
|
37386
37390
|
};
|
|
37387
37391
|
pc.ontrack = (event) => {
|
|
37392
|
+
if (timing.firstTrackMs === void 0) timing.firstTrackMs = ms();
|
|
37388
37393
|
console.debug("[WebRTC] ontrack (client-offer)", event.track.kind, event.track.readyState);
|
|
37389
37394
|
combinedStream.addTrack(event.track);
|
|
37390
37395
|
if (seamless) {
|
|
@@ -37396,11 +37401,20 @@ function CameraStreamPlayer({ serverUrl, streamKey, label, autoPlay = true, mute
|
|
|
37396
37401
|
videoRef.current.play().catch(() => {});
|
|
37397
37402
|
}
|
|
37398
37403
|
};
|
|
37404
|
+
let timingLogged = false;
|
|
37399
37405
|
pc.oniceconnectionstatechange = () => {
|
|
37400
37406
|
if (!mountedRef.current) return;
|
|
37401
37407
|
const iceState = pc.iceConnectionState;
|
|
37402
37408
|
console.debug("[WebRTC] ICE state (client-offer):", iceState);
|
|
37403
37409
|
if (iceState === "connected" || iceState === "completed") {
|
|
37410
|
+
if (!timingLogged) {
|
|
37411
|
+
timingLogged = true;
|
|
37412
|
+
timing.iceConnectedMs = ms();
|
|
37413
|
+
console.info("[WebRTC timing] client-offer connected", {
|
|
37414
|
+
streamKey,
|
|
37415
|
+
...timing
|
|
37416
|
+
});
|
|
37417
|
+
}
|
|
37404
37418
|
reconnectAttemptsRef.current = 0;
|
|
37405
37419
|
if (seamless) swapInOnce();
|
|
37406
37420
|
updateState("playing");
|
|
@@ -37428,9 +37442,13 @@ function CameraStreamPlayer({ serverUrl, streamKey, label, autoPlay = true, mute
|
|
|
37428
37442
|
onControlChannelRef.current(control);
|
|
37429
37443
|
}
|
|
37430
37444
|
const offer = await pc.createOffer();
|
|
37445
|
+
timing.offerCreatedMs = ms();
|
|
37431
37446
|
await pc.setLocalDescription(offer);
|
|
37447
|
+
timing.localSetMs = ms();
|
|
37432
37448
|
if (!mountedRef.current || abort.signal.aborted) return;
|
|
37449
|
+
const signalingStart = ms();
|
|
37433
37450
|
const { sessionId: sid, sdpAnswer } = await handleOffer(pc.localDescription?.sdp ?? offer.sdp ?? "");
|
|
37451
|
+
timing.signalingRttMs = ms() - signalingStart;
|
|
37434
37452
|
sessionId = sid;
|
|
37435
37453
|
sessionIdsRef.current.add(sid);
|
|
37436
37454
|
activeSessionIdRef.current = sid;
|
|
@@ -37445,6 +37463,7 @@ function CameraStreamPlayer({ serverUrl, streamKey, label, autoPlay = true, mute
|
|
|
37445
37463
|
type: "answer",
|
|
37446
37464
|
sdp: sdpAnswer
|
|
37447
37465
|
});
|
|
37466
|
+
timing.answerSetMs = ms();
|
|
37448
37467
|
console.debug("[WebRTC] Client-offer answer set (trickle)", { sessionId: sid.slice(0, 8) });
|
|
37449
37468
|
if (getIceCandidates) {
|
|
37450
37469
|
const seen = /* @__PURE__ */ new Set();
|
package/dist/index.js
CHANGED
|
@@ -37337,8 +37337,12 @@ function CameraStreamPlayer({ serverUrl, streamKey, label, autoPlay = true, mute
|
|
|
37337
37337
|
updateState("connecting");
|
|
37338
37338
|
const abort = new AbortController();
|
|
37339
37339
|
connectAbortRef.current = abort;
|
|
37340
|
+
const t0 = performance.now();
|
|
37341
|
+
const ms = () => Math.round(performance.now() - t0);
|
|
37342
|
+
const timing = {};
|
|
37340
37343
|
try {
|
|
37341
37344
|
const iceServers = await getIceServers?.();
|
|
37345
|
+
timing.iceServersMs = ms();
|
|
37342
37346
|
if (!mountedRef.current || abort.signal.aborted) return;
|
|
37343
37347
|
const pc = new RTCPeerConnection({ iceServers: [...iceServers ?? [], { urls: "stun:stun.l.google.com:19302" }] });
|
|
37344
37348
|
if (!seamless) pcRef.current = pc;
|
|
@@ -37361,6 +37365,7 @@ function CameraStreamPlayer({ serverUrl, streamKey, label, autoPlay = true, mute
|
|
|
37361
37365
|
}
|
|
37362
37366
|
};
|
|
37363
37367
|
pc.ontrack = (event) => {
|
|
37368
|
+
if (timing.firstTrackMs === void 0) timing.firstTrackMs = ms();
|
|
37364
37369
|
console.debug("[WebRTC] ontrack (client-offer)", event.track.kind, event.track.readyState);
|
|
37365
37370
|
combinedStream.addTrack(event.track);
|
|
37366
37371
|
if (seamless) {
|
|
@@ -37372,11 +37377,20 @@ function CameraStreamPlayer({ serverUrl, streamKey, label, autoPlay = true, mute
|
|
|
37372
37377
|
videoRef.current.play().catch(() => {});
|
|
37373
37378
|
}
|
|
37374
37379
|
};
|
|
37380
|
+
let timingLogged = false;
|
|
37375
37381
|
pc.oniceconnectionstatechange = () => {
|
|
37376
37382
|
if (!mountedRef.current) return;
|
|
37377
37383
|
const iceState = pc.iceConnectionState;
|
|
37378
37384
|
console.debug("[WebRTC] ICE state (client-offer):", iceState);
|
|
37379
37385
|
if (iceState === "connected" || iceState === "completed") {
|
|
37386
|
+
if (!timingLogged) {
|
|
37387
|
+
timingLogged = true;
|
|
37388
|
+
timing.iceConnectedMs = ms();
|
|
37389
|
+
console.info("[WebRTC timing] client-offer connected", {
|
|
37390
|
+
streamKey,
|
|
37391
|
+
...timing
|
|
37392
|
+
});
|
|
37393
|
+
}
|
|
37380
37394
|
reconnectAttemptsRef.current = 0;
|
|
37381
37395
|
if (seamless) swapInOnce();
|
|
37382
37396
|
updateState("playing");
|
|
@@ -37404,9 +37418,13 @@ function CameraStreamPlayer({ serverUrl, streamKey, label, autoPlay = true, mute
|
|
|
37404
37418
|
onControlChannelRef.current(control);
|
|
37405
37419
|
}
|
|
37406
37420
|
const offer = await pc.createOffer();
|
|
37421
|
+
timing.offerCreatedMs = ms();
|
|
37407
37422
|
await pc.setLocalDescription(offer);
|
|
37423
|
+
timing.localSetMs = ms();
|
|
37408
37424
|
if (!mountedRef.current || abort.signal.aborted) return;
|
|
37425
|
+
const signalingStart = ms();
|
|
37409
37426
|
const { sessionId: sid, sdpAnswer } = await handleOffer(pc.localDescription?.sdp ?? offer.sdp ?? "");
|
|
37427
|
+
timing.signalingRttMs = ms() - signalingStart;
|
|
37410
37428
|
sessionId = sid;
|
|
37411
37429
|
sessionIdsRef.current.add(sid);
|
|
37412
37430
|
activeSessionIdRef.current = sid;
|
|
@@ -37421,6 +37439,7 @@ function CameraStreamPlayer({ serverUrl, streamKey, label, autoPlay = true, mute
|
|
|
37421
37439
|
type: "answer",
|
|
37422
37440
|
sdp: sdpAnswer
|
|
37423
37441
|
});
|
|
37442
|
+
timing.answerSetMs = ms();
|
|
37424
37443
|
console.debug("[WebRTC] Client-offer answer set (trickle)", { sessionId: sid.slice(0, 8) });
|
|
37425
37444
|
if (getIceCandidates) {
|
|
37426
37445
|
const seen = /* @__PURE__ */ new Set();
|