@techsee/techsee-media-service 7.0.2 → 8.0.1
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/lib/MultiParty/MultiPartyService.d.ts +0 -12
- package/lib/MultiParty/MultiPartyService.d.ts.map +1 -1
- package/lib/MultiParty/MultiPartyService.js +1 -15
- package/lib/MultiParty/MultiPartyService.js.map +1 -1
- package/lib/MultiParty/MultipartyServiceEventTypes.d.ts +60 -0
- package/lib/MultiParty/MultipartyServiceEventTypes.d.ts.map +1 -0
- package/lib/MultiParty/MultipartyServiceEventTypes.js +20 -0
- package/lib/MultiParty/MultipartyServiceEventTypes.js.map +1 -0
- package/lib/MultiParty/OpentokMultiPartyService.d.ts +19 -5
- package/lib/MultiParty/OpentokMultiPartyService.d.ts.map +1 -1
- package/lib/MultiParty/OpentokMultiPartyService.js +160 -150
- package/lib/MultiParty/OpentokMultiPartyService.js.map +1 -1
- package/lib/MultiParty/index.d.ts +1 -0
- package/lib/MultiParty/index.d.ts.map +1 -1
- package/lib/MultiParty/index.js +2 -0
- package/lib/MultiParty/index.js.map +1 -1
- package/lib/MultiParty/opentok.d.ts +1 -1
- package/package.json +2 -2
|
@@ -214,7 +214,10 @@ var MediaCapabilitiesUtils_1 = require("./MediaCapabilitiesUtils");
|
|
|
214
214
|
|
|
215
215
|
var MultiPartyService_1 = require("./MultiPartyService");
|
|
216
216
|
|
|
217
|
-
var
|
|
217
|
+
var MultipartyServiceEventTypes_1 = require("./MultipartyServiceEventTypes");
|
|
218
|
+
|
|
219
|
+
var trace = MediaUtils_1.getMediaTracer('Multiparty');
|
|
220
|
+
var OPENTOK_MIRRORED_CSS_CLASS = 'OT_mirrored'; // The preferred camera position to use for the video source
|
|
218
221
|
|
|
219
222
|
var OpentokFacingMode;
|
|
220
223
|
|
|
@@ -233,6 +236,7 @@ function (_super) {
|
|
|
233
236
|
|
|
234
237
|
_this.getParticipantId = getParticipantId;
|
|
235
238
|
_this.subscriberList = [];
|
|
239
|
+
_this.mirror = true;
|
|
236
240
|
|
|
237
241
|
_this.connect = function (credentials) {
|
|
238
242
|
try {
|
|
@@ -259,11 +263,13 @@ function (_super) {
|
|
|
259
263
|
|
|
260
264
|
_this.traceErrorCallback(error);
|
|
261
265
|
|
|
262
|
-
|
|
266
|
+
var e = {
|
|
263
267
|
meta: {
|
|
264
268
|
err: JSON.stringify(error)
|
|
265
269
|
}
|
|
266
|
-
}
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
_this.emit(MultipartyServiceEventTypes_1.MULTI_PARTY_EVENTS.connectFailed, e);
|
|
267
273
|
|
|
268
274
|
return;
|
|
269
275
|
}
|
|
@@ -272,12 +278,13 @@ function (_super) {
|
|
|
272
278
|
});
|
|
273
279
|
} catch (err) {
|
|
274
280
|
trace.error(JSON.stringify(err));
|
|
275
|
-
|
|
276
|
-
_this.emit(MultiPartyService_1.MULTI_PARTY_EVENTS.connectFailed, {
|
|
281
|
+
var e = {
|
|
277
282
|
meta: {
|
|
278
283
|
err: JSON.stringify(err)
|
|
279
284
|
}
|
|
280
|
-
}
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
_this.emit(MultipartyServiceEventTypes_1.MULTI_PARTY_EVENTS.connectFailed, e);
|
|
281
288
|
}
|
|
282
289
|
};
|
|
283
290
|
|
|
@@ -477,7 +484,7 @@ function (_super) {
|
|
|
477
484
|
|
|
478
485
|
_this.switchCamera = function () {
|
|
479
486
|
return __awaiter(_this, void 0, void 0, function () {
|
|
480
|
-
var mediaCapabilitiesService, deviceId,
|
|
487
|
+
var mediaCapabilitiesService, deviceId, cameraSource_1, err_1;
|
|
481
488
|
|
|
482
489
|
var _this = this;
|
|
483
490
|
|
|
@@ -503,13 +510,15 @@ function (_super) {
|
|
|
503
510
|
|
|
504
511
|
switch (this.settings.selectedCamera) {
|
|
505
512
|
case MediaConstants_1.MultiPartyCameraTypes.BACK:
|
|
506
|
-
|
|
513
|
+
cameraSource_1 = MediaConstants_1.MultiPartyCameraTypes.FRONT;
|
|
507
514
|
deviceId = mediaCapabilitiesService.frontCameraDeviceId;
|
|
515
|
+
this.mirror = true;
|
|
508
516
|
break;
|
|
509
517
|
|
|
510
518
|
case MediaConstants_1.MultiPartyCameraTypes.FRONT:
|
|
511
|
-
|
|
519
|
+
cameraSource_1 = MediaConstants_1.MultiPartyCameraTypes.BACK;
|
|
512
520
|
deviceId = mediaCapabilitiesService.backCameraDeviceId;
|
|
521
|
+
this.mirror = !MediaCapabilitiesUtils_1.checkIsMobile();
|
|
513
522
|
break;
|
|
514
523
|
|
|
515
524
|
default:
|
|
@@ -519,13 +528,24 @@ function (_super) {
|
|
|
519
528
|
return [4
|
|
520
529
|
/*yield*/
|
|
521
530
|
, (_a = this.currentPublisher) === null || _a === void 0 ? void 0 : _a.setVideoSource(deviceId).then(function () {
|
|
522
|
-
|
|
531
|
+
var _a, _b, _c, _d;
|
|
523
532
|
|
|
524
|
-
_this.
|
|
525
|
-
|
|
526
|
-
|
|
533
|
+
_this.settings.selectedCamera = cameraSource_1;
|
|
534
|
+
|
|
535
|
+
if (_this.mirror) {
|
|
536
|
+
(_b = (_a = _this.currentPublisher) === null || _a === void 0 ? void 0 : _a.element) === null || _b === void 0 ? void 0 : _b.classList.add(OPENTOK_MIRRORED_CSS_CLASS);
|
|
537
|
+
} else {
|
|
538
|
+
(_d = (_c = _this.currentPublisher) === null || _c === void 0 ? void 0 : _c.element) === null || _d === void 0 ? void 0 : _d.classList.remove(OPENTOK_MIRRORED_CSS_CLASS);
|
|
539
|
+
}
|
|
527
540
|
|
|
528
|
-
|
|
541
|
+
var e = {
|
|
542
|
+
cameraSource: cameraSource_1,
|
|
543
|
+
mirror: _this.mirror
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
_this.emit(MultipartyServiceEventTypes_1.MULTI_PARTY_EVENTS.cameraSourceChanged, e);
|
|
547
|
+
|
|
548
|
+
trace.info("Success to switch camera to cameraSource: " + cameraSource_1);
|
|
529
549
|
})];
|
|
530
550
|
|
|
531
551
|
case 2:
|
|
@@ -571,6 +591,7 @@ function (_super) {
|
|
|
571
591
|
frontCameraDeviceId = mediaCapabilitiesService.frontCameraDeviceId, backCameraDeviceId = mediaCapabilitiesService.backCameraDeviceId;
|
|
572
592
|
videoSourceId = (selectedCamera === MediaConstants_1.MultiPartyCameraTypes.FRONT ? frontCameraDeviceId : backCameraDeviceId) || undefined;
|
|
573
593
|
mobileCameraType = settings.selectedCamera === MediaConstants_1.MultiPartyCameraTypes.FRONT ? OpentokFacingMode.USER : OpentokFacingMode.ENVIRONMENT;
|
|
594
|
+
this.mirror = !isMobile || settings.selectedCamera !== MediaConstants_1.MultiPartyCameraTypes.BACK;
|
|
574
595
|
this.currentPublisher = OT.initPublisher(this.getParticipantId(((_b = (_a = this.session) === null || _a === void 0 ? void 0 : _a.connection) === null || _b === void 0 ? void 0 : _b.connectionId) || ''), {
|
|
575
596
|
insertMode: 'append',
|
|
576
597
|
fitMode: 'cover',
|
|
@@ -585,7 +606,8 @@ function (_super) {
|
|
|
585
606
|
publishAudio: !settings.startWithAudioMuted,
|
|
586
607
|
publishVideo: settings.cameraEnabled,
|
|
587
608
|
videoSource: !isMobile ? videoSourceId : undefined,
|
|
588
|
-
facingMode: isMobile || !videoSourceId ? mobileCameraType : undefined
|
|
609
|
+
facingMode: isMobile || !videoSourceId ? mobileCameraType : undefined,
|
|
610
|
+
mirror: this.mirror
|
|
589
611
|
}, this.traceErrorCallback);
|
|
590
612
|
|
|
591
613
|
if (!this.currentPublisher) {
|
|
@@ -594,63 +616,61 @@ function (_super) {
|
|
|
594
616
|
this.currentPublisher.on('videoElementCreated', function (event) {
|
|
595
617
|
trace.info('videoElementCreated', event);
|
|
596
618
|
|
|
597
|
-
_this.emit(
|
|
619
|
+
_this.emit(MultipartyServiceEventTypes_1.MULTI_PARTY_EVENTS.videoElementCreated);
|
|
598
620
|
});
|
|
599
621
|
this.currentPublisher.on('streamDestroyed', function (event) {
|
|
600
|
-
var _a;
|
|
601
|
-
|
|
602
622
|
trace.info('Publisher stream destroyed', event);
|
|
623
|
+
var connection = event.stream.connection;
|
|
624
|
+
var connectionId = connection.connectionId;
|
|
625
|
+
var e = {
|
|
626
|
+
participantId: _this.getParticipantId(connectionId),
|
|
627
|
+
connectionId: connectionId,
|
|
628
|
+
isOwnConnection: true,
|
|
629
|
+
clientRole: _this.getClientRole(connection)
|
|
630
|
+
};
|
|
603
631
|
|
|
604
|
-
_this.emit(
|
|
605
|
-
event: event,
|
|
606
|
-
participantId: _this.getParticipantId((_a = event === null || event === void 0 ? void 0 : event.stream) === null || _a === void 0 ? void 0 : _a.connection.connectionId)
|
|
607
|
-
});
|
|
632
|
+
_this.emit(MultipartyServiceEventTypes_1.MULTI_PARTY_EVENTS.streamDestroyed, e);
|
|
608
633
|
});
|
|
609
|
-
this.currentPublisher.on('accessDenied', function (
|
|
610
|
-
|
|
634
|
+
this.currentPublisher.on('accessDenied', function () {
|
|
635
|
+
trace.info('Publisher denied media permissions');
|
|
636
|
+
var e = {
|
|
637
|
+
isOwnConnection: true
|
|
638
|
+
};
|
|
611
639
|
|
|
612
|
-
|
|
613
|
-
var connection = (_a = _this.session) === null || _a === void 0 ? void 0 : _a.connection;
|
|
614
|
-
var connectionId = connection === null || connection === void 0 ? void 0 : connection.connectionId;
|
|
615
|
-
|
|
616
|
-
var participantId = _this.getParticipantId(connectionId);
|
|
617
|
-
|
|
618
|
-
var isOwnConnection = _this.ownConnectionId === connectionId;
|
|
619
|
-
|
|
620
|
-
_this.emit(MultiPartyService_1.MULTI_PARTY_EVENTS.mediaDeviceAccessDenied, {
|
|
621
|
-
connectionId: connectionId,
|
|
622
|
-
isOwnConnection: isOwnConnection,
|
|
623
|
-
participantId: participantId
|
|
624
|
-
});
|
|
640
|
+
_this.emit(MultipartyServiceEventTypes_1.MULTI_PARTY_EVENTS.mediaDeviceAccessDenied, e);
|
|
625
641
|
});
|
|
626
642
|
this.currentPublisher.on('streamCreated', function (event) {
|
|
627
643
|
return __awaiter(_this, void 0, void 0, function () {
|
|
628
|
-
var participantId;
|
|
629
|
-
|
|
630
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
644
|
+
var _a, hasAudio, hasVideo, connectionId, participantId, clientRole, e;
|
|
631
645
|
|
|
632
|
-
return __generator(this, function (
|
|
633
|
-
switch (
|
|
646
|
+
return __generator(this, function (_b) {
|
|
647
|
+
switch (_b.label) {
|
|
634
648
|
case 0:
|
|
635
649
|
return [4
|
|
636
650
|
/*yield*/
|
|
637
651
|
, MediaCapabilitiesService_1.MediaCapabilitiesService.setDevicesList()];
|
|
638
652
|
|
|
639
653
|
case 1:
|
|
640
|
-
|
|
654
|
+
_b.sent();
|
|
641
655
|
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
656
|
+
_a = event.stream, hasAudio = _a.hasAudio, hasVideo = _a.hasVideo;
|
|
657
|
+
connectionId = event.stream.connection.connectionId;
|
|
658
|
+
participantId = this.getParticipantId(connectionId);
|
|
659
|
+
clientRole = this.getClientRole(event.stream.connection);
|
|
660
|
+
e = {
|
|
645
661
|
participantId: participantId,
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
hasVideo:
|
|
649
|
-
|
|
650
|
-
|
|
662
|
+
clientRole: clientRole,
|
|
663
|
+
connectionId: connectionId,
|
|
664
|
+
hasVideo: hasVideo,
|
|
665
|
+
hasAudio: hasAudio,
|
|
666
|
+
isOwnConnection: true,
|
|
667
|
+
audioEnabled: !this.settings.startWithAudioMuted,
|
|
668
|
+
mirror: this.mirror
|
|
669
|
+
};
|
|
670
|
+
this.emit(MultipartyServiceEventTypes_1.MULTI_PARTY_EVENTS.streamCreated, e);
|
|
651
671
|
trace.info('publisher stream created', {
|
|
652
672
|
event: event,
|
|
653
|
-
hasAudio:
|
|
673
|
+
hasAudio: hasAudio,
|
|
654
674
|
participantId: participantId
|
|
655
675
|
});
|
|
656
676
|
return [2
|
|
@@ -682,68 +702,51 @@ function (_super) {
|
|
|
682
702
|
|
|
683
703
|
_this.reinitializeStreams = function (settings) {
|
|
684
704
|
return __awaiter(_this, void 0, void 0, function () {
|
|
685
|
-
var
|
|
686
|
-
|
|
687
|
-
return __generator(this, function (_a) {
|
|
688
|
-
switch (_a.label) {
|
|
689
|
-
case 0:
|
|
690
|
-
if (!this.session) {
|
|
691
|
-
return [2
|
|
692
|
-
/*return*/
|
|
693
|
-
];
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
if (this.currentPublisher) {
|
|
697
|
-
this.currentPublisher.destroy();
|
|
698
|
-
this.currentPublisher = undefined;
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
return [4
|
|
702
|
-
/*yield*/
|
|
703
|
-
, this.createPublisher(settings)];
|
|
705
|
+
var _a;
|
|
704
706
|
|
|
705
|
-
|
|
706
|
-
|
|
707
|
+
return __generator(this, function (_b) {
|
|
708
|
+
if (!this.session) {
|
|
709
|
+
return [2
|
|
710
|
+
/*return*/
|
|
711
|
+
];
|
|
712
|
+
}
|
|
707
713
|
|
|
708
|
-
|
|
709
|
-
|
|
714
|
+
this.subscriberList.map(function (s) {
|
|
715
|
+
return s.subscriber;
|
|
716
|
+
}).forEach((_a = this.session) === null || _a === void 0 ? void 0 : _a.unsubscribe);
|
|
717
|
+
this.subscriberList = [];
|
|
710
718
|
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
(_a = _this.session) === null || _a === void 0 ? void 0 : _a.unsubscribe(subscriber);
|
|
715
|
-
return __assign(__assign({}, s), {
|
|
716
|
-
subscriber: _this.createSubscriber(stream, connectionId)
|
|
717
|
-
});
|
|
718
|
-
});
|
|
719
|
-
return [2
|
|
720
|
-
/*return*/
|
|
721
|
-
];
|
|
719
|
+
if (this.currentPublisher) {
|
|
720
|
+
this.currentPublisher.destroy();
|
|
721
|
+
this.currentPublisher = undefined;
|
|
722
722
|
}
|
|
723
|
+
|
|
724
|
+
return [2
|
|
725
|
+
/*return*/
|
|
726
|
+
, this.createPublisher(settings)];
|
|
723
727
|
});
|
|
724
728
|
});
|
|
725
729
|
};
|
|
726
730
|
|
|
727
731
|
_this.streamCreatedHandler = function (event) {
|
|
728
732
|
return __awaiter(_this, void 0, void 0, function () {
|
|
729
|
-
var stream, connection, connectionId, participantId, subscriber;
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
return __generator(this, function (_c) {
|
|
734
|
-
switch (_c.label) {
|
|
733
|
+
var stream, connection, connectionId, hasAudio, hasVideo, participantId, clientRole, subscriber, e;
|
|
734
|
+
return __generator(this, function (_a) {
|
|
735
|
+
switch (_a.label) {
|
|
735
736
|
case 0:
|
|
736
737
|
trace.info('streamCreatedHandler', event.stream);
|
|
737
738
|
stream = event.stream;
|
|
738
739
|
connection = stream.connection;
|
|
739
740
|
connectionId = connection.connectionId;
|
|
741
|
+
hasAudio = stream.hasAudio, hasVideo = stream.hasVideo;
|
|
740
742
|
participantId = this.getParticipantId(connectionId);
|
|
743
|
+
clientRole = this.getClientRole(connection);
|
|
741
744
|
return [4
|
|
742
745
|
/*yield*/
|
|
743
746
|
, MediaCapabilitiesService_1.MediaCapabilitiesService.setDevicesList()];
|
|
744
747
|
|
|
745
748
|
case 1:
|
|
746
|
-
|
|
749
|
+
_a.sent();
|
|
747
750
|
|
|
748
751
|
if (this.ownConnectionId && stream && connectionId !== this.ownConnectionId) {
|
|
749
752
|
if (this.subscriberList.length < MultiPartyService_1.maxParticipantsNumber - 1) {
|
|
@@ -751,21 +754,24 @@ function (_super) {
|
|
|
751
754
|
this.subscriberList.push({
|
|
752
755
|
subscriber: subscriber,
|
|
753
756
|
connectionId: connectionId,
|
|
754
|
-
clientRole:
|
|
757
|
+
clientRole: clientRole
|
|
755
758
|
});
|
|
756
759
|
} else {
|
|
757
760
|
trace.info("a new subscriber cannot be added, as the number of participants reached its limit: " + MultiPartyService_1.maxParticipantsNumber);
|
|
758
761
|
}
|
|
759
762
|
}
|
|
760
763
|
|
|
761
|
-
|
|
762
|
-
event: event,
|
|
764
|
+
e = {
|
|
763
765
|
participantId: participantId,
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
hasVideo:
|
|
767
|
-
hasAudio:
|
|
768
|
-
|
|
766
|
+
clientRole: clientRole,
|
|
767
|
+
connectionId: connectionId,
|
|
768
|
+
hasVideo: hasVideo,
|
|
769
|
+
hasAudio: hasAudio,
|
|
770
|
+
isOwnConnection: false,
|
|
771
|
+
audioEnabled: !this.settings.startWithAudioMuted,
|
|
772
|
+
mirror: false
|
|
773
|
+
};
|
|
774
|
+
this.emit(MultipartyServiceEventTypes_1.MULTI_PARTY_EVENTS.streamCreated, e);
|
|
769
775
|
return [2
|
|
770
776
|
/*return*/
|
|
771
777
|
];
|
|
@@ -774,80 +780,81 @@ function (_super) {
|
|
|
774
780
|
});
|
|
775
781
|
};
|
|
776
782
|
|
|
777
|
-
_this.streamPropertyChangedHandler = function (event) {
|
|
778
|
-
var _a;
|
|
779
|
-
|
|
780
|
-
trace.info('streamPropertyChangedHandler', event);
|
|
781
|
-
var stream = event.stream;
|
|
782
|
-
|
|
783
|
-
_this.emit(MultiPartyService_1.MULTI_PARTY_EVENTS.videoAudioStatus, {
|
|
784
|
-
hasVideo: stream === null || stream === void 0 ? void 0 : stream.hasVideo,
|
|
785
|
-
hasAudio: stream === null || stream === void 0 ? void 0 : stream.hasAudio,
|
|
786
|
-
participantId: _this.getParticipantId(stream === null || stream === void 0 ? void 0 : stream.connection.connectionId),
|
|
787
|
-
isOwnConnection: _this.ownConnectionId === ((_a = stream === null || stream === void 0 ? void 0 : stream.connection) === null || _a === void 0 ? void 0 : _a.connectionId),
|
|
788
|
-
stream: stream
|
|
789
|
-
});
|
|
790
|
-
};
|
|
791
|
-
|
|
792
783
|
_this.streamDestroyedHandler = function (event) {
|
|
793
|
-
var _a;
|
|
794
|
-
|
|
795
784
|
trace.info('streamDestroyedHandler', event);
|
|
796
|
-
var
|
|
797
|
-
var
|
|
785
|
+
var connection = event.stream.connection;
|
|
786
|
+
var connectionId = connection.connectionId;
|
|
787
|
+
var e = {
|
|
788
|
+
participantId: _this.getParticipantId(connectionId),
|
|
789
|
+
connectionId: connectionId,
|
|
790
|
+
isOwnConnection: false,
|
|
791
|
+
clientRole: _this.getClientRole(connection)
|
|
792
|
+
};
|
|
798
793
|
_this.subscriberList = _this.subscriberList.filter(function (subscriber) {
|
|
799
|
-
return subscriber.connectionId !==
|
|
794
|
+
return subscriber.connectionId !== connectionId;
|
|
800
795
|
});
|
|
801
796
|
|
|
802
|
-
_this.emit(
|
|
803
|
-
event: event,
|
|
804
|
-
participantId: _this.getParticipantId((_a = event === null || event === void 0 ? void 0 : event.stream) === null || _a === void 0 ? void 0 : _a.connection.connectionId)
|
|
805
|
-
});
|
|
797
|
+
_this.emit(MultipartyServiceEventTypes_1.MULTI_PARTY_EVENTS.streamDestroyed, e);
|
|
806
798
|
};
|
|
807
799
|
|
|
808
800
|
_this.connectionCreatedHandler = function (event) {
|
|
809
801
|
trace.info('connectionCreatedHandler', event);
|
|
810
802
|
var connection = event.connection;
|
|
803
|
+
var connectionId = connection.connectionId;
|
|
811
804
|
|
|
812
805
|
if (!_this.ownConnectionId || !connection) {
|
|
813
806
|
return;
|
|
814
807
|
}
|
|
815
808
|
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
809
|
+
var e = {
|
|
810
|
+
clientRole: _this.getClientRole(connection),
|
|
811
|
+
participantId: _this.getParticipantId(connectionId),
|
|
812
|
+
connectionId: connectionId,
|
|
813
|
+
isOwnConnection: _this.checkOwnConnection(connectionId)
|
|
814
|
+
};
|
|
819
815
|
|
|
820
|
-
_this.emit(
|
|
821
|
-
clientRole: clientRole,
|
|
822
|
-
event: event,
|
|
823
|
-
participantId: _this.getParticipantId(connection.connectionId),
|
|
824
|
-
isOwnConnection: _this.ownConnectionId === connection.connectionId
|
|
825
|
-
});
|
|
816
|
+
_this.emit(MultipartyServiceEventTypes_1.MULTI_PARTY_EVENTS.connectionCreated, e);
|
|
826
817
|
};
|
|
827
818
|
|
|
828
819
|
_this.connectionDestroyedHandler = function (event) {
|
|
829
820
|
var connection = event.connection;
|
|
830
|
-
|
|
831
|
-
var clientRole = _this.getClientRole(connection);
|
|
832
|
-
|
|
821
|
+
var connectionId = connection.connectionId;
|
|
833
822
|
trace.info('connectionDestroyedHandler', event);
|
|
823
|
+
var e = {
|
|
824
|
+
clientRole: _this.getClientRole(connection),
|
|
825
|
+
participantId: _this.getParticipantId(connectionId),
|
|
826
|
+
connectionId: connectionId,
|
|
827
|
+
isOwnConnection: _this.checkOwnConnection(connectionId)
|
|
828
|
+
};
|
|
834
829
|
|
|
835
|
-
_this.emit(
|
|
836
|
-
clientRole: clientRole,
|
|
837
|
-
event: event,
|
|
838
|
-
participantId: _this.getParticipantId(event === null || event === void 0 ? void 0 : event.connection.connectionId),
|
|
839
|
-
isOwnConnection: _this.ownConnectionId === connection.connectionId
|
|
840
|
-
});
|
|
830
|
+
_this.emit(MultipartyServiceEventTypes_1.MULTI_PARTY_EVENTS.connectionDestroyed, e);
|
|
841
831
|
|
|
842
|
-
if (
|
|
832
|
+
if (connectionId !== _this.ownConnectionId || !_this.ownConnectionId) {
|
|
843
833
|
return;
|
|
844
834
|
}
|
|
845
835
|
|
|
846
|
-
_this.emit(MultiPartyService_1.MULTI_PARTY_EVENTS.participantsNumberChanged, _this.subscriberList.length);
|
|
847
|
-
|
|
848
836
|
_this.session = undefined;
|
|
849
837
|
};
|
|
850
838
|
|
|
839
|
+
_this.streamPropertyChangedHandler = function (event) {
|
|
840
|
+
trace.info('streamPropertyChangedHandler', event);
|
|
841
|
+
var _a = event.stream,
|
|
842
|
+
hasVideo = _a.hasVideo,
|
|
843
|
+
hasAudio = _a.hasAudio,
|
|
844
|
+
connection = _a.connection;
|
|
845
|
+
var connectionId = connection.connectionId;
|
|
846
|
+
var e = {
|
|
847
|
+
hasVideo: hasVideo,
|
|
848
|
+
hasAudio: hasAudio,
|
|
849
|
+
participantId: _this.getParticipantId(connectionId),
|
|
850
|
+
connectionId: connectionId,
|
|
851
|
+
isOwnConnection: _this.checkOwnConnection(connectionId),
|
|
852
|
+
clientRole: _this.getClientRole(connection)
|
|
853
|
+
};
|
|
854
|
+
|
|
855
|
+
_this.emit(MultipartyServiceEventTypes_1.MULTI_PARTY_EVENTS.streamPropertyChanged, e);
|
|
856
|
+
};
|
|
857
|
+
|
|
851
858
|
_this.traceErrorCallback = function (error) {
|
|
852
859
|
trace.error(JSON.stringify(error));
|
|
853
860
|
};
|
|
@@ -874,15 +881,18 @@ function (_super) {
|
|
|
874
881
|
}
|
|
875
882
|
}, function (err) {
|
|
876
883
|
_this.traceErrorCallback(err);
|
|
877
|
-
|
|
878
|
-
subscriber === null || subscriber === void 0 ? void 0 : subscriber.on('videoElementCreated', function (event) {
|
|
879
|
-
trace.info('videoElementCreated', event);
|
|
880
|
-
});
|
|
881
884
|
});
|
|
882
885
|
|
|
886
|
+
subscriber.on('videoElementCreated', function (event) {
|
|
887
|
+
trace.info('videoElementCreated', event);
|
|
888
|
+
});
|
|
883
889
|
return subscriber;
|
|
884
890
|
};
|
|
885
891
|
|
|
892
|
+
_this.checkOwnConnection = function (connectionId) {
|
|
893
|
+
return _this.ownConnectionId !== undefined && _this.ownConnectionId === connectionId;
|
|
894
|
+
};
|
|
895
|
+
|
|
886
896
|
_this.branding = settings.branding;
|
|
887
897
|
return _this;
|
|
888
898
|
}
|