@techsee/techsee-media-service 11.0.0 → 12.1.0
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/MediaConstants.d.ts +10 -0
- package/lib/MediaConstants.d.ts.map +1 -1
- package/lib/MediaConstants.js +17 -1
- package/lib/MediaConstants.js.map +1 -1
- package/lib/MediaContracts.d.ts +4 -0
- package/lib/MediaContracts.d.ts.map +1 -1
- package/lib/MediaSubscriber.d.ts.map +1 -1
- package/lib/MediaSubscriber.js +8 -1
- package/lib/MediaSubscriber.js.map +1 -1
- package/lib/MediaUtils/MediaDomUtils.d.ts +3 -2
- package/lib/MediaUtils/MediaDomUtils.d.ts.map +1 -1
- package/lib/MediaUtils/MediaDomUtils.js +20 -1
- package/lib/MediaUtils/MediaDomUtils.js.map +1 -1
- package/lib/MultiParty/DetectWebRtcService.d.ts +16 -14
- package/lib/MultiParty/DetectWebRtcService.d.ts.map +1 -1
- package/lib/MultiParty/DetectWebRtcService.js +221 -44
- package/lib/MultiParty/DetectWebRtcService.js.map +1 -1
- package/lib/MultiParty/MediaCapabilitiesService.d.ts +6 -12
- package/lib/MultiParty/MediaCapabilitiesService.d.ts.map +1 -1
- package/lib/MultiParty/MediaCapabilitiesService.js +58 -119
- package/lib/MultiParty/MediaCapabilitiesService.js.map +1 -1
- package/lib/MultiParty/MediaCapabilitiesUtils.d.ts.map +1 -1
- package/lib/MultiParty/MediaCapabilitiesUtils.js +2 -2
- package/lib/MultiParty/MediaCapabilitiesUtils.js.map +1 -1
- package/lib/MultiParty/MediaTracer.d.ts +3 -0
- package/lib/MultiParty/MediaTracer.d.ts.map +1 -0
- package/lib/MultiParty/MediaTracer.js +17 -0
- package/lib/MultiParty/MediaTracer.js.map +1 -0
- package/lib/MultiParty/MultiPartyService.d.ts +2 -2
- package/lib/MultiParty/MultiPartyService.d.ts.map +1 -1
- package/lib/MultiParty/MultiPartyServiceFactory.d.ts +1 -1
- package/lib/MultiParty/MultiPartyServiceFactory.d.ts.map +1 -1
- package/lib/MultiParty/MultiPartyServiceFactory.js +2 -2
- package/lib/MultiParty/MultiPartyServiceFactory.js.map +1 -1
- package/lib/MultiParty/MultipartyServiceEventTypes.d.ts +1 -1
- package/lib/MultiParty/MultipartyServiceEventTypes.d.ts.map +1 -1
- package/lib/MultiParty/MultipartyServiceEventTypes.js +13 -13
- package/lib/MultiParty/MultipartyServiceEventTypes.js.map +1 -1
- package/lib/MultiParty/index.d.ts +2 -0
- package/lib/MultiParty/index.d.ts.map +1 -1
- package/lib/MultiParty/index.js +4 -0
- package/lib/MultiParty/index.js.map +1 -1
- package/lib/MultiParty/opentok/OpentokMultiPartyService.d.ts +6 -18
- package/lib/MultiParty/opentok/OpentokMultiPartyService.d.ts.map +1 -1
- package/lib/MultiParty/opentok/OpentokMultiPartyService.js +72 -77
- package/lib/MultiParty/opentok/OpentokMultiPartyService.js.map +1 -1
- package/lib/MultiParty/opentok/OpentokPublisher.d.ts +14 -4
- package/lib/MultiParty/opentok/OpentokPublisher.d.ts.map +1 -1
- package/lib/MultiParty/opentok/OpentokPublisher.js +49 -84
- package/lib/MultiParty/opentok/OpentokPublisher.js.map +1 -1
- package/lib/MultiParty/opentok/OpentokPublisherEventMapper.d.ts +18 -0
- package/lib/MultiParty/opentok/OpentokPublisherEventMapper.d.ts.map +1 -0
- package/lib/MultiParty/opentok/OpentokPublisherEventMapper.js +66 -0
- package/lib/MultiParty/opentok/OpentokPublisherEventMapper.js.map +1 -0
- package/lib/MultiParty/opentok/OpentokSubscriber.js +2 -0
- package/lib/MultiParty/opentok/OpentokSubscriber.js.map +1 -1
- package/lib/MultiParty/opentok/trace.d.ts.map +1 -1
- package/lib/MultiParty/opentok/trace.js +2 -2
- package/lib/MultiParty/opentok/trace.js.map +1 -1
- package/lib/MultiParty/{Contracts.d.ts → types.d.ts} +8 -1
- package/lib/MultiParty/types.d.ts.map +1 -0
- package/lib/MultiParty/{Contracts.js → types.js} +1 -1
- package/lib/MultiParty/types.js.map +1 -0
- package/lib/MultiParty/utils.d.ts +3 -0
- package/lib/MultiParty/utils.d.ts.map +1 -0
- package/lib/MultiParty/utils.js +21 -0
- package/lib/MultiParty/utils.js.map +1 -0
- package/package.json +3 -3
- package/lib/MultiParty/Contracts.d.ts.map +0 -1
- package/lib/MultiParty/Contracts.js.map +0 -1
- package/lib/MultiParty/opentok/OpentokUtils.d.ts +0 -2
- package/lib/MultiParty/opentok/OpentokUtils.d.ts.map +0 -1
- package/lib/MultiParty/opentok/OpentokUtils.js +0 -17
- package/lib/MultiParty/opentok/OpentokUtils.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/MultiParty/MultiPartyServiceFactory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/MultiParty/MultiPartyServiceFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,SAAS,CAAC;AACxC,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAItD,eAAO,MAAM,uBAAuB,aACtB,eAAe,8DACuB,MAAM,KACvD,iBAMF,CAAC","file":"MultiPartyServiceFactory.d.ts","sourcesContent":["import {SessionSettings} from './types';\nimport {MultiPartyService} from './MultiPartyService';\nimport {OpentokMultiPartyService} from './opentok/OpentokMultiPartyService';\nimport {MediaServiceType} from '../MediaConstants';\n\nexport const createMultiPartyService = (\n settings: SessionSettings,\n getParticipantDomId: (connectionId?: string) => string\n): MultiPartyService => {\n if (settings.mediaServiceType === MediaServiceType.OPENTOK) {\n return new OpentokMultiPartyService(getParticipantDomId);\n }\n\n throw new Error('NOT_SUPPORTED');\n};\n"]}
|
|
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.createMultiPartyService = void 0;
|
|
7
7
|
|
|
8
|
-
var MediaConstants_1 = require("../MediaConstants");
|
|
9
|
-
|
|
10
8
|
var OpentokMultiPartyService_1 = require("./opentok/OpentokMultiPartyService");
|
|
11
9
|
|
|
10
|
+
var MediaConstants_1 = require("../MediaConstants");
|
|
11
|
+
|
|
12
12
|
var createMultiPartyService = function createMultiPartyService(settings, getParticipantDomId) {
|
|
13
13
|
if (settings.mediaServiceType === MediaConstants_1.MediaServiceType.OPENTOK) {
|
|
14
14
|
return new OpentokMultiPartyService_1.OpentokMultiPartyService(getParticipantDomId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["MultiParty/MultiPartyServiceFactory.js"],"names":["Object","defineProperty","exports","value","createMultiPartyService","
|
|
1
|
+
{"version":3,"sources":["MultiParty/MultiPartyServiceFactory.js"],"names":["Object","defineProperty","exports","value","createMultiPartyService","OpentokMultiPartyService_1","require","MediaConstants_1","settings","getParticipantDomId","mediaServiceType","MediaServiceType","OPENTOK","OpentokMultiPartyService","Error"],"mappings":"AAAA;;AACAA,MAAM,CAACC,cAAP,CAAsBC,OAAtB,EAA+B,YAA/B,EAA6C;AAAEC,EAAAA,KAAK,EAAE;AAAT,CAA7C;AACAD,OAAO,CAACE,uBAAR,GAAkC,KAAK,CAAvC;;AACA,IAAIC,0BAA0B,GAAGC,OAAO,CAAC,oCAAD,CAAxC;;AACA,IAAIC,gBAAgB,GAAGD,OAAO,CAAC,mBAAD,CAA9B;;AACA,IAAIF,uBAAuB,GAAG,SAA1BA,uBAA0B,CAAUI,QAAV,EAAoBC,mBAApB,EAAyC;AACnE,MAAID,QAAQ,CAACE,gBAAT,KAA8BH,gBAAgB,CAACI,gBAAjB,CAAkCC,OAApE,EAA6E;AACzE,WAAO,IAAIP,0BAA0B,CAACQ,wBAA/B,CAAwDJ,mBAAxD,CAAP;AACH;;AACD,QAAM,IAAIK,KAAJ,CAAU,eAAV,CAAN;AACH,CALD;;AAMAZ,OAAO,CAACE,uBAAR,GAAkCA,uBAAlC","file":"MultiPartyServiceFactory.js","sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createMultiPartyService = void 0;\nvar OpentokMultiPartyService_1 = require(\"./opentok/OpentokMultiPartyService\");\nvar MediaConstants_1 = require(\"../MediaConstants\");\nvar createMultiPartyService = function (settings, getParticipantDomId) {\n if (settings.mediaServiceType === MediaConstants_1.MediaServiceType.OPENTOK) {\n return new OpentokMultiPartyService_1.OpentokMultiPartyService(getParticipantDomId);\n }\n throw new Error('NOT_SUPPORTED');\n};\nexports.createMultiPartyService = createMultiPartyService;\n\n//# sourceMappingURL=MultiPartyServiceFactory.js.map\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MultiPartyCameraTypes, SessionClientRole } from '../MediaConstants';
|
|
2
|
-
export declare enum
|
|
2
|
+
export declare enum MultiPartyServiceEventTypes {
|
|
3
3
|
connectFailed = "connectFailed",
|
|
4
4
|
streamDestroyed = "streamDestroyed",
|
|
5
5
|
connectionCreated = "connectionCreated",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/MultiParty/MultipartyServiceEventTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,qBAAqB,EAAE,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAE3E,oBAAY,
|
|
1
|
+
{"version":3,"sources":["../src/MultiParty/MultipartyServiceEventTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,qBAAqB,EAAE,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAE3E,oBAAY,2BAA2B;IACnC,aAAa,kBAAkB;IAC/B,eAAe,oBAAoB;IACnC,iBAAiB,sBAAsB;IACvC,mBAAmB,wBAAwB;IAC3C,aAAa,kBAAkB;IAC/B,mBAAmB,wBAAwB;IAC3C,qBAAqB,0BAA0B;IAC/C,uBAAuB,4BAA4B;IACnD,mBAAmB,wBAAwB;CAC9C;AAED,oBAAY,mCAAmC,GAAG;IAC9C,IAAI,EAAE;QACF,GAAG,EAAE,MAAM,CAAC;KACf,CAAC;CACL,CAAC;AAEF,oBAAY,uCAAuC,GAAG;IAClD,eAAe,EAAE,OAAO,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,iBAAiB,CAAC;CACjC,CAAC;AAEF,oBAAY,yCAAyC,GAAG;IACpD,eAAe,EAAE,OAAO,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,iBAAiB,CAAC;CACjC,CAAC;AAEF,oBAAY,mCAAmC,GAAG;IAC9C,eAAe,EAAE,OAAO,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,iBAAiB,CAAC;IAC9B,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,eAAe,EAAE;QACb,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAClB,CAAC;CACL,CAAC;AAEF,oBAAY,qCAAqC,GAAG;IAChD,eAAe,EAAE,OAAO,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,iBAAiB,CAAC;CACjC,CAAC;AAEF,oBAAY,2CAA2C,GAAG;IACtD,eAAe,EAAE,OAAO,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,iBAAiB,CAAC;IAC9B,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE;QACb,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAClB,CAAC;CACL,CAAC;AAEF,oBAAY,yCAAyC,GAAG;IACpD,YAAY,EAAE,qBAAqB,CAAC;IACpC,MAAM,EAAE,OAAO,CAAC;IAChB,eAAe,EAAE;QACb,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAClB,CAAC;CACL,CAAC;AAEF,oBAAY,uCAAuC,GAAG;IAClD,eAAe,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,MAAM,WAAW,8BAA8B;IAC3C,iBAAiB,EAAE,uCAAuC,CAAC;IAC3D,mBAAmB,EAAE,yCAAyC,CAAC;IAC/D,aAAa,EAAE,mCAAmC,CAAC;IACnD,eAAe,EAAE,qCAAqC,CAAC;IACvD,aAAa,EAAE,mCAAmC,CAAC;IACnD,mBAAmB,EAAE,IAAI,CAAC;IAC1B,qBAAqB,EAAE,2CAA2C,CAAC;IACnE,uBAAuB,EAAE,uCAAuC,CAAC;IACjE,mBAAmB,EAAE,yCAAyC,CAAC;CAClE","file":"MultipartyServiceEventTypes.d.ts","sourcesContent":["import {MultiPartyCameraTypes, SessionClientRole} from '../MediaConstants';\n\nexport enum MultiPartyServiceEventTypes {\n connectFailed = 'connectFailed',\n streamDestroyed = 'streamDestroyed',\n connectionCreated = 'connectionCreated',\n connectionDestroyed = 'connectionDestroyed',\n streamCreated = 'streamCreated',\n videoElementCreated = 'videoElementCreated',\n streamPropertyChanged = 'streamPropertyChanged',\n mediaDeviceAccessDenied = 'mediaDeviceAccessDenied',\n cameraSourceChanged = 'cameraSourceChanged'\n}\n\nexport type MultipartyServiceConnectFailedEvent = {\n meta: {\n err: string;\n };\n};\n\nexport type MultipartyServiceConnectionCreatedEvent = {\n isOwnConnection: boolean;\n connectionId: string;\n participantId: string;\n clientRole: SessionClientRole;\n};\n\nexport type MultipartyServiceConnectionDestroyedEvent = {\n isOwnConnection: boolean;\n connectionId: string;\n participantId: string;\n clientRole: SessionClientRole;\n};\n\nexport type MultipartyServiceStreamCreatedEvent = {\n isOwnConnection: boolean;\n connectionId: string;\n participantId: string;\n clientRole: SessionClientRole;\n hasVideo: boolean;\n hasAudio: boolean;\n mirror: boolean;\n videoDimensions: {\n width: number;\n height: number;\n };\n};\n\nexport type MultipartyServiceStreamDestroyedEvent = {\n isOwnConnection: boolean;\n connectionId: string;\n participantId: string;\n clientRole: SessionClientRole;\n};\n\nexport type MultipartyServiceStreamPropertyChangedEvent = {\n isOwnConnection: boolean;\n connectionId: string;\n participantId: string;\n clientRole: SessionClientRole;\n hasVideo: boolean;\n hasAudio: boolean;\n videoDimensions: {\n width: number;\n height: number;\n };\n};\n\nexport type MultipartyServiceCameraSourceChangedEvent = {\n cameraSource: MultiPartyCameraTypes;\n mirror: boolean;\n videoDimensions: {\n width: number;\n height: number;\n };\n};\n\nexport type MultipartyServiceMediaAccessDeniedEvent = {\n isOwnConnection: boolean;\n};\n\nexport interface MultipartyServiceEventTypesMap {\n connectionCreated: MultipartyServiceConnectionCreatedEvent;\n connectionDestroyed: MultipartyServiceConnectionDestroyedEvent;\n connectFailed: MultipartyServiceConnectFailedEvent;\n streamDestroyed: MultipartyServiceStreamDestroyedEvent;\n streamCreated: MultipartyServiceStreamCreatedEvent;\n videoElementCreated: void;\n streamPropertyChanged: MultipartyServiceStreamPropertyChangedEvent;\n mediaDeviceAccessDenied: MultipartyServiceMediaAccessDeniedEvent;\n cameraSourceChanged: MultipartyServiceCameraSourceChangedEvent;\n}\n"]}
|
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
var
|
|
6
|
+
exports.MultiPartyServiceEventTypes = void 0;
|
|
7
|
+
var MultiPartyServiceEventTypes;
|
|
8
8
|
|
|
9
|
-
(function (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
})(
|
|
9
|
+
(function (MultiPartyServiceEventTypes) {
|
|
10
|
+
MultiPartyServiceEventTypes["connectFailed"] = "connectFailed";
|
|
11
|
+
MultiPartyServiceEventTypes["streamDestroyed"] = "streamDestroyed";
|
|
12
|
+
MultiPartyServiceEventTypes["connectionCreated"] = "connectionCreated";
|
|
13
|
+
MultiPartyServiceEventTypes["connectionDestroyed"] = "connectionDestroyed";
|
|
14
|
+
MultiPartyServiceEventTypes["streamCreated"] = "streamCreated";
|
|
15
|
+
MultiPartyServiceEventTypes["videoElementCreated"] = "videoElementCreated";
|
|
16
|
+
MultiPartyServiceEventTypes["streamPropertyChanged"] = "streamPropertyChanged";
|
|
17
|
+
MultiPartyServiceEventTypes["mediaDeviceAccessDenied"] = "mediaDeviceAccessDenied";
|
|
18
|
+
MultiPartyServiceEventTypes["cameraSourceChanged"] = "cameraSourceChanged";
|
|
19
|
+
})(MultiPartyServiceEventTypes = exports.MultiPartyServiceEventTypes || (exports.MultiPartyServiceEventTypes = {}));
|
|
20
20
|
//# sourceMappingURL=MultipartyServiceEventTypes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["MultiParty/MultipartyServiceEventTypes.js"],"names":["Object","defineProperty","exports","value","
|
|
1
|
+
{"version":3,"sources":["MultiParty/MultipartyServiceEventTypes.js"],"names":["Object","defineProperty","exports","value","MultiPartyServiceEventTypes"],"mappings":"AAAA;;AACAA,MAAM,CAACC,cAAP,CAAsBC,OAAtB,EAA+B,YAA/B,EAA6C;AAAEC,EAAAA,KAAK,EAAE;AAAT,CAA7C;AACAD,OAAO,CAACE,2BAAR,GAAsC,KAAK,CAA3C;AACA,IAAIA,2BAAJ;;AACA,CAAC,UAAUA,2BAAV,EAAuC;AACpCA,EAAAA,2BAA2B,CAAC,eAAD,CAA3B,GAA+C,eAA/C;AACAA,EAAAA,2BAA2B,CAAC,iBAAD,CAA3B,GAAiD,iBAAjD;AACAA,EAAAA,2BAA2B,CAAC,mBAAD,CAA3B,GAAmD,mBAAnD;AACAA,EAAAA,2BAA2B,CAAC,qBAAD,CAA3B,GAAqD,qBAArD;AACAA,EAAAA,2BAA2B,CAAC,eAAD,CAA3B,GAA+C,eAA/C;AACAA,EAAAA,2BAA2B,CAAC,qBAAD,CAA3B,GAAqD,qBAArD;AACAA,EAAAA,2BAA2B,CAAC,uBAAD,CAA3B,GAAuD,uBAAvD;AACAA,EAAAA,2BAA2B,CAAC,yBAAD,CAA3B,GAAyD,yBAAzD;AACAA,EAAAA,2BAA2B,CAAC,qBAAD,CAA3B,GAAqD,qBAArD;AACH,CAVD,EAUGA,2BAA2B,GAAGF,OAAO,CAACE,2BAAR,KAAwCF,OAAO,CAACE,2BAAR,GAAsC,EAA9E,CAVjC","file":"MultipartyServiceEventTypes.js","sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MultiPartyServiceEventTypes = void 0;\nvar MultiPartyServiceEventTypes;\n(function (MultiPartyServiceEventTypes) {\n MultiPartyServiceEventTypes[\"connectFailed\"] = \"connectFailed\";\n MultiPartyServiceEventTypes[\"streamDestroyed\"] = \"streamDestroyed\";\n MultiPartyServiceEventTypes[\"connectionCreated\"] = \"connectionCreated\";\n MultiPartyServiceEventTypes[\"connectionDestroyed\"] = \"connectionDestroyed\";\n MultiPartyServiceEventTypes[\"streamCreated\"] = \"streamCreated\";\n MultiPartyServiceEventTypes[\"videoElementCreated\"] = \"videoElementCreated\";\n MultiPartyServiceEventTypes[\"streamPropertyChanged\"] = \"streamPropertyChanged\";\n MultiPartyServiceEventTypes[\"mediaDeviceAccessDenied\"] = \"mediaDeviceAccessDenied\";\n MultiPartyServiceEventTypes[\"cameraSourceChanged\"] = \"cameraSourceChanged\";\n})(MultiPartyServiceEventTypes = exports.MultiPartyServiceEventTypes || (exports.MultiPartyServiceEventTypes = {}));\n\n//# sourceMappingURL=MultipartyServiceEventTypes.js.map\n"]}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
export * from './types';
|
|
1
2
|
export * from './MediaCapabilitiesUtils';
|
|
2
3
|
export * from './MultiPartyService';
|
|
3
4
|
export * from './MultipartyServiceEventTypes';
|
|
5
|
+
export * from './MediaTracer';
|
|
4
6
|
export { createMultiPartyService } from './MultiPartyServiceFactory';
|
|
5
7
|
export { VideoLayoutType } from './VideoLayoutType';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/MultiParty/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,OAAO,EAAC,uBAAuB,EAAC,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC","file":"index.d.ts","sourcesContent":["export * from './MediaCapabilitiesUtils';\nexport * from './MultiPartyService';\nexport * from './MultipartyServiceEventTypes';\nexport {createMultiPartyService} from './MultiPartyServiceFactory';\nexport {VideoLayoutType} from './VideoLayoutType';\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/MultiParty/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAC,uBAAuB,EAAC,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC","file":"index.d.ts","sourcesContent":["export * from './types';\nexport * from './MediaCapabilitiesUtils';\nexport * from './MultiPartyService';\nexport * from './MultipartyServiceEventTypes';\nexport * from './MediaTracer';\nexport {createMultiPartyService} from './MultiPartyServiceFactory';\nexport {VideoLayoutType} from './VideoLayoutType';\n"]}
|
package/lib/MultiParty/index.js
CHANGED
|
@@ -24,12 +24,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
24
24
|
});
|
|
25
25
|
exports.VideoLayoutType = exports.createMultiPartyService = void 0;
|
|
26
26
|
|
|
27
|
+
__exportStar(require("./types"), exports);
|
|
28
|
+
|
|
27
29
|
__exportStar(require("./MediaCapabilitiesUtils"), exports);
|
|
28
30
|
|
|
29
31
|
__exportStar(require("./MultiPartyService"), exports);
|
|
30
32
|
|
|
31
33
|
__exportStar(require("./MultipartyServiceEventTypes"), exports);
|
|
32
34
|
|
|
35
|
+
__exportStar(require("./MediaTracer"), exports);
|
|
36
|
+
|
|
33
37
|
var MultiPartyServiceFactory_1 = require("./MultiPartyServiceFactory");
|
|
34
38
|
|
|
35
39
|
Object.defineProperty(exports, "createMultiPartyService", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["MultiParty/index.js"],"names":["__createBinding","Object","create","o","m","k","k2","undefined","defineProperty","enumerable","get","__exportStar","exports","p","prototype","hasOwnProperty","call","value","VideoLayoutType","createMultiPartyService","require","MultiPartyServiceFactory_1","VideoLayoutType_1"],"mappings":"AAAA;;AACA,IAAIA,eAAe,GAAI,UAAQ,SAAKA,eAAd,KAAmCC,MAAM,CAACC,MAAP,GAAiB,UAASC,CAAT,EAAYC,CAAZ,EAAeC,CAAf,EAAkBC,EAAlB,EAAsB;AAC5F,MAAIA,EAAE,KAAKC,SAAX,EAAsBD,EAAE,GAAGD,CAAL;AACtBJ,EAAAA,MAAM,CAACO,cAAP,CAAsBL,CAAtB,EAAyBG,EAAzB,EAA6B;AAAEG,IAAAA,UAAU,EAAE,IAAd;AAAoBC,IAAAA,GAAG,EAAE,eAAW;AAAE,aAAON,CAAC,CAACC,CAAD,CAAR;AAAc;AAApD,GAA7B;AACH,CAHwD,GAGnD,UAASF,CAAT,EAAYC,CAAZ,EAAeC,CAAf,EAAkBC,EAAlB,EAAsB;AACxB,MAAIA,EAAE,KAAKC,SAAX,EAAsBD,EAAE,GAAGD,CAAL;AACtBF,EAAAA,CAAC,CAACG,EAAD,CAAD,GAAQF,CAAC,CAACC,CAAD,CAAT;AACH,CANqB,CAAtB;;AAOA,IAAIM,YAAY,GAAI,UAAQ,SAAKA,YAAd,IAA+B,UAASP,CAAT,EAAYQ,OAAZ,EAAqB;AACnE,OAAK,IAAIC,CAAT,IAAcT,CAAd;AAAiB,QAAIS,CAAC,KAAK,SAAN,IAAmB,CAACZ,MAAM,CAACa,SAAP,CAAiBC,cAAjB,CAAgCC,IAAhC,CAAqCJ,OAArC,EAA8CC,CAA9C,CAAxB,EAA0Eb,eAAe,CAACY,OAAD,EAAUR,CAAV,EAAaS,CAAb,CAAf;AAA3F;AACH,CAFD;;AAGAZ,MAAM,CAACO,cAAP,CAAsBI,OAAtB,EAA+B,YAA/B,EAA6C;AAAEK,EAAAA,KAAK,EAAE;AAAT,CAA7C;AACAL,OAAO,CAACM,eAAR,GAA0BN,OAAO,CAACO,uBAAR,GAAkC,KAAK,CAAjE;;AACAR,YAAY,CAACS,OAAO,CAAC,0BAAD,CAAR,EAAsCR,OAAtC,CAAZ;;AACAD,YAAY,CAACS,OAAO,CAAC,qBAAD,CAAR,EAAiCR,OAAjC,CAAZ;;AACAD,YAAY,CAACS,OAAO,CAAC,+BAAD,CAAR,EAA2CR,OAA3C,CAAZ;;AACA,IAAIS,0BAA0B,GAAGD,OAAO,CAAC,4BAAD,CAAxC;;AACAnB,MAAM,CAACO,cAAP,CAAsBI,OAAtB,EAA+B,yBAA/B,EAA0D;AAAEH,EAAAA,UAAU,EAAE,IAAd;AAAoBC,EAAAA,GAAG,EAAE,eAAY;AAAE,WAAOW,0BAA0B,CAACF,uBAAlC;AAA4D;AAAnG,CAA1D;;AACA,IAAIG,iBAAiB,GAAGF,OAAO,CAAC,mBAAD,CAA/B;;AACAnB,MAAM,CAACO,cAAP,CAAsBI,OAAtB,EAA+B,iBAA/B,EAAkD;AAAEH,EAAAA,UAAU,EAAE,IAAd;AAAoBC,EAAAA,GAAG,EAAE,eAAY;AAAE,WAAOY,iBAAiB,CAACJ,eAAzB;AAA2C;AAAlF,CAAlD","file":"index.js","sourcesContent":["\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.VideoLayoutType = exports.createMultiPartyService = void 0;\n__exportStar(require(\"./MediaCapabilitiesUtils\"), exports);\n__exportStar(require(\"./MultiPartyService\"), exports);\n__exportStar(require(\"./MultipartyServiceEventTypes\"), exports);\nvar MultiPartyServiceFactory_1 = require(\"./MultiPartyServiceFactory\");\nObject.defineProperty(exports, \"createMultiPartyService\", { enumerable: true, get: function () { return MultiPartyServiceFactory_1.createMultiPartyService; } });\nvar VideoLayoutType_1 = require(\"./VideoLayoutType\");\nObject.defineProperty(exports, \"VideoLayoutType\", { enumerable: true, get: function () { return VideoLayoutType_1.VideoLayoutType; } });\n\n//# sourceMappingURL=index.js.map\n"]}
|
|
1
|
+
{"version":3,"sources":["MultiParty/index.js"],"names":["__createBinding","Object","create","o","m","k","k2","undefined","defineProperty","enumerable","get","__exportStar","exports","p","prototype","hasOwnProperty","call","value","VideoLayoutType","createMultiPartyService","require","MultiPartyServiceFactory_1","VideoLayoutType_1"],"mappings":"AAAA;;AACA,IAAIA,eAAe,GAAI,UAAQ,SAAKA,eAAd,KAAmCC,MAAM,CAACC,MAAP,GAAiB,UAASC,CAAT,EAAYC,CAAZ,EAAeC,CAAf,EAAkBC,EAAlB,EAAsB;AAC5F,MAAIA,EAAE,KAAKC,SAAX,EAAsBD,EAAE,GAAGD,CAAL;AACtBJ,EAAAA,MAAM,CAACO,cAAP,CAAsBL,CAAtB,EAAyBG,EAAzB,EAA6B;AAAEG,IAAAA,UAAU,EAAE,IAAd;AAAoBC,IAAAA,GAAG,EAAE,eAAW;AAAE,aAAON,CAAC,CAACC,CAAD,CAAR;AAAc;AAApD,GAA7B;AACH,CAHwD,GAGnD,UAASF,CAAT,EAAYC,CAAZ,EAAeC,CAAf,EAAkBC,EAAlB,EAAsB;AACxB,MAAIA,EAAE,KAAKC,SAAX,EAAsBD,EAAE,GAAGD,CAAL;AACtBF,EAAAA,CAAC,CAACG,EAAD,CAAD,GAAQF,CAAC,CAACC,CAAD,CAAT;AACH,CANqB,CAAtB;;AAOA,IAAIM,YAAY,GAAI,UAAQ,SAAKA,YAAd,IAA+B,UAASP,CAAT,EAAYQ,OAAZ,EAAqB;AACnE,OAAK,IAAIC,CAAT,IAAcT,CAAd;AAAiB,QAAIS,CAAC,KAAK,SAAN,IAAmB,CAACZ,MAAM,CAACa,SAAP,CAAiBC,cAAjB,CAAgCC,IAAhC,CAAqCJ,OAArC,EAA8CC,CAA9C,CAAxB,EAA0Eb,eAAe,CAACY,OAAD,EAAUR,CAAV,EAAaS,CAAb,CAAf;AAA3F;AACH,CAFD;;AAGAZ,MAAM,CAACO,cAAP,CAAsBI,OAAtB,EAA+B,YAA/B,EAA6C;AAAEK,EAAAA,KAAK,EAAE;AAAT,CAA7C;AACAL,OAAO,CAACM,eAAR,GAA0BN,OAAO,CAACO,uBAAR,GAAkC,KAAK,CAAjE;;AACAR,YAAY,CAACS,OAAO,CAAC,SAAD,CAAR,EAAqBR,OAArB,CAAZ;;AACAD,YAAY,CAACS,OAAO,CAAC,0BAAD,CAAR,EAAsCR,OAAtC,CAAZ;;AACAD,YAAY,CAACS,OAAO,CAAC,qBAAD,CAAR,EAAiCR,OAAjC,CAAZ;;AACAD,YAAY,CAACS,OAAO,CAAC,+BAAD,CAAR,EAA2CR,OAA3C,CAAZ;;AACAD,YAAY,CAACS,OAAO,CAAC,eAAD,CAAR,EAA2BR,OAA3B,CAAZ;;AACA,IAAIS,0BAA0B,GAAGD,OAAO,CAAC,4BAAD,CAAxC;;AACAnB,MAAM,CAACO,cAAP,CAAsBI,OAAtB,EAA+B,yBAA/B,EAA0D;AAAEH,EAAAA,UAAU,EAAE,IAAd;AAAoBC,EAAAA,GAAG,EAAE,eAAY;AAAE,WAAOW,0BAA0B,CAACF,uBAAlC;AAA4D;AAAnG,CAA1D;;AACA,IAAIG,iBAAiB,GAAGF,OAAO,CAAC,mBAAD,CAA/B;;AACAnB,MAAM,CAACO,cAAP,CAAsBI,OAAtB,EAA+B,iBAA/B,EAAkD;AAAEH,EAAAA,UAAU,EAAE,IAAd;AAAoBC,EAAAA,GAAG,EAAE,eAAY;AAAE,WAAOY,iBAAiB,CAACJ,eAAzB;AAA2C;AAAlF,CAAlD","file":"index.js","sourcesContent":["\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.VideoLayoutType = exports.createMultiPartyService = void 0;\n__exportStar(require(\"./types\"), exports);\n__exportStar(require(\"./MediaCapabilitiesUtils\"), exports);\n__exportStar(require(\"./MultiPartyService\"), exports);\n__exportStar(require(\"./MultipartyServiceEventTypes\"), exports);\n__exportStar(require(\"./MediaTracer\"), exports);\nvar MultiPartyServiceFactory_1 = require(\"./MultiPartyServiceFactory\");\nObject.defineProperty(exports, \"createMultiPartyService\", { enumerable: true, get: function () { return MultiPartyServiceFactory_1.createMultiPartyService; } });\nvar VideoLayoutType_1 = require(\"./VideoLayoutType\");\nObject.defineProperty(exports, \"VideoLayoutType\", { enumerable: true, get: function () { return VideoLayoutType_1.VideoLayoutType; } });\n\n//# sourceMappingURL=index.js.map\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Credentials, SessionSettings } from '../
|
|
1
|
+
import { Credentials, SessionSettings } from '../types';
|
|
2
2
|
import { MultiPartyService, SubscriberInfo } from '../MultiPartyService';
|
|
3
3
|
export declare class OpentokMultiPartyService extends MultiPartyService {
|
|
4
4
|
private readonly getParticipantId;
|
|
@@ -18,23 +18,11 @@ export declare class OpentokMultiPartyService extends MultiPartyService {
|
|
|
18
18
|
publishVideo: (shouldPublishVideo: boolean) => Promise<void>;
|
|
19
19
|
switchCamera: () => Promise<void>;
|
|
20
20
|
reinitializeStreams: (settings: SessionSettings) => Promise<void>;
|
|
21
|
-
streamCreatedHandler
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
reason: string;
|
|
27
|
-
}) => void;
|
|
28
|
-
connectionCreatedHandler: (event: {
|
|
29
|
-
connection: OT.Connection;
|
|
30
|
-
}) => void;
|
|
31
|
-
connectionDestroyedHandler: (event: {
|
|
32
|
-
connection: OT.Connection;
|
|
33
|
-
reason: string;
|
|
34
|
-
}) => void;
|
|
35
|
-
streamPropertyChangedHandler: (event: {
|
|
36
|
-
stream: OT.Stream;
|
|
37
|
-
}) => void;
|
|
21
|
+
private streamCreatedHandler;
|
|
22
|
+
private streamDestroyedHandler;
|
|
23
|
+
private connectionCreatedHandler;
|
|
24
|
+
private connectionDestroyedHandler;
|
|
25
|
+
private streamPropertyChangedHandler;
|
|
38
26
|
private sessionDisconnectedHandler;
|
|
39
27
|
private checkOwnConnection;
|
|
40
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/MultiParty/opentok/OpentokMultiPartyService.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,WAAW,EAAE,eAAe,EAAC,MAAM,cAAc,CAAC;AAG1D,OAAO,EAAC,iBAAiB,EAAE,cAAc,EAAwB,MAAM,sBAAsB,CAAC;AAa9F,qBAAa,wBAAyB,SAAQ,iBAAiB;IAQ/C,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAP7C,OAAO,CAAC,SAAS,CAAC,CAAmB;IAErC,OAAO,CAAC,kBAAkB,CAA8B;IAExD,OAAO,CAAC,OAAO,CAAC,CAAa;IAC7B,OAAO,CAAC,cAAc,CAA+B;gBAExB,gBAAgB,EAAE,CAAC,YAAY,CAAC,EAAE,MAAM,KAAK,MAAM;IAIhF,IAAW,eAAe,IAAI,MAAM,CAEnC;IAED,IAAW,WAAW,IAAI,cAAc,EAAE,CAEzC;IAEM,qBAAqB,QAAS,MAAM,UAEzC;IAEK,OAAO,aAAc,eAAe,eAAe,WAAW,KAAG,IAAI,CAiC1E;IAEK,UAAU,QAAO,IAAI,CAY1B;IAEK,YAAY,iBAAkB,MAAM,KAAG,MAAM,GAAG,IAAI,CAUzD;IAEF,OAAO,CAAC,aAAa,CAoCnB;IAEK,YAAY,eAAsB,OAAO,KAAG,QAAQ,IAAI,CAAC,CAU9D;IAEK,YAAY,uBAA8B,OAAO,KAAG,QAAQ,IAAI,CAAC,CAUtE;IAEK,YAAY,QAAa,QAAQ,IAAI,CAAC,CAAmC;IAEhF,mBAAmB,aAAoB,eAAe,KAAG,QAAQ,IAAI,CAAC,CAWpE;IAEF,oBAAoB;gBAA0B,GAAG,MAAM;UAAI,QAAQ,IAAI,CAAC,CA0CtE;IAEF,sBAAsB,UAAW;QAAC,MAAM,EAAE,GAAG,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,KAAG,IAAI,CAazE;IAEF,wBAAwB;oBAAwB,GAAG,UAAU;UAAI,IAAI,CAgBnE;IAEF,0BAA0B;oBAAwB,GAAG,UAAU;gBAAU,MAAM;UAAI,IAAI,CAkBrF;IAEF,4BAA4B,UAAW;QAAC,MAAM,EAAE,GAAG,MAAM,CAAA;KAAC,KAAG,IAAI,CAe/D;IAEF,OAAO,CAAC,0BAA0B,CAEhC;IAEF,OAAO,CAAC,kBAAkB,CACsD;CACnF","file":"OpentokMultiPartyService.d.ts","sourcesContent":["import {DEFAULT_AVATAR_URI} from '..';\nimport {getMediaTracer} from '../../MediaUtils';\nimport {Credentials, SessionSettings} from '../Contracts';\nimport {MediaCapabilitiesService} from '../MediaCapabilitiesService';\nimport {checkAudioCapabilities, checkVideoCapabilities} from '../MediaCapabilitiesUtils';\nimport {MultiPartyService, SubscriberInfo, maxParticipantsNumber} from '../MultiPartyService';\nimport {MULTI_PARTY_EVENTS} from '../MultipartyServiceEventTypes';\nimport {OpentokPublisher} from './OpentokPublisher';\nimport {createSubscriber} from './OpentokSubscriber';\nimport {getClientRole} from './OpentokUtils';\nimport {traceError} from './trace';\n\nconst trace = getMediaTracer('Multiparty');\n\ntype OpentokSubscriberInfo = SubscriberInfo & {\n subscriber: OT.Subscriber;\n};\n\nexport class OpentokMultiPartyService extends MultiPartyService {\n private publisher?: OpentokPublisher;\n\n private backgroundImageURI: string = DEFAULT_AVATAR_URI;\n\n private session?: OT.Session;\n private subscriberList: OpentokSubscriberInfo[] = [];\n\n constructor(private readonly getParticipantId: (connectionId?: string) => string) {\n super();\n }\n\n public get ownConnectionId(): string {\n return this.session?.connection?.connectionId || '';\n }\n\n public get subscribers(): SubscriberInfo[] {\n return [...this.subscriberList];\n }\n\n public setBackgroundImageURI = (uri: string) => {\n this.backgroundImageURI = uri || DEFAULT_AVATAR_URI;\n };\n\n public connect = (settings: SessionSettings, credentials: Credentials): void => {\n try {\n this.session = OT.initSession(credentials.apiKey, credentials.sessionId);\n\n this.session.on('connectionCreated', this.connectionCreatedHandler);\n this.session.on('connectionDestroyed', this.connectionDestroyedHandler);\n this.session.on('streamCreated', this.streamCreatedHandler);\n this.session.on('streamDestroyed', this.streamDestroyedHandler);\n this.session.on('streamPropertyChanged', this.streamPropertyChangedHandler);\n this.session.on('sessionDisconnected', this.sessionDisconnectedHandler);\n\n this.session.connect(credentials.token, (error?: any) => {\n if (error) {\n this.session?.off();\n this.session = undefined;\n traceError(error);\n\n this.emit(MULTI_PARTY_EVENTS.connectFailed, {\n meta: {err: JSON.stringify(error)}\n });\n\n return;\n }\n\n this.initPublisher(settings);\n });\n } catch (err) {\n trace.error(JSON.stringify(err));\n\n this.emit(MULTI_PARTY_EVENTS.connectFailed, {\n meta: {err: JSON.stringify(err)}\n });\n }\n };\n\n public disconnect = (): void => {\n try {\n trace.info('Disconnecting from session');\n\n if (this.session) {\n this.publisher?.destroy();\n this.session.disconnect();\n trace.info('Disconnection from session completed');\n }\n } catch (err) {\n trace.error(JSON.stringify(err));\n }\n };\n\n public takeSnapshot = (connectionId: string): string | null => {\n if (!connectionId) {\n return null;\n }\n\n if (connectionId === this.ownConnectionId) {\n return this.publisher?.getImgData() || null;\n }\n\n return this.subscribers.find((s) => s.connectionId === connectionId)?.subscriber.getImgData() || null;\n };\n\n private initPublisher = async (settings: Readonly<SessionSettings>): Promise<void> => {\n if (!this.session) {\n return;\n }\n\n const canStartWithAudio = await checkAudioCapabilities();\n const canStartWithVideo = await checkVideoCapabilities();\n const capabilitiesService = await MediaCapabilitiesService.getInstance();\n\n if (!canStartWithAudio && !canStartWithVideo) {\n throw new Error('Creating session requires initialized publisher');\n }\n\n const publisherOptions = {\n participantId: this.getParticipantId(this.ownConnectionId),\n backgroundImageURI: this.backgroundImageURI\n };\n\n this.publisher = new OpentokPublisher(\n {\n ...settings,\n cameraEnabled: settings.cameraEnabled && canStartWithVideo,\n startWithAudioMuted: settings.startWithAudioMuted && canStartWithAudio\n },\n publisherOptions,\n capabilitiesService\n );\n\n // forward publisher events\n this.publisher.on('cameraSourceChanged', (e) => this.emit(MULTI_PARTY_EVENTS.cameraSourceChanged, e));\n this.publisher.on('streamCreated', (e) => this.emit(MULTI_PARTY_EVENTS.streamCreated, e));\n this.publisher.on('streamDestroyed', (e) => this.emit(MULTI_PARTY_EVENTS.streamDestroyed, e));\n this.publisher.on('mediaDeviceAccessDenied', (e) => this.emit(MULTI_PARTY_EVENTS.mediaDeviceAccessDenied, e));\n this.publisher.on('videoElementCreated', () => this.emit(MULTI_PARTY_EVENTS.videoElementCreated));\n\n this.session.publish(this.publisher.get(), traceError);\n };\n\n public publishAudio = async (shouldMute: boolean): Promise<void> => {\n const canPublishAudio = await checkAudioCapabilities();\n\n if (shouldMute && !canPublishAudio) {\n trace.error('could not publish audio');\n\n return;\n }\n\n this.publisher?.publishAudio(shouldMute);\n };\n\n public publishVideo = async (shouldPublishVideo: boolean): Promise<void> => {\n const canPublishVideo = await checkVideoCapabilities();\n\n if (shouldPublishVideo && !canPublishVideo) {\n trace.error('could not publish video');\n\n return;\n }\n\n this.publisher?.publishVideo(shouldPublishVideo);\n };\n\n public switchCamera = async (): Promise<void> => this.publisher?.switchCamera();\n\n reinitializeStreams = async (settings: SessionSettings): Promise<void> => {\n if (!this.session) {\n return;\n }\n\n this.subscriberList.map((s) => s.subscriber).forEach(this.session?.unsubscribe);\n this.subscriberList = [];\n\n this.publisher?.destroy();\n\n return this.initPublisher(settings);\n };\n\n streamCreatedHandler = async (event: {stream: OT.Stream}): Promise<void> => {\n trace.info('streamCreatedHandler', event.stream);\n\n const {stream} = event;\n const {connection, hasAudio, hasVideo, videoDimensions} = stream;\n const {connectionId} = connection;\n const participantId = this.getParticipantId(connectionId);\n const clientRole = getClientRole(connection);\n\n await MediaCapabilitiesService.setDevicesList();\n\n if (this.ownConnectionId && stream && connectionId !== this.ownConnectionId) {\n if (this.subscriberList.length < maxParticipantsNumber - 1) {\n const subscriber = createSubscriber(\n this.session!,\n stream,\n this.getParticipantId(connectionId),\n this.backgroundImageURI\n );\n\n this.subscriberList.push({\n subscriber,\n connectionId,\n clientRole\n });\n } else {\n trace.info(\n `a new subscriber cannot be added, as the number of participants reached its limit: ${maxParticipantsNumber}`\n );\n }\n }\n\n this.emit(MULTI_PARTY_EVENTS.streamCreated, {\n participantId,\n clientRole,\n connectionId,\n hasVideo,\n hasAudio,\n isOwnConnection: false,\n mirror: false,\n videoDimensions\n });\n };\n\n streamDestroyedHandler = (event: {stream: OT.Stream; reason: string}): void => {\n trace.info('streamDestroyedHandler', event);\n\n const {connection} = event.stream;\n const {connectionId} = connection;\n\n this.subscriberList = this.subscriberList.filter((subscriber) => subscriber.connectionId !== connectionId);\n this.emit(MULTI_PARTY_EVENTS.streamDestroyed, {\n participantId: this.getParticipantId(connectionId),\n connectionId,\n isOwnConnection: false,\n clientRole: getClientRole(connection)\n });\n };\n\n connectionCreatedHandler = (event: {connection: OT.Connection}): void => {\n trace.info('connectionCreatedHandler', event);\n\n const {connection} = event;\n const {connectionId} = connection;\n\n if (!this.ownConnectionId || !connection) {\n return;\n }\n\n this.emit(MULTI_PARTY_EVENTS.connectionCreated, {\n clientRole: getClientRole(connection),\n participantId: this.getParticipantId(connectionId),\n connectionId,\n isOwnConnection: this.checkOwnConnection(connectionId)\n });\n };\n\n connectionDestroyedHandler = (event: {connection: OT.Connection; reason: string}): void => {\n const {connection} = event;\n const {connectionId} = connection;\n\n trace.info('connectionDestroyedHandler', event);\n\n this.emit(MULTI_PARTY_EVENTS.connectionDestroyed, {\n clientRole: getClientRole(connection),\n participantId: this.getParticipantId(connectionId),\n connectionId,\n isOwnConnection: this.checkOwnConnection(connectionId)\n });\n\n if (connectionId !== this.ownConnectionId || !this.ownConnectionId) {\n return;\n }\n\n this.session = undefined;\n };\n\n streamPropertyChangedHandler = (event: {stream: OT.Stream}): void => {\n trace.info('streamPropertyChangedHandler', event);\n\n const {hasVideo, hasAudio, connection, videoDimensions} = event.stream;\n const {connectionId} = connection;\n\n this.emit(MULTI_PARTY_EVENTS.streamPropertyChanged, {\n hasVideo,\n hasAudio,\n participantId: this.getParticipantId(connectionId),\n connectionId: connectionId,\n isOwnConnection: this.checkOwnConnection(connectionId),\n clientRole: getClientRole(connection),\n videoDimensions\n });\n };\n\n private sessionDisconnectedHandler = (event: unknown) => {\n trace.info('sessionDisconnectedHandler', event);\n };\n\n private checkOwnConnection = (connectionId: string) =>\n this.ownConnectionId !== undefined && this.ownConnectionId === connectionId;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/MultiParty/opentok/OpentokMultiPartyService.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,WAAW,EAAE,eAAe,EAAC,MAAM,UAAU,CAAC;AAGtD,OAAO,EAAC,iBAAiB,EAAE,cAAc,EAA4C,MAAM,sBAAsB,CAAC;AAalH,qBAAa,wBAAyB,SAAQ,iBAAiB;IAQ/C,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAP7C,OAAO,CAAC,SAAS,CAAC,CAAmB;IAErC,OAAO,CAAC,kBAAkB,CAA8B;IAExD,OAAO,CAAC,OAAO,CAAC,CAAa;IAC7B,OAAO,CAAC,cAAc,CAA+B;gBAExB,gBAAgB,EAAE,CAAC,YAAY,CAAC,EAAE,MAAM,KAAK,MAAM;IAIhF,IAAW,eAAe,IAAI,MAAM,CAEnC;IAED,IAAW,WAAW,IAAI,cAAc,EAAE,CAEzC;IAEM,qBAAqB,QAAS,MAAM,UAEzC;IAEK,OAAO,aAAc,eAAe,eAAe,WAAW,KAAG,IAAI,CAiC1E;IAEK,UAAU,QAAO,IAAI,CAY1B;IAEK,YAAY,iBAAkB,MAAM,KAAG,MAAM,GAAG,IAAI,CAUzD;IAEF,OAAO,CAAC,aAAa,CA4CnB;IAEK,YAAY,eAAsB,OAAO,KAAG,QAAQ,IAAI,CAAC,CAU9D;IAEK,YAAY,uBAA8B,OAAO,KAAG,QAAQ,IAAI,CAAC,CAUtE;IAEK,YAAY,QAAa,QAAQ,IAAI,CAAC,CAAmC;IAEzE,mBAAmB,aAAoB,eAAe,KAAG,QAAQ,IAAI,CAAC,CAW3E;IAEF,OAAO,CAAC,oBAAoB,CAwC1B;IAEF,OAAO,CAAC,sBAAsB,CAa5B;IAEF,OAAO,CAAC,wBAAwB,CAgB9B;IAEF,OAAO,CAAC,0BAA0B,CAkBhC;IAEF,OAAO,CAAC,4BAA4B,CAelC;IAEF,OAAO,CAAC,0BAA0B,CAEhC;IAEF,OAAO,CAAC,kBAAkB,CACsD;CACnF","file":"OpentokMultiPartyService.d.ts","sourcesContent":["import {getMediaTracer} from '../MediaTracer';\nimport {Credentials, SessionSettings} from '../types';\nimport {MediaCapabilitiesService} from '../MediaCapabilitiesService';\nimport {checkAudioCapabilities, checkVideoCapabilities} from '../MediaCapabilitiesUtils';\nimport {MultiPartyService, SubscriberInfo, maxParticipantsNumber, DEFAULT_AVATAR_URI} from '../MultiPartyService';\nimport {MultiPartyServiceEventTypes} from '../MultipartyServiceEventTypes';\nimport {OpentokPublisher} from './OpentokPublisher';\nimport {createSubscriber} from './OpentokSubscriber';\nimport {decodeClientRole} from '../utils';\nimport {traceError} from './trace';\n\nconst trace = getMediaTracer('Multiparty');\n\ntype OpentokSubscriberInfo = SubscriberInfo & {\n subscriber: OT.Subscriber;\n};\n\nexport class OpentokMultiPartyService extends MultiPartyService {\n private publisher?: OpentokPublisher;\n\n private backgroundImageURI: string = DEFAULT_AVATAR_URI;\n\n private session?: OT.Session;\n private subscriberList: OpentokSubscriberInfo[] = [];\n\n constructor(private readonly getParticipantId: (connectionId?: string) => string) {\n super();\n }\n\n public get ownConnectionId(): string {\n return this.session?.connection?.connectionId || '';\n }\n\n public get subscribers(): SubscriberInfo[] {\n return [...this.subscriberList];\n }\n\n public setBackgroundImageURI = (uri: string) => {\n this.backgroundImageURI = uri || DEFAULT_AVATAR_URI;\n };\n\n public connect = (settings: SessionSettings, credentials: Credentials): void => {\n try {\n this.session = OT.initSession(credentials.apiKey, credentials.sessionId);\n\n this.session.on('connectionCreated', this.connectionCreatedHandler);\n this.session.on('connectionDestroyed', this.connectionDestroyedHandler);\n this.session.on('streamCreated', this.streamCreatedHandler);\n this.session.on('streamDestroyed', this.streamDestroyedHandler);\n this.session.on('streamPropertyChanged', this.streamPropertyChangedHandler);\n this.session.on('sessionDisconnected', this.sessionDisconnectedHandler);\n\n this.session.connect(credentials.token, (error?: any) => {\n if (error) {\n this.session?.off();\n this.session = undefined;\n traceError(error);\n\n this.emit(MultiPartyServiceEventTypes.connectFailed, {\n meta: {err: JSON.stringify(error)}\n });\n\n return;\n }\n\n this.initPublisher(settings);\n });\n } catch (err) {\n trace.error(JSON.stringify(err));\n\n this.emit(MultiPartyServiceEventTypes.connectFailed, {\n meta: {err: JSON.stringify(err)}\n });\n }\n };\n\n public disconnect = (): void => {\n try {\n trace.info('Disconnecting from session');\n\n if (this.session) {\n this.publisher?.destroy();\n this.session.disconnect();\n trace.info('Disconnection from session completed');\n }\n } catch (err) {\n trace.error(JSON.stringify(err));\n }\n };\n\n public takeSnapshot = (connectionId: string): string | null => {\n if (!connectionId) {\n return null;\n }\n\n if (connectionId === this.ownConnectionId) {\n return this.publisher?.getImgData() || null;\n }\n\n return this.subscribers.find((s) => s.connectionId === connectionId)?.subscriber.getImgData() || null;\n };\n\n private initPublisher = async (settings: Readonly<SessionSettings>): Promise<void> => {\n if (!this.session) {\n return;\n }\n\n const canStartWithAudio = await checkAudioCapabilities();\n const canStartWithVideo = await checkVideoCapabilities();\n const capabilitiesService = await MediaCapabilitiesService.getInstance();\n\n if (!canStartWithAudio && !canStartWithVideo) {\n throw new Error('Creating session requires initialized publisher');\n }\n\n const publisherOptions = {\n participantId: this.getParticipantId(this.ownConnectionId),\n backgroundImageURI: this.backgroundImageURI\n };\n\n try {\n this.publisher = new OpentokPublisher(\n {\n ...settings,\n cameraEnabled: settings.cameraEnabled && canStartWithVideo,\n startWithAudioMuted: settings.startWithAudioMuted && canStartWithAudio\n },\n publisherOptions,\n capabilitiesService\n );\n\n // forward publisher events\n this.publisher.on('cameraSourceChanged', (e) =>\n this.emit(MultiPartyServiceEventTypes.cameraSourceChanged, e)\n );\n this.publisher.on('streamCreated', (e) => this.emit(MultiPartyServiceEventTypes.streamCreated, e));\n this.publisher.on('streamDestroyed', (e) => this.emit(MultiPartyServiceEventTypes.streamDestroyed, e));\n this.publisher.on('mediaDeviceAccessDenied', (e) =>\n this.emit(MultiPartyServiceEventTypes.mediaDeviceAccessDenied, e)\n );\n this.publisher.on('videoElementCreated', () => this.emit(MultiPartyServiceEventTypes.videoElementCreated));\n\n this.session.publish(this.publisher.get(), traceError);\n } catch (error) {\n trace.error('could not init publisher');\n }\n };\n\n public publishAudio = async (shouldMute: boolean): Promise<void> => {\n const canPublishAudio = await checkAudioCapabilities();\n\n if (shouldMute && !canPublishAudio) {\n trace.error('could not publish audio');\n\n return;\n }\n\n this.publisher?.publishAudio(shouldMute);\n };\n\n public publishVideo = async (shouldPublishVideo: boolean): Promise<void> => {\n const canPublishVideo = await checkVideoCapabilities();\n\n if (shouldPublishVideo && !canPublishVideo) {\n trace.error('could not publish video');\n\n return;\n }\n\n this.publisher?.publishVideo(shouldPublishVideo);\n };\n\n public switchCamera = async (): Promise<void> => this.publisher?.switchCamera();\n\n public reinitializeStreams = async (settings: SessionSettings): Promise<void> => {\n if (!this.session) {\n return;\n }\n\n this.subscriberList.map((s) => s.subscriber).forEach(this.session?.unsubscribe);\n this.subscriberList = [];\n\n this.publisher?.destroy();\n\n return this.initPublisher(settings);\n };\n\n private streamCreatedHandler = async (event: {stream: OT.Stream}): Promise<void> => {\n trace.info('streamCreatedHandler', event.stream);\n\n const {stream} = event;\n const {connection, hasAudio, hasVideo, videoDimensions} = stream;\n const {connectionId, data} = connection;\n const participantId = this.getParticipantId(connectionId);\n const clientRole = decodeClientRole(data);\n\n if (this.ownConnectionId && stream && connectionId !== this.ownConnectionId) {\n if (this.subscriberList.length < maxParticipantsNumber - 1) {\n const subscriber = createSubscriber(\n this.session!,\n stream,\n this.getParticipantId(connectionId),\n this.backgroundImageURI\n );\n\n this.subscriberList.push({\n subscriber,\n connectionId,\n clientRole\n });\n } else {\n trace.info(\n `a new subscriber cannot be added, as the number of participants reached its limit: ${maxParticipantsNumber}`\n );\n }\n }\n\n this.emit(MultiPartyServiceEventTypes.streamCreated, {\n participantId,\n clientRole,\n connectionId,\n hasVideo,\n hasAudio,\n isOwnConnection: false,\n mirror: false,\n videoDimensions\n });\n };\n\n private streamDestroyedHandler = (event: {stream: OT.Stream; reason: string}): void => {\n trace.info('streamDestroyedHandler', event);\n\n const {connection} = event.stream;\n const {connectionId} = connection;\n\n this.subscriberList = this.subscriberList.filter((subscriber) => subscriber.connectionId !== connectionId);\n this.emit(MultiPartyServiceEventTypes.streamDestroyed, {\n participantId: this.getParticipantId(connectionId),\n connectionId,\n isOwnConnection: false,\n clientRole: decodeClientRole(connection.data)\n });\n };\n\n private connectionCreatedHandler = (event: {connection: OT.Connection}): void => {\n trace.info('connectionCreatedHandler', event);\n\n const {connection} = event;\n const {connectionId} = connection;\n\n if (!this.ownConnectionId || !connection) {\n return;\n }\n\n this.emit(MultiPartyServiceEventTypes.connectionCreated, {\n clientRole: decodeClientRole(connection.data),\n participantId: this.getParticipantId(connectionId),\n connectionId,\n isOwnConnection: this.checkOwnConnection(connectionId)\n });\n };\n\n private connectionDestroyedHandler = (event: {connection: OT.Connection; reason: string}): void => {\n const {connection} = event;\n const {connectionId} = connection;\n\n trace.info('connectionDestroyedHandler', event);\n\n this.emit(MultiPartyServiceEventTypes.connectionDestroyed, {\n clientRole: decodeClientRole(connection.data),\n participantId: this.getParticipantId(connectionId),\n connectionId,\n isOwnConnection: this.checkOwnConnection(connectionId)\n });\n\n if (connectionId !== this.ownConnectionId || !this.ownConnectionId) {\n return;\n }\n\n this.session = undefined;\n };\n\n private streamPropertyChangedHandler = (event: {stream: OT.Stream}): void => {\n trace.info('streamPropertyChangedHandler', event);\n\n const {hasVideo, hasAudio, connection, videoDimensions} = event.stream;\n const {connectionId} = connection;\n\n this.emit(MultiPartyServiceEventTypes.streamPropertyChanged, {\n hasVideo,\n hasAudio,\n participantId: this.getParticipantId(connectionId),\n connectionId: connectionId,\n isOwnConnection: this.checkOwnConnection(connectionId),\n clientRole: decodeClientRole(connection.data),\n videoDimensions\n });\n };\n\n private sessionDisconnectedHandler = (event: unknown) => {\n trace.info('sessionDisconnectedHandler', event);\n };\n\n private checkOwnConnection = (connectionId: string) =>\n this.ownConnectionId !== undefined && this.ownConnectionId === connectionId;\n}\n"]}
|
|
@@ -204,9 +204,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
204
204
|
});
|
|
205
205
|
exports.OpentokMultiPartyService = void 0;
|
|
206
206
|
|
|
207
|
-
var
|
|
208
|
-
|
|
209
|
-
var MediaUtils_1 = require("../../MediaUtils");
|
|
207
|
+
var MediaTracer_1 = require("../MediaTracer");
|
|
210
208
|
|
|
211
209
|
var MediaCapabilitiesService_1 = require("../MediaCapabilitiesService");
|
|
212
210
|
|
|
@@ -220,11 +218,11 @@ var OpentokPublisher_1 = require("./OpentokPublisher");
|
|
|
220
218
|
|
|
221
219
|
var OpentokSubscriber_1 = require("./OpentokSubscriber");
|
|
222
220
|
|
|
223
|
-
var
|
|
221
|
+
var utils_1 = require("../utils");
|
|
224
222
|
|
|
225
223
|
var trace_1 = require("./trace");
|
|
226
224
|
|
|
227
|
-
var trace =
|
|
225
|
+
var trace = MediaTracer_1.getMediaTracer('Multiparty');
|
|
228
226
|
|
|
229
227
|
var OpentokMultiPartyService =
|
|
230
228
|
/** @class */
|
|
@@ -235,11 +233,11 @@ function (_super) {
|
|
|
235
233
|
var _this = _super.call(this) || this;
|
|
236
234
|
|
|
237
235
|
_this.getParticipantId = getParticipantId;
|
|
238
|
-
_this.backgroundImageURI =
|
|
236
|
+
_this.backgroundImageURI = MultiPartyService_1.DEFAULT_AVATAR_URI;
|
|
239
237
|
_this.subscriberList = [];
|
|
240
238
|
|
|
241
239
|
_this.setBackgroundImageURI = function (uri) {
|
|
242
|
-
_this.backgroundImageURI = uri ||
|
|
240
|
+
_this.backgroundImageURI = uri || MultiPartyService_1.DEFAULT_AVATAR_URI;
|
|
243
241
|
};
|
|
244
242
|
|
|
245
243
|
_this.connect = function (settings, credentials) {
|
|
@@ -266,7 +264,7 @@ function (_super) {
|
|
|
266
264
|
_this.session = undefined;
|
|
267
265
|
trace_1.traceError(error);
|
|
268
266
|
|
|
269
|
-
_this.emit(MultipartyServiceEventTypes_1.
|
|
267
|
+
_this.emit(MultipartyServiceEventTypes_1.MultiPartyServiceEventTypes.connectFailed, {
|
|
270
268
|
meta: {
|
|
271
269
|
err: JSON.stringify(error)
|
|
272
270
|
}
|
|
@@ -280,7 +278,7 @@ function (_super) {
|
|
|
280
278
|
} catch (err) {
|
|
281
279
|
trace.error(JSON.stringify(err));
|
|
282
280
|
|
|
283
|
-
_this.emit(MultipartyServiceEventTypes_1.
|
|
281
|
+
_this.emit(MultipartyServiceEventTypes_1.MultiPartyServiceEventTypes.connectFailed, {
|
|
284
282
|
meta: {
|
|
285
283
|
err: JSON.stringify(err)
|
|
286
284
|
}
|
|
@@ -364,27 +362,33 @@ function (_super) {
|
|
|
364
362
|
participantId: this.getParticipantId(this.ownConnectionId),
|
|
365
363
|
backgroundImageURI: this.backgroundImageURI
|
|
366
364
|
};
|
|
367
|
-
this.publisher = new OpentokPublisher_1.OpentokPublisher(__assign(__assign({}, settings), {
|
|
368
|
-
cameraEnabled: settings.cameraEnabled && canStartWithVideo,
|
|
369
|
-
startWithAudioMuted: settings.startWithAudioMuted && canStartWithAudio
|
|
370
|
-
}), publisherOptions, capabilitiesService); // forward publisher events
|
|
371
365
|
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
366
|
+
try {
|
|
367
|
+
this.publisher = new OpentokPublisher_1.OpentokPublisher(__assign(__assign({}, settings), {
|
|
368
|
+
cameraEnabled: settings.cameraEnabled && canStartWithVideo,
|
|
369
|
+
startWithAudioMuted: settings.startWithAudioMuted && canStartWithAudio
|
|
370
|
+
}), publisherOptions, capabilitiesService); // forward publisher events
|
|
371
|
+
|
|
372
|
+
this.publisher.on('cameraSourceChanged', function (e) {
|
|
373
|
+
return _this.emit(MultipartyServiceEventTypes_1.MultiPartyServiceEventTypes.cameraSourceChanged, e);
|
|
374
|
+
});
|
|
375
|
+
this.publisher.on('streamCreated', function (e) {
|
|
376
|
+
return _this.emit(MultipartyServiceEventTypes_1.MultiPartyServiceEventTypes.streamCreated, e);
|
|
377
|
+
});
|
|
378
|
+
this.publisher.on('streamDestroyed', function (e) {
|
|
379
|
+
return _this.emit(MultipartyServiceEventTypes_1.MultiPartyServiceEventTypes.streamDestroyed, e);
|
|
380
|
+
});
|
|
381
|
+
this.publisher.on('mediaDeviceAccessDenied', function (e) {
|
|
382
|
+
return _this.emit(MultipartyServiceEventTypes_1.MultiPartyServiceEventTypes.mediaDeviceAccessDenied, e);
|
|
383
|
+
});
|
|
384
|
+
this.publisher.on('videoElementCreated', function () {
|
|
385
|
+
return _this.emit(MultipartyServiceEventTypes_1.MultiPartyServiceEventTypes.videoElementCreated);
|
|
386
|
+
});
|
|
387
|
+
this.session.publish(this.publisher.get(), trace_1.traceError);
|
|
388
|
+
} catch (error) {
|
|
389
|
+
trace.error('could not init publisher');
|
|
390
|
+
}
|
|
391
|
+
|
|
388
392
|
return [2
|
|
389
393
|
/*return*/
|
|
390
394
|
];
|
|
@@ -494,50 +498,41 @@ function (_super) {
|
|
|
494
498
|
|
|
495
499
|
_this.streamCreatedHandler = function (event) {
|
|
496
500
|
return __awaiter(_this, void 0, void 0, function () {
|
|
497
|
-
var stream, connection, hasAudio, hasVideo, videoDimensions, connectionId, participantId, clientRole, subscriber;
|
|
501
|
+
var stream, connection, hasAudio, hasVideo, videoDimensions, connectionId, data, participantId, clientRole, subscriber;
|
|
498
502
|
return __generator(this, function (_a) {
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
case 1:
|
|
512
|
-
_a.sent();
|
|
513
|
-
|
|
514
|
-
if (this.ownConnectionId && stream && connectionId !== this.ownConnectionId) {
|
|
515
|
-
if (this.subscriberList.length < MultiPartyService_1.maxParticipantsNumber - 1) {
|
|
516
|
-
subscriber = OpentokSubscriber_1.createSubscriber(this.session, stream, this.getParticipantId(connectionId), this.backgroundImageURI);
|
|
517
|
-
this.subscriberList.push({
|
|
518
|
-
subscriber: subscriber,
|
|
519
|
-
connectionId: connectionId,
|
|
520
|
-
clientRole: clientRole
|
|
521
|
-
});
|
|
522
|
-
} else {
|
|
523
|
-
trace.info("a new subscriber cannot be added, as the number of participants reached its limit: " + MultiPartyService_1.maxParticipantsNumber);
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
this.emit(MultipartyServiceEventTypes_1.MULTI_PARTY_EVENTS.streamCreated, {
|
|
528
|
-
participantId: participantId,
|
|
529
|
-
clientRole: clientRole,
|
|
503
|
+
trace.info('streamCreatedHandler', event.stream);
|
|
504
|
+
stream = event.stream;
|
|
505
|
+
connection = stream.connection, hasAudio = stream.hasAudio, hasVideo = stream.hasVideo, videoDimensions = stream.videoDimensions;
|
|
506
|
+
connectionId = connection.connectionId, data = connection.data;
|
|
507
|
+
participantId = this.getParticipantId(connectionId);
|
|
508
|
+
clientRole = utils_1.decodeClientRole(data);
|
|
509
|
+
|
|
510
|
+
if (this.ownConnectionId && stream && connectionId !== this.ownConnectionId) {
|
|
511
|
+
if (this.subscriberList.length < MultiPartyService_1.maxParticipantsNumber - 1) {
|
|
512
|
+
subscriber = OpentokSubscriber_1.createSubscriber(this.session, stream, this.getParticipantId(connectionId), this.backgroundImageURI);
|
|
513
|
+
this.subscriberList.push({
|
|
514
|
+
subscriber: subscriber,
|
|
530
515
|
connectionId: connectionId,
|
|
531
|
-
|
|
532
|
-
hasAudio: hasAudio,
|
|
533
|
-
isOwnConnection: false,
|
|
534
|
-
mirror: false,
|
|
535
|
-
videoDimensions: videoDimensions
|
|
516
|
+
clientRole: clientRole
|
|
536
517
|
});
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
518
|
+
} else {
|
|
519
|
+
trace.info("a new subscriber cannot be added, as the number of participants reached its limit: " + MultiPartyService_1.maxParticipantsNumber);
|
|
520
|
+
}
|
|
540
521
|
}
|
|
522
|
+
|
|
523
|
+
this.emit(MultipartyServiceEventTypes_1.MultiPartyServiceEventTypes.streamCreated, {
|
|
524
|
+
participantId: participantId,
|
|
525
|
+
clientRole: clientRole,
|
|
526
|
+
connectionId: connectionId,
|
|
527
|
+
hasVideo: hasVideo,
|
|
528
|
+
hasAudio: hasAudio,
|
|
529
|
+
isOwnConnection: false,
|
|
530
|
+
mirror: false,
|
|
531
|
+
videoDimensions: videoDimensions
|
|
532
|
+
});
|
|
533
|
+
return [2
|
|
534
|
+
/*return*/
|
|
535
|
+
];
|
|
541
536
|
});
|
|
542
537
|
});
|
|
543
538
|
};
|
|
@@ -550,11 +545,11 @@ function (_super) {
|
|
|
550
545
|
return subscriber.connectionId !== connectionId;
|
|
551
546
|
});
|
|
552
547
|
|
|
553
|
-
_this.emit(MultipartyServiceEventTypes_1.
|
|
548
|
+
_this.emit(MultipartyServiceEventTypes_1.MultiPartyServiceEventTypes.streamDestroyed, {
|
|
554
549
|
participantId: _this.getParticipantId(connectionId),
|
|
555
550
|
connectionId: connectionId,
|
|
556
551
|
isOwnConnection: false,
|
|
557
|
-
clientRole:
|
|
552
|
+
clientRole: utils_1.decodeClientRole(connection.data)
|
|
558
553
|
});
|
|
559
554
|
};
|
|
560
555
|
|
|
@@ -567,8 +562,8 @@ function (_super) {
|
|
|
567
562
|
return;
|
|
568
563
|
}
|
|
569
564
|
|
|
570
|
-
_this.emit(MultipartyServiceEventTypes_1.
|
|
571
|
-
clientRole:
|
|
565
|
+
_this.emit(MultipartyServiceEventTypes_1.MultiPartyServiceEventTypes.connectionCreated, {
|
|
566
|
+
clientRole: utils_1.decodeClientRole(connection.data),
|
|
572
567
|
participantId: _this.getParticipantId(connectionId),
|
|
573
568
|
connectionId: connectionId,
|
|
574
569
|
isOwnConnection: _this.checkOwnConnection(connectionId)
|
|
@@ -580,8 +575,8 @@ function (_super) {
|
|
|
580
575
|
var connectionId = connection.connectionId;
|
|
581
576
|
trace.info('connectionDestroyedHandler', event);
|
|
582
577
|
|
|
583
|
-
_this.emit(MultipartyServiceEventTypes_1.
|
|
584
|
-
clientRole:
|
|
578
|
+
_this.emit(MultipartyServiceEventTypes_1.MultiPartyServiceEventTypes.connectionDestroyed, {
|
|
579
|
+
clientRole: utils_1.decodeClientRole(connection.data),
|
|
585
580
|
participantId: _this.getParticipantId(connectionId),
|
|
586
581
|
connectionId: connectionId,
|
|
587
582
|
isOwnConnection: _this.checkOwnConnection(connectionId)
|
|
@@ -603,13 +598,13 @@ function (_super) {
|
|
|
603
598
|
videoDimensions = _a.videoDimensions;
|
|
604
599
|
var connectionId = connection.connectionId;
|
|
605
600
|
|
|
606
|
-
_this.emit(MultipartyServiceEventTypes_1.
|
|
601
|
+
_this.emit(MultipartyServiceEventTypes_1.MultiPartyServiceEventTypes.streamPropertyChanged, {
|
|
607
602
|
hasVideo: hasVideo,
|
|
608
603
|
hasAudio: hasAudio,
|
|
609
604
|
participantId: _this.getParticipantId(connectionId),
|
|
610
605
|
connectionId: connectionId,
|
|
611
606
|
isOwnConnection: _this.checkOwnConnection(connectionId),
|
|
612
|
-
clientRole:
|
|
607
|
+
clientRole: utils_1.decodeClientRole(connection.data),
|
|
613
608
|
videoDimensions: videoDimensions
|
|
614
609
|
});
|
|
615
610
|
};
|