@genex-ai/multiplayer 0.8.3 → 0.8.4
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.js +10 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -233,7 +233,7 @@ function attachSession(client, initialRoom) {
|
|
|
233
233
|
const autoDelay = autoDelayById.get(streamKey) ?? 100;
|
|
234
234
|
const renderTime = localNow - (clockOffsets.get(streamKey) ?? 0) - autoDelay;
|
|
235
235
|
const sampled = buf && sampleBuffer(buf, renderTime);
|
|
236
|
-
if (!sampled) return
|
|
236
|
+
if (!sampled) return smoothed.get(streamKey);
|
|
237
237
|
const prev = smoothed.get(streamKey);
|
|
238
238
|
let out;
|
|
239
239
|
if (prev) {
|
|
@@ -256,6 +256,14 @@ function attachSession(client, initialRoom) {
|
|
|
256
256
|
intervalsById.delete(streamKey);
|
|
257
257
|
autoDelayById.delete(streamKey);
|
|
258
258
|
};
|
|
259
|
+
const clearStreamClock = (streamKey) => {
|
|
260
|
+
buffers.delete(streamKey);
|
|
261
|
+
lastStamp.delete(streamKey);
|
|
262
|
+
clockOffsets.delete(streamKey);
|
|
263
|
+
offsetWin.delete(streamKey);
|
|
264
|
+
intervalsById.delete(streamKey);
|
|
265
|
+
autoDelayById.delete(streamKey);
|
|
266
|
+
};
|
|
259
267
|
const emitters = /* @__PURE__ */ new Map();
|
|
260
268
|
const bridged = /* @__PURE__ */ new Set();
|
|
261
269
|
const reserved = /* @__PURE__ */ new Set([
|
|
@@ -298,7 +306,7 @@ function attachSession(client, initialRoom) {
|
|
|
298
306
|
else objOwners.delete(id);
|
|
299
307
|
if (owner !== room.sessionId) {
|
|
300
308
|
localObjState.delete(id);
|
|
301
|
-
|
|
309
|
+
clearStreamClock(key);
|
|
302
310
|
}
|
|
303
311
|
}
|
|
304
312
|
if (blob.d && typeof blob.d === "object" && Object.keys(blob.d).length > 0) {
|