@3dsource/angular-unreal-module 0.0.155 → 0.0.156
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.
|
@@ -3328,7 +3328,8 @@ class WebRtcPlayerService extends SubService {
|
|
|
3328
3328
|
* (`pc.onicecandidate`, `dc.onmessage`, …) and buffered inbound DC messages;
|
|
3329
3329
|
* here we detach those, wire our own (addEventListener-based) handlers, replay
|
|
3330
3330
|
* the buffer in order, then drive `onDataChannelConnected` manually because the
|
|
3331
|
-
* DataChannel is already open
|
|
3331
|
+
* DataChannel is already open. A native `open` event may still be queued, so the
|
|
3332
|
+
* adopted channel deliberately does not subscribe to it.
|
|
3332
3333
|
*/
|
|
3333
3334
|
adopt(pc, dc, stream, config, dcBuffer) {
|
|
3334
3335
|
// No prior pc/dc should exist on a fresh boot; closePC is idempotent.
|
|
@@ -3353,7 +3354,9 @@ class WebRtcPlayerService extends SubService {
|
|
|
3353
3354
|
dc.onmessage = null;
|
|
3354
3355
|
dc.onopen = null;
|
|
3355
3356
|
dc.onclose = null;
|
|
3356
|
-
|
|
3357
|
+
// Adoption announces the already-open channel manually below. Do not
|
|
3358
|
+
// subscribe to a native `open` event that may still be queued.
|
|
3359
|
+
this.dcClient = this.setupDataChannelCallbacks(dc, false);
|
|
3357
3360
|
for (const buffered of dcBuffer) {
|
|
3358
3361
|
this.onDataChannelMessage$.next(buffered);
|
|
3359
3362
|
}
|
|
@@ -3497,7 +3500,7 @@ class WebRtcPlayerService extends SubService {
|
|
|
3497
3500
|
}
|
|
3498
3501
|
}
|
|
3499
3502
|
}
|
|
3500
|
-
setupDataChannelCallbacks(datachannel) {
|
|
3503
|
+
setupDataChannelCallbacks(datachannel, subscribeToOpen = true) {
|
|
3501
3504
|
try {
|
|
3502
3505
|
Logger.log(`[DATACHANNEL] Setting up datachannel "${datachannel.label}" callbacks...`);
|
|
3503
3506
|
this.commandTelemetryService.trackStartCommand('EXT-DataChannel Connection');
|
|
@@ -3520,14 +3523,16 @@ class WebRtcPlayerService extends SubService {
|
|
|
3520
3523
|
const message = `[DATACHANNEL] Data channel "${datachannel.label}" error. id:${datachannel.id}`;
|
|
3521
3524
|
Logger.error(message, e);
|
|
3522
3525
|
});
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3526
|
+
if (subscribeToOpen) {
|
|
3527
|
+
fromEvent(datachannel, 'open')
|
|
3528
|
+
.pipe(tap$1(() => {
|
|
3529
|
+
Logger.info(`[DATACHANNEL] Data channel "${datachannel.label}" connected. id:${datachannel.id}`);
|
|
3530
|
+
}), takeUntil(merge(this.disconnect$, this.destroy$)))
|
|
3531
|
+
.subscribe(() => {
|
|
3532
|
+
this.commandTelemetryService.trackStopCommand('EXT-DataChannel Connection');
|
|
3533
|
+
this.onDataChannelConnected();
|
|
3534
|
+
});
|
|
3535
|
+
}
|
|
3531
3536
|
fromEvent(datachannel, 'message')
|
|
3532
3537
|
.pipe(
|
|
3533
3538
|
/* tap((e: MessageEvent) => {
|