@techsee/techsee-media-service 11.0.0 → 12.0.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.
Files changed (61) hide show
  1. package/lib/MultiParty/DetectWebRtcService.d.ts +16 -14
  2. package/lib/MultiParty/DetectWebRtcService.d.ts.map +1 -1
  3. package/lib/MultiParty/DetectWebRtcService.js +221 -44
  4. package/lib/MultiParty/DetectWebRtcService.js.map +1 -1
  5. package/lib/MultiParty/MediaCapabilitiesService.d.ts +6 -12
  6. package/lib/MultiParty/MediaCapabilitiesService.d.ts.map +1 -1
  7. package/lib/MultiParty/MediaCapabilitiesService.js +58 -119
  8. package/lib/MultiParty/MediaCapabilitiesService.js.map +1 -1
  9. package/lib/MultiParty/MediaCapabilitiesUtils.d.ts.map +1 -1
  10. package/lib/MultiParty/MediaCapabilitiesUtils.js +2 -2
  11. package/lib/MultiParty/MediaCapabilitiesUtils.js.map +1 -1
  12. package/lib/MultiParty/MediaTracer.d.ts +3 -0
  13. package/lib/MultiParty/MediaTracer.d.ts.map +1 -0
  14. package/lib/MultiParty/MediaTracer.js +17 -0
  15. package/lib/MultiParty/MediaTracer.js.map +1 -0
  16. package/lib/MultiParty/MultiPartyService.d.ts +2 -2
  17. package/lib/MultiParty/MultiPartyService.d.ts.map +1 -1
  18. package/lib/MultiParty/MultiPartyServiceFactory.d.ts +1 -1
  19. package/lib/MultiParty/MultiPartyServiceFactory.d.ts.map +1 -1
  20. package/lib/MultiParty/MultiPartyServiceFactory.js +2 -2
  21. package/lib/MultiParty/MultiPartyServiceFactory.js.map +1 -1
  22. package/lib/MultiParty/MultipartyServiceEventTypes.d.ts +1 -1
  23. package/lib/MultiParty/MultipartyServiceEventTypes.d.ts.map +1 -1
  24. package/lib/MultiParty/MultipartyServiceEventTypes.js +13 -13
  25. package/lib/MultiParty/MultipartyServiceEventTypes.js.map +1 -1
  26. package/lib/MultiParty/index.d.ts +2 -0
  27. package/lib/MultiParty/index.d.ts.map +1 -1
  28. package/lib/MultiParty/index.js +4 -0
  29. package/lib/MultiParty/index.js.map +1 -1
  30. package/lib/MultiParty/opentok/OpentokMultiPartyService.d.ts +6 -18
  31. package/lib/MultiParty/opentok/OpentokMultiPartyService.d.ts.map +1 -1
  32. package/lib/MultiParty/opentok/OpentokMultiPartyService.js +72 -77
  33. package/lib/MultiParty/opentok/OpentokMultiPartyService.js.map +1 -1
  34. package/lib/MultiParty/opentok/OpentokPublisher.d.ts +14 -4
  35. package/lib/MultiParty/opentok/OpentokPublisher.d.ts.map +1 -1
  36. package/lib/MultiParty/opentok/OpentokPublisher.js +49 -84
  37. package/lib/MultiParty/opentok/OpentokPublisher.js.map +1 -1
  38. package/lib/MultiParty/opentok/OpentokPublisherEventMapper.d.ts +18 -0
  39. package/lib/MultiParty/opentok/OpentokPublisherEventMapper.d.ts.map +1 -0
  40. package/lib/MultiParty/opentok/OpentokPublisherEventMapper.js +66 -0
  41. package/lib/MultiParty/opentok/OpentokPublisherEventMapper.js.map +1 -0
  42. package/lib/MultiParty/opentok/OpentokSubscriber.js +2 -0
  43. package/lib/MultiParty/opentok/OpentokSubscriber.js.map +1 -1
  44. package/lib/MultiParty/opentok/trace.d.ts.map +1 -1
  45. package/lib/MultiParty/opentok/trace.js +2 -2
  46. package/lib/MultiParty/opentok/trace.js.map +1 -1
  47. package/lib/MultiParty/{Contracts.d.ts → types.d.ts} +8 -1
  48. package/lib/MultiParty/types.d.ts.map +1 -0
  49. package/lib/MultiParty/{Contracts.js → types.js} +1 -1
  50. package/lib/MultiParty/types.js.map +1 -0
  51. package/lib/MultiParty/utils.d.ts +3 -0
  52. package/lib/MultiParty/utils.d.ts.map +1 -0
  53. package/lib/MultiParty/utils.js +21 -0
  54. package/lib/MultiParty/utils.js.map +1 -0
  55. package/package.json +3 -3
  56. package/lib/MultiParty/Contracts.d.ts.map +0 -1
  57. package/lib/MultiParty/Contracts.js.map +0 -1
  58. package/lib/MultiParty/opentok/OpentokUtils.d.ts +0 -2
  59. package/lib/MultiParty/opentok/OpentokUtils.d.ts.map +0 -1
  60. package/lib/MultiParty/opentok/OpentokUtils.js +0 -17
  61. package/lib/MultiParty/opentok/OpentokUtils.js.map +0 -1
@@ -1,16 +1,18 @@
1
1
  import { ClientWebRtcInfo } from '@techsee/techsee-common/lib/data-contracts/ClientInfo';
2
- export declare const DETECT_RTC_ADVISED_TIMEOUT = 20;
3
- export interface WebRtcNativeService extends ClientWebRtcInfo {
4
- load(doneCb: Function): void;
5
- }
6
- export interface IWebRtcDetector {
7
- getWebRtcInfo(): Promise<ClientWebRtcInfo>;
8
- }
9
- export declare class DetectWebRtcService implements IWebRtcDetector {
10
- private _cachedResult;
11
- private readonly _nativeService;
12
- private readonly _detectionTimeoutSec;
13
- constructor(detectionTimeoutSec: number);
14
- getWebRtcInfo(): Promise<ClientWebRtcInfo>;
15
- private static getDefaultResult;
2
+ export declare const DETECT_RTC_ADVISED_TIMEOUT = 20000;
3
+ export declare const defaultWebRtcResult: {
4
+ isWebRTCSupported: boolean;
5
+ isWebsiteHasWebcamPermissions: boolean;
6
+ isWebsiteHasMicrophonePermissions: boolean;
7
+ isGetUserMediaSupported: boolean;
8
+ isApplyConstraintsSupported: boolean;
9
+ };
10
+ export declare class DetectWebRtcService {
11
+ private static instance?;
12
+ private static initPromise;
13
+ private cachedResult;
14
+ private constructor();
15
+ static get: () => Promise<DetectWebRtcService>;
16
+ private init;
17
+ getWebRtcInfo: () => ClientWebRtcInfo;
16
18
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/MultiParty/DetectWebRtcService.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,gBAAgB,EAAC,MAAM,uDAAuD,CAAC;AAKvF,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAE7C,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB;IAEzD,IAAI,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,eAAe;IAC5B,aAAa,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAC9C;AAED,qBAAa,mBAAoB,YAAW,eAAe;IACvD,OAAO,CAAC,aAAa,CAA6B;IAClD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAgC;IAC/D,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAS;gBAElC,mBAAmB,EAAE,MAAM;IAMvC,aAAa,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAsC1C,OAAO,CAAC,MAAM,CAAC,gBAAgB;CASlC","file":"DetectWebRtcService.d.ts","sourcesContent":["import {Nullable} from '@techsee/techsee-common';\nimport {ClientWebRtcInfo} from '@techsee/techsee-common/lib/data-contracts/ClientInfo';\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport detectRTC from '@techsee/techsee-common/lib/detectrtc.js';\n\nexport const DETECT_RTC_ADVISED_TIMEOUT = 20;\n\nexport interface WebRtcNativeService extends ClientWebRtcInfo {\n // eslint-disable-next-line @typescript-eslint/ban-types\n load(doneCb: Function): void;\n}\n\nexport interface IWebRtcDetector {\n getWebRtcInfo(): Promise<ClientWebRtcInfo>;\n}\n\nexport class DetectWebRtcService implements IWebRtcDetector {\n private _cachedResult: Nullable<ClientWebRtcInfo>;\n private readonly _nativeService: Nullable<WebRtcNativeService>;\n private readonly _detectionTimeoutSec: number;\n\n constructor(detectionTimeoutSec: number) {\n this._cachedResult = null;\n this._nativeService = detectRTC;\n this._detectionTimeoutSec = detectionTimeoutSec * 1000;\n }\n\n getWebRtcInfo(): Promise<ClientWebRtcInfo> {\n if (this._cachedResult) {\n return Promise.resolve(this._cachedResult);\n }\n\n if (!this._nativeService) {\n this._cachedResult = DetectWebRtcService.getDefaultResult();\n\n return Promise.resolve(this._cachedResult);\n }\n\n return new Promise((resolve) => {\n let timeoutPtr: any = setTimeout(() => {\n timeoutPtr = null;\n this._cachedResult = DetectWebRtcService.getDefaultResult();\n resolve(this._cachedResult);\n }, this._detectionTimeoutSec);\n\n this._nativeService!.load(() => {\n if (timeoutPtr === null) {\n return;\n }\n\n clearTimeout(timeoutPtr);\n\n this._cachedResult = {\n isWebRTCSupported: this._nativeService!.isWebRTCSupported,\n isWebsiteHasWebcamPermissions: this._nativeService!.isWebsiteHasWebcamPermissions,\n isWebsiteHasMicrophonePermissions: this._nativeService!.isWebsiteHasMicrophonePermissions,\n isGetUserMediaSupported: this._nativeService!.isGetUserMediaSupported,\n isApplyConstraintsSupported: this._nativeService!.isApplyConstraintsSupported\n };\n\n resolve(this._cachedResult);\n });\n });\n }\n\n private static getDefaultResult() {\n return {\n isWebRTCSupported: false,\n isWebsiteHasWebcamPermissions: false,\n isWebsiteHasMicrophonePermissions: false,\n isGetUserMediaSupported: false,\n isApplyConstraintsSupported: false\n };\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/MultiParty/DetectWebRtcService.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,gBAAgB,EAAC,MAAM,uDAAuD,CAAC;AAEvF,eAAO,MAAM,0BAA0B,QAAQ,CAAC;AAEhD,eAAO,MAAM,mBAAmB;;;;;;CAM/B,CAAC;AAEF,qBAAa,mBAAmB;IAC5B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAsB;IAC9C,OAAO,CAAC,MAAM,CAAC,WAAW,CAAoC;IAE9D,OAAO,CAAC,YAAY,CAAyC;IAE7D,OAAO;IAEP,OAAc,GAAG,QAAa,QAAQ,mBAAmB,CAAC,CAWxD;IAEF,OAAO,CAAC,IAAI,CAyBL;IAEA,aAAa,QAAO,gBAAgB,CAAsB;CACpE","file":"DetectWebRtcService.d.ts","sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport detectRTC from '@techsee/techsee-common/lib/detectrtc.js';\nimport {ClientWebRtcInfo} from '@techsee/techsee-common/lib/data-contracts/ClientInfo';\n\nexport const DETECT_RTC_ADVISED_TIMEOUT = 20000;\n\nexport const defaultWebRtcResult = {\n isWebRTCSupported: false,\n isWebsiteHasWebcamPermissions: false,\n isWebsiteHasMicrophonePermissions: false,\n isGetUserMediaSupported: false,\n isApplyConstraintsSupported: false\n};\n\nexport class DetectWebRtcService {\n private static instance?: DetectWebRtcService;\n private static initPromise: Promise<void> = Promise.resolve();\n\n private cachedResult: ClientWebRtcInfo = defaultWebRtcResult;\n\n private constructor() {}\n\n public static get = async (): Promise<DetectWebRtcService> => {\n await DetectWebRtcService.initPromise;\n\n if (!DetectWebRtcService.instance) {\n DetectWebRtcService.instance = new DetectWebRtcService();\n DetectWebRtcService.initPromise = DetectWebRtcService.instance.init();\n\n await DetectWebRtcService.initPromise;\n }\n\n return DetectWebRtcService.instance;\n };\n\n private init = async (): Promise<void> =>\n new Promise((resolve, reject) => {\n let timeoutPtr: NodeJS.Timeout | null = setTimeout(() => {\n timeoutPtr = null;\n this.cachedResult = defaultWebRtcResult;\n reject();\n }, DETECT_RTC_ADVISED_TIMEOUT);\n\n detectRTC.load(() => {\n if (timeoutPtr === null) {\n return;\n }\n\n clearTimeout(timeoutPtr);\n\n this.cachedResult = {\n isWebRTCSupported: detectRTC.isWebRTCSupported,\n isWebsiteHasWebcamPermissions: detectRTC.isWebsiteHasWebcamPermissions,\n isWebsiteHasMicrophonePermissions: detectRTC.isWebsiteHasMicrophonePermissions,\n isGetUserMediaSupported: detectRTC.isGetUserMediaSupported,\n isApplyConstraintsSupported: detectRTC.isApplyConstraintsSupported\n };\n\n resolve();\n });\n });\n\n public getWebRtcInfo = (): ClientWebRtcInfo => this.cachedResult;\n}\n"]}
@@ -1,5 +1,148 @@
1
1
  "use strict";
2
2
 
3
+ var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) {
5
+ return value instanceof P ? value : new P(function (resolve) {
6
+ resolve(value);
7
+ });
8
+ }
9
+
10
+ return new (P || (P = Promise))(function (resolve, reject) {
11
+ function fulfilled(value) {
12
+ try {
13
+ step(generator.next(value));
14
+ } catch (e) {
15
+ reject(e);
16
+ }
17
+ }
18
+
19
+ function rejected(value) {
20
+ try {
21
+ step(generator["throw"](value));
22
+ } catch (e) {
23
+ reject(e);
24
+ }
25
+ }
26
+
27
+ function step(result) {
28
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
29
+ }
30
+
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+
35
+ var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
36
+ var _ = {
37
+ label: 0,
38
+ sent: function sent() {
39
+ if (t[0] & 1) throw t[1];
40
+ return t[1];
41
+ },
42
+ trys: [],
43
+ ops: []
44
+ },
45
+ f,
46
+ y,
47
+ t,
48
+ g;
49
+ return g = {
50
+ next: verb(0),
51
+ "throw": verb(1),
52
+ "return": verb(2)
53
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
54
+ return this;
55
+ }), g;
56
+
57
+ function verb(n) {
58
+ return function (v) {
59
+ return step([n, v]);
60
+ };
61
+ }
62
+
63
+ function step(op) {
64
+ if (f) throw new TypeError("Generator is already executing.");
65
+
66
+ while (_) {
67
+ try {
68
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
69
+ if (y = 0, t) op = [op[0] & 2, t.value];
70
+
71
+ switch (op[0]) {
72
+ case 0:
73
+ case 1:
74
+ t = op;
75
+ break;
76
+
77
+ case 4:
78
+ _.label++;
79
+ return {
80
+ value: op[1],
81
+ done: false
82
+ };
83
+
84
+ case 5:
85
+ _.label++;
86
+ y = op[1];
87
+ op = [0];
88
+ continue;
89
+
90
+ case 7:
91
+ op = _.ops.pop();
92
+
93
+ _.trys.pop();
94
+
95
+ continue;
96
+
97
+ default:
98
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
99
+ _ = 0;
100
+ continue;
101
+ }
102
+
103
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
104
+ _.label = op[1];
105
+ break;
106
+ }
107
+
108
+ if (op[0] === 6 && _.label < t[1]) {
109
+ _.label = t[1];
110
+ t = op;
111
+ break;
112
+ }
113
+
114
+ if (t && _.label < t[2]) {
115
+ _.label = t[2];
116
+
117
+ _.ops.push(op);
118
+
119
+ break;
120
+ }
121
+
122
+ if (t[2]) _.ops.pop();
123
+
124
+ _.trys.pop();
125
+
126
+ continue;
127
+ }
128
+
129
+ op = body.call(thisArg, _);
130
+ } catch (e) {
131
+ op = [6, e];
132
+ y = 0;
133
+ } finally {
134
+ f = t = 0;
135
+ }
136
+ }
137
+
138
+ if (op[0] & 5) throw op[1];
139
+ return {
140
+ value: op[0] ? op[1] : void 0,
141
+ done: true
142
+ };
143
+ }
144
+ };
145
+
3
146
  var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
4
147
  return mod && mod.__esModule ? mod : {
5
148
  "default": mod
@@ -9,69 +152,103 @@ var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
9
152
  Object.defineProperty(exports, "__esModule", {
10
153
  value: true
11
154
  });
12
- exports.DetectWebRtcService = exports.DETECT_RTC_ADVISED_TIMEOUT = void 0; // eslint-disable-next-line @typescript-eslint/ban-ts-comment
155
+ exports.DetectWebRtcService = exports.defaultWebRtcResult = exports.DETECT_RTC_ADVISED_TIMEOUT = void 0; // eslint-disable-next-line @typescript-eslint/ban-ts-comment
13
156
  // @ts-ignore
14
157
 
15
158
  var detectrtc_js_1 = __importDefault(require("@techsee/techsee-common/lib/detectrtc.js"));
16
159
 
17
- exports.DETECT_RTC_ADVISED_TIMEOUT = 20;
160
+ exports.DETECT_RTC_ADVISED_TIMEOUT = 20000;
161
+ exports.defaultWebRtcResult = {
162
+ isWebRTCSupported: false,
163
+ isWebsiteHasWebcamPermissions: false,
164
+ isWebsiteHasMicrophonePermissions: false,
165
+ isGetUserMediaSupported: false,
166
+ isApplyConstraintsSupported: false
167
+ };
18
168
 
19
169
  var DetectWebRtcService =
20
170
  /** @class */
21
171
  function () {
22
- function DetectWebRtcService(detectionTimeoutSec) {
23
- this._cachedResult = null;
24
- this._nativeService = detectrtc_js_1["default"];
25
- this._detectionTimeoutSec = detectionTimeoutSec * 1000;
172
+ function DetectWebRtcService() {
173
+ var _this = this;
174
+
175
+ this.cachedResult = exports.defaultWebRtcResult;
176
+
177
+ this.init = function () {
178
+ return __awaiter(_this, void 0, void 0, function () {
179
+ var _this = this;
180
+
181
+ return __generator(this, function (_a) {
182
+ return [2
183
+ /*return*/
184
+ , new Promise(function (resolve, reject) {
185
+ var timeoutPtr = setTimeout(function () {
186
+ timeoutPtr = null;
187
+ _this.cachedResult = exports.defaultWebRtcResult;
188
+ reject();
189
+ }, exports.DETECT_RTC_ADVISED_TIMEOUT);
190
+ detectrtc_js_1["default"].load(function () {
191
+ if (timeoutPtr === null) {
192
+ return;
193
+ }
194
+
195
+ clearTimeout(timeoutPtr);
196
+ _this.cachedResult = {
197
+ isWebRTCSupported: detectrtc_js_1["default"].isWebRTCSupported,
198
+ isWebsiteHasWebcamPermissions: detectrtc_js_1["default"].isWebsiteHasWebcamPermissions,
199
+ isWebsiteHasMicrophonePermissions: detectrtc_js_1["default"].isWebsiteHasMicrophonePermissions,
200
+ isGetUserMediaSupported: detectrtc_js_1["default"].isGetUserMediaSupported,
201
+ isApplyConstraintsSupported: detectrtc_js_1["default"].isApplyConstraintsSupported
202
+ };
203
+ resolve();
204
+ });
205
+ })];
206
+ });
207
+ });
208
+ };
209
+
210
+ this.getWebRtcInfo = function () {
211
+ return _this.cachedResult;
212
+ };
26
213
  }
27
214
 
28
- DetectWebRtcService.prototype.getWebRtcInfo = function () {
29
- var _this = this;
215
+ DetectWebRtcService.initPromise = Promise.resolve();
30
216
 
31
- if (this._cachedResult) {
32
- return Promise.resolve(this._cachedResult);
33
- }
217
+ DetectWebRtcService.get = function () {
218
+ return __awaiter(void 0, void 0, void 0, function () {
219
+ return __generator(this, function (_a) {
220
+ switch (_a.label) {
221
+ case 0:
222
+ return [4
223
+ /*yield*/
224
+ , DetectWebRtcService.initPromise];
34
225
 
35
- if (!this._nativeService) {
36
- this._cachedResult = DetectWebRtcService.getDefaultResult();
37
- return Promise.resolve(this._cachedResult);
38
- }
226
+ case 1:
227
+ _a.sent();
39
228
 
40
- return new Promise(function (resolve) {
41
- var timeoutPtr = setTimeout(function () {
42
- timeoutPtr = null;
43
- _this._cachedResult = DetectWebRtcService.getDefaultResult();
44
- resolve(_this._cachedResult);
45
- }, _this._detectionTimeoutSec);
229
+ if (!!DetectWebRtcService.instance) return [3
230
+ /*break*/
231
+ , 3];
232
+ DetectWebRtcService.instance = new DetectWebRtcService();
233
+ DetectWebRtcService.initPromise = DetectWebRtcService.instance.init();
234
+ return [4
235
+ /*yield*/
236
+ , DetectWebRtcService.initPromise];
46
237
 
47
- _this._nativeService.load(function () {
48
- if (timeoutPtr === null) {
49
- return;
50
- }
238
+ case 2:
239
+ _a.sent();
240
+
241
+ _a.label = 3;
51
242
 
52
- clearTimeout(timeoutPtr);
53
- _this._cachedResult = {
54
- isWebRTCSupported: _this._nativeService.isWebRTCSupported,
55
- isWebsiteHasWebcamPermissions: _this._nativeService.isWebsiteHasWebcamPermissions,
56
- isWebsiteHasMicrophonePermissions: _this._nativeService.isWebsiteHasMicrophonePermissions,
57
- isGetUserMediaSupported: _this._nativeService.isGetUserMediaSupported,
58
- isApplyConstraintsSupported: _this._nativeService.isApplyConstraintsSupported
59
- };
60
- resolve(_this._cachedResult);
243
+ case 3:
244
+ return [2
245
+ /*return*/
246
+ , DetectWebRtcService.instance];
247
+ }
61
248
  });
62
249
  });
63
250
  };
64
251
 
65
- DetectWebRtcService.getDefaultResult = function () {
66
- return {
67
- isWebRTCSupported: false,
68
- isWebsiteHasWebcamPermissions: false,
69
- isWebsiteHasMicrophonePermissions: false,
70
- isGetUserMediaSupported: false,
71
- isApplyConstraintsSupported: false
72
- };
73
- };
74
-
75
252
  return DetectWebRtcService;
76
253
  }();
77
254
 
@@ -1 +1 @@
1
- {"version":3,"sources":["MultiParty/DetectWebRtcService.js"],"names":["__importDefault","mod","__esModule","Object","defineProperty","exports","value","DetectWebRtcService","DETECT_RTC_ADVISED_TIMEOUT","detectrtc_js_1","require","detectionTimeoutSec","_cachedResult","_nativeService","_detectionTimeoutSec","prototype","getWebRtcInfo","_this","Promise","resolve","getDefaultResult","timeoutPtr","setTimeout","load","clearTimeout","isWebRTCSupported","isWebsiteHasWebcamPermissions","isWebsiteHasMicrophonePermissions","isGetUserMediaSupported","isApplyConstraintsSupported"],"mappings":"AAAA;;AACA,IAAIA,eAAe,GAAI,UAAQ,SAAKA,eAAd,IAAkC,UAAUC,GAAV,EAAe;AACnE,SAAQA,GAAG,IAAIA,GAAG,CAACC,UAAZ,GAA0BD,GAA1B,GAAgC;AAAE,eAAWA;AAAb,GAAvC;AACH,CAFD;;AAGAE,MAAM,CAACC,cAAP,CAAsBC,OAAtB,EAA+B,YAA/B,EAA6C;AAAEC,EAAAA,KAAK,EAAE;AAAT,CAA7C;AACAD,OAAO,CAACE,mBAAR,GAA8BF,OAAO,CAACG,0BAAR,GAAqC,KAAK,CAAxE,C,CACA;AACA;;AACA,IAAIC,cAAc,GAAGT,eAAe,CAACU,OAAO,CAAC,0CAAD,CAAR,CAApC;;AACAL,OAAO,CAACG,0BAAR,GAAqC,EAArC;;AACA,IAAID,mBAAmB;AAAG;AAAe,YAAY;AACjD,WAASA,mBAAT,CAA6BI,mBAA7B,EAAkD;AAC9C,SAAKC,aAAL,GAAqB,IAArB;AACA,SAAKC,cAAL,GAAsBJ,cAAc,WAApC;AACA,SAAKK,oBAAL,GAA4BH,mBAAmB,GAAG,IAAlD;AACH;;AACDJ,EAAAA,mBAAmB,CAACQ,SAApB,CAA8BC,aAA9B,GAA8C,YAAY;AACtD,QAAIC,KAAK,GAAG,IAAZ;;AACA,QAAI,KAAKL,aAAT,EAAwB;AACpB,aAAOM,OAAO,CAACC,OAAR,CAAgB,KAAKP,aAArB,CAAP;AACH;;AACD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EAAE,KAHhC;AAIHC,MAAAA,uBAAuB,EAAE,KAJtB;AAKHC,MAAAA,2BAA2B,EAAE;AAL1B,KAAP;AAOH,GARD;;AASA,SAAOtB,mBAAP;AACH,CA/CwC,EAAzC;;AAgDAF,OAAO,CAACE,mBAAR,GAA8BA,mBAA9B","file":"DetectWebRtcService.js","sourcesContent":["\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DetectWebRtcService = exports.DETECT_RTC_ADVISED_TIMEOUT = void 0;\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nvar detectrtc_js_1 = __importDefault(require(\"@techsee/techsee-common/lib/detectrtc.js\"));\nexports.DETECT_RTC_ADVISED_TIMEOUT = 20;\nvar DetectWebRtcService = /** @class */ (function () {\n function DetectWebRtcService(detectionTimeoutSec) {\n this._cachedResult = null;\n this._nativeService = detectrtc_js_1.default;\n this._detectionTimeoutSec = detectionTimeoutSec * 1000;\n }\n DetectWebRtcService.prototype.getWebRtcInfo = function () {\n var _this = this;\n if (this._cachedResult) {\n return Promise.resolve(this._cachedResult);\n }\n if (!this._nativeService) {\n this._cachedResult = DetectWebRtcService.getDefaultResult();\n return Promise.resolve(this._cachedResult);\n }\n return new Promise(function (resolve) {\n var timeoutPtr = setTimeout(function () {\n timeoutPtr = null;\n _this._cachedResult = DetectWebRtcService.getDefaultResult();\n resolve(_this._cachedResult);\n }, _this._detectionTimeoutSec);\n _this._nativeService.load(function () {\n if (timeoutPtr === null) {\n return;\n }\n clearTimeout(timeoutPtr);\n _this._cachedResult = {\n isWebRTCSupported: _this._nativeService.isWebRTCSupported,\n isWebsiteHasWebcamPermissions: _this._nativeService.isWebsiteHasWebcamPermissions,\n isWebsiteHasMicrophonePermissions: _this._nativeService.isWebsiteHasMicrophonePermissions,\n isGetUserMediaSupported: _this._nativeService.isGetUserMediaSupported,\n isApplyConstraintsSupported: _this._nativeService.isApplyConstraintsSupported\n };\n resolve(_this._cachedResult);\n });\n });\n };\n DetectWebRtcService.getDefaultResult = function () {\n return {\n isWebRTCSupported: false,\n isWebsiteHasWebcamPermissions: false,\n isWebsiteHasMicrophonePermissions: false,\n isGetUserMediaSupported: false,\n isApplyConstraintsSupported: false\n };\n };\n return DetectWebRtcService;\n}());\nexports.DetectWebRtcService = DetectWebRtcService;\n\n//# sourceMappingURL=DetectWebRtcService.js.map\n"]}
1
+ {"version":3,"sources":["MultiParty/DetectWebRtcService.js"],"names":["__awaiter","thisArg","_arguments","P","generator","adopt","value","resolve","Promise","reject","fulfilled","step","next","e","rejected","result","done","then","apply","__generator","body","_","label","sent","t","trys","ops","f","y","g","verb","Symbol","iterator","n","v","op","TypeError","call","pop","length","push","__importDefault","mod","__esModule","Object","defineProperty","exports","DetectWebRtcService","defaultWebRtcResult","DETECT_RTC_ADVISED_TIMEOUT","detectrtc_js_1","require","isWebRTCSupported","isWebsiteHasWebcamPermissions","isWebsiteHasMicrophonePermissions","isGetUserMediaSupported","isApplyConstraintsSupported","_this","cachedResult","init","_a","timeoutPtr","setTimeout","load","clearTimeout","getWebRtcInfo","initPromise","get","instance"],"mappings":"AAAA;;AACA,IAAIA,SAAS,GAAI,UAAQ,SAAKA,SAAd,IAA4B,UAAUC,OAAV,EAAmBC,UAAnB,EAA+BC,CAA/B,EAAkCC,SAAlC,EAA6C;AACrF,WAASC,KAAT,CAAeC,KAAf,EAAsB;AAAE,WAAOA,KAAK,YAAYH,CAAjB,GAAqBG,KAArB,GAA6B,IAAIH,CAAJ,CAAM,UAAUI,OAAV,EAAmB;AAAEA,MAAAA,OAAO,CAACD,KAAD,CAAP;AAAiB,KAA5C,CAApC;AAAoF;;AAC5G,SAAO,KAAKH,CAAC,KAAKA,CAAC,GAAGK,OAAT,CAAN,EAAyB,UAAUD,OAAV,EAAmBE,MAAnB,EAA2B;AACvD,aAASC,SAAT,CAAmBJ,KAAnB,EAA0B;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AA,EAAE,CAACrC,IAAH;;AACA,gBAAI,CAAC,CAACwB,mBAAmB,CAACqB,QAA1B,EAAoC,OAAO,CAAC;AAAE;AAAH,cAAc,CAAd,CAAP;AACpCrB,YAAAA,mBAAmB,CAACqB,QAApB,GAA+B,IAAIrB,mBAAJ,EAA/B;AACAA,YAAAA,mBAAmB,CAACmB,WAApB,GAAkCnB,mBAAmB,CAACqB,QAApB,CAA6BT,IAA7B,EAAlC;AACA,mBAAO,CAAC;AAAE;AAAH,cAAcZ,mBAAmB,CAACmB,WAAlC,CAAP;;AACJ,eAAK,CAAL;AACIN,YAAAA,EAAE,CAACrC,IAAH;;AACAqC,YAAAA,EAAE,CAACtC,KAAH,GAAW,CAAX;;AACJ,eAAK,CAAL;AAAQ,mBAAO,CAAC;AAAE;AAAH,cAAeyB,mBAAmB,CAACqB,QAAnC,CAAP;AAXZ;AAaH,OAdiB,CAAlB;AAeH,KAhBuD,CAAhB;AAgBnC,GAhBL;;AAiBA,SAAOrB,mBAAP;AACH,CAnDwC,EAAzC;;AAoDAD,OAAO,CAACC,mBAAR,GAA8BA,mBAA9B","file":"DetectWebRtcService.js","sourcesContent":["\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DetectWebRtcService = exports.defaultWebRtcResult = exports.DETECT_RTC_ADVISED_TIMEOUT = void 0;\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nvar detectrtc_js_1 = __importDefault(require(\"@techsee/techsee-common/lib/detectrtc.js\"));\nexports.DETECT_RTC_ADVISED_TIMEOUT = 20000;\nexports.defaultWebRtcResult = {\n isWebRTCSupported: false,\n isWebsiteHasWebcamPermissions: false,\n isWebsiteHasMicrophonePermissions: false,\n isGetUserMediaSupported: false,\n isApplyConstraintsSupported: false\n};\nvar DetectWebRtcService = /** @class */ (function () {\n function DetectWebRtcService() {\n var _this = this;\n this.cachedResult = exports.defaultWebRtcResult;\n this.init = function () { return __awaiter(_this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n return [2 /*return*/, new Promise(function (resolve, reject) {\n var timeoutPtr = setTimeout(function () {\n timeoutPtr = null;\n _this.cachedResult = exports.defaultWebRtcResult;\n reject();\n }, exports.DETECT_RTC_ADVISED_TIMEOUT);\n detectrtc_js_1.default.load(function () {\n if (timeoutPtr === null) {\n return;\n }\n clearTimeout(timeoutPtr);\n _this.cachedResult = {\n isWebRTCSupported: detectrtc_js_1.default.isWebRTCSupported,\n isWebsiteHasWebcamPermissions: detectrtc_js_1.default.isWebsiteHasWebcamPermissions,\n isWebsiteHasMicrophonePermissions: detectrtc_js_1.default.isWebsiteHasMicrophonePermissions,\n isGetUserMediaSupported: detectrtc_js_1.default.isGetUserMediaSupported,\n isApplyConstraintsSupported: detectrtc_js_1.default.isApplyConstraintsSupported\n };\n resolve();\n });\n })];\n });\n }); };\n this.getWebRtcInfo = function () { return _this.cachedResult; };\n }\n DetectWebRtcService.initPromise = Promise.resolve();\n DetectWebRtcService.get = function () { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, DetectWebRtcService.initPromise];\n case 1:\n _a.sent();\n if (!!DetectWebRtcService.instance) return [3 /*break*/, 3];\n DetectWebRtcService.instance = new DetectWebRtcService();\n DetectWebRtcService.initPromise = DetectWebRtcService.instance.init();\n return [4 /*yield*/, DetectWebRtcService.initPromise];\n case 2:\n _a.sent();\n _a.label = 3;\n case 3: return [2 /*return*/, DetectWebRtcService.instance];\n }\n });\n }); };\n return DetectWebRtcService;\n}());\nexports.DetectWebRtcService = DetectWebRtcService;\n\n//# sourceMappingURL=DetectWebRtcService.js.map\n"]}
@@ -1,22 +1,16 @@
1
1
  export declare class MediaCapabilitiesService {
2
- private static detectWebRtcService;
3
- private static webRtcSupportInfo;
4
2
  private static instance;
5
- private static devicesList;
6
- private static groupedDevices;
7
- private static _supportSwitchCamera;
8
- private static _backCameraDeviceId;
9
- private static _frontCameraDeviceId;
10
- private static _initPromise;
3
+ private static initPromise;
4
+ private webRtcSupportInfo;
5
+ private devicesList;
11
6
  private environmentService;
7
+ private constructor();
12
8
  static getInstance(): Promise<MediaCapabilitiesService>;
13
- private static init;
9
+ private init;
14
10
  hasCamera(): boolean;
15
11
  hasMicrophone(): boolean;
16
12
  hasWebRTC(): boolean;
17
- hasGetUserMediaSupported(): boolean;
18
- private static setGroupedDevices;
19
- static setDevicesList(): Promise<void>;
13
+ updateDevicesList(reverse?: boolean): Promise<void>;
20
14
  get supportSwitchCamera(): boolean;
21
15
  get backCameraDeviceId(): string;
22
16
  get frontCameraDeviceId(): string;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/MultiParty/MediaCapabilitiesService.ts"],"names":[],"mappings":"AA6BA,qBAAa,wBAAwB;IACjC,OAAO,CAAC,MAAM,CAAC,mBAAmB,CAAsB;IACxD,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAA+B;IAC/D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA2B;IAClD,OAAO,CAAC,MAAM,CAAC,WAAW,CAAuD;IACjF,OAAO,CAAC,MAAM,CAAC,cAAc,CAA8C;IAC3E,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAAU;IAC7C,OAAO,CAAC,MAAM,CAAC,mBAAmB,CAAS;IAC3C,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAAS;IAC5C,OAAO,CAAC,MAAM,CAAC,YAAY,CAAoC;IAC/D,OAAO,CAAC,kBAAkB,CAA6B;WAEnC,WAAW,IAAI,OAAO,CAAC,wBAAwB,CAAC;mBAoB/C,IAAI;IAmBlB,SAAS,IAAI,OAAO;IAIpB,aAAa,IAAI,OAAO;IAMxB,SAAS,IAAI,OAAO;IAIpB,wBAAwB,IAAI,OAAO;IAI1C,OAAO,CAAC,MAAM,CAAC,iBAAiB;WAaZ,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAWnD,IAAW,mBAAmB,YAE7B;IAED,IAAW,kBAAkB,WAE5B;IAED,IAAW,mBAAmB,WAE7B;CACJ","file":"MediaCapabilitiesService.d.ts","sourcesContent":["// eslint-disable-next-line @typescript-eslint/no-var-requires\nimport {getMediaTracer} from '../MediaUtils/MediaTracer';\nimport {DETECT_RTC_ADVISED_TIMEOUT, DetectWebRtcService} from './DetectWebRtcService';\nimport {ClientWebRtcInfo} from '../MediaContracts';\nimport filter from 'lodash/filter';\nimport {TsEnvironmentDetect} from '@techsee/techsee-common/lib/helpers/ts-environment-detect';\nimport {CameraTypes} from '../MediaConstants';\nimport last from 'lodash/last';\nimport first from 'lodash/first';\nimport get from 'lodash/get';\nimport {Nullable} from '@techsee/techsee-common';\n\nconst trace = getMediaTracer('MediaCapabilitiesService');\n\nfunction enumerateMediaDevices(): Promise<MediaDeviceInfo[]> {\n return new Promise((resolve, reject) => {\n if (navigator.mediaDevices && navigator.mediaDevices.enumerateDevices) {\n return navigator.mediaDevices.enumerateDevices().then(resolve).catch(reject);\n }\n\n return resolve([]);\n });\n}\n\ntype GroupedDevices = {\n video: Nullable<{back?: MediaDeviceInfo; front?: MediaDeviceInfo}>;\n audio: Nullable<MediaDeviceInfo>;\n};\n\nexport class MediaCapabilitiesService {\n private static detectWebRtcService: DetectWebRtcService;\n private static webRtcSupportInfo: ClientWebRtcInfo | undefined;\n private static instance: MediaCapabilitiesService;\n private static devicesList: {video: MediaDeviceInfo[]; audio: MediaDeviceInfo[]};\n private static groupedDevices: GroupedDevices = {video: null, audio: null};\n private static _supportSwitchCamera: boolean;\n private static _backCameraDeviceId: string;\n private static _frontCameraDeviceId: string;\n private static _initPromise: Promise<MediaCapabilitiesService>;\n private environmentService = new TsEnvironmentDetect();\n\n public static async getInstance(): Promise<MediaCapabilitiesService> {\n try {\n if (this.instance) {\n return this.instance;\n }\n\n if (this._initPromise) {\n return await this._initPromise;\n }\n\n this._initPromise = this.init();\n\n return await this._initPromise;\n } catch (err) {\n trace.error(JSON.stringify(err));\n\n throw err;\n }\n }\n\n private static async init(): Promise<MediaCapabilitiesService> {\n try {\n this.instance = new MediaCapabilitiesService();\n\n this.detectWebRtcService = new DetectWebRtcService(DETECT_RTC_ADVISED_TIMEOUT);\n\n this.webRtcSupportInfo = await this.detectWebRtcService.getWebRtcInfo();\n await this.setDevicesList();\n\n trace.info('initialize media capabilities helper successfully');\n\n return this.instance;\n } catch (err) {\n trace.error(JSON.stringify(err));\n\n throw err;\n }\n }\n\n public hasCamera(): boolean {\n return MediaCapabilitiesService.devicesList.video.length > 0 && this.hasGetUserMediaSupported();\n }\n\n public hasMicrophone(): boolean {\n return this.environmentService.isIOS()\n ? this.hasGetUserMediaSupported()\n : MediaCapabilitiesService.devicesList.audio.length > 0 && this.hasGetUserMediaSupported();\n }\n\n public hasWebRTC(): boolean {\n return MediaCapabilitiesService.webRtcSupportInfo!.isWebRTCSupported;\n }\n\n public hasGetUserMediaSupported(): boolean {\n return MediaCapabilitiesService.webRtcSupportInfo!.isGetUserMediaSupported;\n }\n\n private static setGroupedDevices() {\n trace.info('setGroupedDevices', this.devicesList);\n this.groupedDevices = {\n video: this.devicesList.video\n ? {[CameraTypes.BACK]: last(this.devicesList.video), [CameraTypes.FRONT]: first(this.devicesList.video)}\n : null,\n audio: last(this.devicesList.audio) || null\n };\n this._supportSwitchCamera = this.devicesList.video.length > 1;\n this._backCameraDeviceId = get(this.groupedDevices, `video.${CameraTypes.BACK}.deviceId`) || '';\n this._frontCameraDeviceId = get(this.groupedDevices, `video.${CameraTypes.FRONT}.deviceId`) || '';\n }\n\n public static async setDevicesList(): Promise<void> {\n const localDevicesList = this.webRtcSupportInfo!.isWebRTCSupported ? await enumerateMediaDevices() : [];\n\n this.devicesList = {\n video: filter(localDevicesList, (device) => device.kind.toLowerCase() === 'videoinput'),\n audio: filter(localDevicesList, (device) => device.kind.toLowerCase() === 'audioinput')\n };\n\n this.setGroupedDevices();\n }\n\n public get supportSwitchCamera() {\n return MediaCapabilitiesService._supportSwitchCamera;\n }\n\n public get backCameraDeviceId() {\n return MediaCapabilitiesService._backCameraDeviceId;\n }\n\n public get frontCameraDeviceId() {\n return MediaCapabilitiesService._frontCameraDeviceId;\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/MultiParty/MediaCapabilitiesService.ts"],"names":[],"mappings":"AAYA,qBAAa,wBAAwB;IACjC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA2B;IAClD,OAAO,CAAC,MAAM,CAAC,WAAW,CAAoC;IAE9D,OAAO,CAAC,iBAAiB,CAAyC;IAElE,OAAO,CAAC,WAAW,CAGjB;IAEF,OAAO,CAAC,kBAAkB,CAA6B;IAEvD,OAAO;WAEa,WAAW,IAAI,OAAO,CAAC,wBAAwB,CAAC;YAatD,IAAI;IAUX,SAAS,IAAI,OAAO;IAIpB,aAAa,IAAI,OAAO;IAQxB,SAAS,IAAI,OAAO;IAId,iBAAiB,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAchE,IAAW,mBAAmB,IAAI,OAAO,CAExC;IAED,IAAW,kBAAkB,IAAI,MAAM,CAEtC;IAED,IAAW,mBAAmB,IAAI,MAAM,CAEvC;CACJ","file":"MediaCapabilitiesService.d.ts","sourcesContent":["import {TsEnvironmentDetect} from '@techsee/techsee-common/lib/helpers/ts-environment-detect';\nimport {getMediaTracer} from './MediaTracer';\nimport {defaultWebRtcResult, DetectWebRtcService} from './DetectWebRtcService';\nimport {ClientWebRtcInfo} from './types';\n\nconst trace = getMediaTracer('MediaCapabilitiesService');\n\ntype DevicesList = {\n video: MediaDeviceInfo[];\n audio: MediaDeviceInfo[];\n};\n\nexport class MediaCapabilitiesService {\n private static instance: MediaCapabilitiesService;\n private static initPromise: Promise<void> = Promise.resolve();\n\n private webRtcSupportInfo: ClientWebRtcInfo = defaultWebRtcResult;\n\n private devicesList: DevicesList = {\n video: [],\n audio: []\n };\n\n private environmentService = new TsEnvironmentDetect();\n\n private constructor() {}\n\n public static async getInstance(): Promise<MediaCapabilitiesService> {\n await this.initPromise;\n\n if (!this.instance) {\n this.instance = new MediaCapabilitiesService();\n this.initPromise = this.instance.init();\n\n await this.initPromise;\n }\n\n return this.instance;\n }\n\n private async init(): Promise<void> {\n const detectWebRtcService = await DetectWebRtcService.get();\n\n this.webRtcSupportInfo = detectWebRtcService.getWebRtcInfo();\n\n await this.updateDevicesList();\n\n trace.info('initialize media capabilities helper successfully');\n }\n\n public hasCamera(): boolean {\n return this.devicesList.video.length > 0 && this.webRtcSupportInfo.isGetUserMediaSupported;\n }\n\n public hasMicrophone(): boolean {\n const userMediaSupported = this.webRtcSupportInfo.isGetUserMediaSupported;\n\n return this.environmentService.isIOS()\n ? userMediaSupported\n : this.devicesList.audio.length > 0 && userMediaSupported;\n }\n\n public hasWebRTC(): boolean {\n return this.webRtcSupportInfo.isWebRTCSupported;\n }\n\n public async updateDevicesList(reverse?: boolean): Promise<void> {\n const localDevicesList = this.webRtcSupportInfo.isWebRTCSupported\n ? (await navigator?.mediaDevices?.enumerateDevices()) || []\n : [];\n\n this.devicesList = {\n video: localDevicesList.filter((device) => device.kind.toLowerCase() === 'videoinput'),\n audio: localDevicesList.filter((device) => device.kind.toLowerCase() === 'audioinput')\n };\n if (reverse) {\n this.devicesList.video.reverse();\n }\n }\n\n public get supportSwitchCamera(): boolean {\n return this.devicesList.video.length > 1;\n }\n\n public get backCameraDeviceId(): string {\n return this.devicesList.video[this.devicesList.video.length - 1]?.deviceId || '';\n }\n\n public get frontCameraDeviceId(): string {\n return this.devicesList.video[0]?.deviceId || '';\n }\n}\n"]}