@zegocloud/zego-uikit-prebuilt 1.3.5 → 1.3.7

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/1On1Call.html ADDED
@@ -0,0 +1,49 @@
1
+ <html>
2
+
3
+ <head>
4
+ <style>
5
+ #root {
6
+ width: 100vw;
7
+ height: 100vh;
8
+ }
9
+ </style>
10
+ </head>
11
+
12
+
13
+ <body>
14
+ <div id="root"></div>
15
+ </body>
16
+ <script src="https://resource.zegocloud.com/prebuilt/crypto-js.js"></script>
17
+ <script src="https://resource.zegocloud.com/prebuilt/prebuiltToken.js"></script>
18
+ <script src="https://unpkg.com/@zegocloud/zego-uikit-prebuilt@beta/zego-uikit-prebuilt.js"></script>
19
+ <script>
20
+ // Generate a Token by calling a method.
21
+ // @param 1: appID
22
+ // @param 2: serverSecret
23
+ // @param 3: Room ID
24
+ // @param 4: User ID
25
+ // @param 5: Username
26
+ const roomID = 'room01';
27
+ const userID = Math.floor(Math.random() * 10000) + "";
28
+ const userName = "userName" + userID;
29
+ const appID = 11111;
30
+ const serverSecret = "22076fd0a8388.......";
31
+ const TOKEN = generatePrebuiltToken(appID, serverSecret, roomID, userID, userName);
32
+
33
+
34
+
35
+ const zp = ZegoUIKitPrebuilt.create(TOKEN);
36
+ zp.joinRoom({
37
+ container: document.querySelector("#root"),
38
+ sharedLinks: [{
39
+ name: 'Join as Host',
40
+ url: window.location.origin + window.location.pathname + '?roomID=' + roomID,
41
+ }],
42
+ scenario: {
43
+ mode: ZegoUIKitPrebuilt.OneONoneCall, // To implement group calls, modify the parameter here to [ZegoUIKitPrebuilt.GroupCall].
44
+ },
45
+
46
+ });
47
+ </script>
48
+
49
+ </html>
package/groupCall.html ADDED
@@ -0,0 +1,49 @@
1
+ <html>
2
+
3
+ <head>
4
+ <style>
5
+ #root {
6
+ width: 100vw;
7
+ height: 100vh;
8
+ }
9
+ </style>
10
+ </head>
11
+
12
+
13
+ <body>
14
+ <div id="root"></div>
15
+ </body>
16
+ <script src="https://resource.zegocloud.com/prebuilt/crypto-js.js"></script>
17
+ <script src="https://resource.zegocloud.com/prebuilt/prebuiltToken.js"></script>
18
+ <script src="https://unpkg.com/@zegocloud/zego-uikit-prebuilt@beta/zego-uikit-prebuilt.js"></script>
19
+ <script>
20
+ // Generate a Token by calling a method.
21
+ // @param 1: appID
22
+ // @param 2: serverSecret
23
+ // @param 3: Room ID
24
+ // @param 4: User ID
25
+ // @param 5: Username
26
+ const roomID = 'room01';
27
+ const userID = Math.floor(Math.random() * 10000) + "";
28
+ const userName = "userName" + userID;
29
+ const appID = 11111;
30
+ const serverSecret = "22076fd0a8388.......";
31
+ const TOKEN = generatePrebuiltToken(appID, serverSecret, roomID, userID, userName);
32
+
33
+
34
+
35
+ const zp = ZegoUIKitPrebuilt.create(TOKEN);
36
+ zp.joinRoom({
37
+ container: document.querySelector("#root"),
38
+ sharedLinks: [{
39
+ name: 'Join as Host',
40
+ url: window.location.origin + window.location.pathname + '?roomID=' + roomID,
41
+ }],
42
+ scenario: {
43
+ mode: ZegoUIKitPrebuilt.GroupCall, // To implement 1-on-1 calls, modify the parameter here to [ZegoUIKitPrebuilt.OneONoneCall].
44
+ },
45
+
46
+ });
47
+ </script>
48
+
49
+ </html>
@@ -0,0 +1,68 @@
1
+ <html>
2
+
3
+ <head>
4
+ <style>
5
+ #root {
6
+ width: 100vw;
7
+ height: 100vh;
8
+ }
9
+ </style>
10
+ </head>
11
+
12
+
13
+ <body>
14
+ <div id="root"></div>
15
+ </body>
16
+ <script src="https://resource.zegocloud.com/prebuilt/crypto-js.js"></script>
17
+ <script src="https://resource.zegocloud.com/prebuilt/prebuiltToken.js"></script>
18
+ <script src="https://unpkg.com/@zegocloud/zego-uikit-prebuilt@beta/zego-uikit-prebuilt.js"></script>
19
+ <script>
20
+
21
+ function getUrlParams(url) {
22
+ let urlStr = url.split('?')[1];
23
+ const urlSearchParams = new URLSearchParams(urlStr);
24
+ const result = Object.fromEntries(urlSearchParams.entries());
25
+ return result;
26
+ }
27
+
28
+
29
+ // Generate a Token by calling a method.
30
+ // @param 1: appID
31
+ // @param 2: serverSecret
32
+ // @param 3: Room ID
33
+ // @param 4: User ID
34
+ // @param 5: Username
35
+ const roomID = 'room01';
36
+ const userID = Math.floor(Math.random() * 10000) + "";
37
+ const userName = "userName" + userID;
38
+ const appID = 11111;
39
+ const serverSecret = "22076fd0a83......";
40
+ const TOKEN = generatePrebuiltToken(appID, serverSecret, roomID, userID, userName);
41
+
42
+ // You can assign different roles based on url parameters.
43
+ let role = getUrlParams(window.location.href)['role'] || 'Host';
44
+ role = role === 'Host' ? ZegoUIKitPrebuilt.Host : ZegoUIKitPrebuilt.Audience;
45
+
46
+
47
+ const zp = ZegoUIKitPrebuilt.create(TOKEN);
48
+ zp.joinRoom({
49
+ container: document.querySelector("#root"),
50
+ scenario: {
51
+ mode: ZegoUIKitPrebuilt.LiveStreaming,
52
+ config: {
53
+ role,
54
+ },
55
+ },
56
+ sharedLinks: [{
57
+ name: 'Join as audience',
58
+ url:
59
+ window.location.origin +
60
+ window.location.pathname +
61
+ '?roomID=' +
62
+ roomID +
63
+ '&role=Audience',
64
+ }]
65
+ });
66
+ </script>
67
+
68
+ </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zegocloud/zego-uikit-prebuilt",
3
- "version": "1.3.5",
3
+ "version": "1.3.7",
4
4
  "description": "zegocloud prebuilt meeting webrtc sdk",
5
5
  "main": "./zego-uikit-prebuilt.js",
6
6
  "typings": "./sdk/index.d.ts",
@@ -0,0 +1,49 @@
1
+ <html>
2
+
3
+ <head>
4
+ <style>
5
+ #root {
6
+ width: 100vw;
7
+ height: 100vh;
8
+ }
9
+ </style>
10
+ </head>
11
+
12
+
13
+ <body>
14
+ <div id="root"></div>
15
+ </body>
16
+ <script src="https://resource.zegocloud.com/prebuilt/crypto-js.js"></script>
17
+ <script src="https://resource.zegocloud.com/prebuilt/prebuiltToken.js"></script>
18
+ <script src="https://unpkg.com/@zegocloud/zego-uikit-prebuilt@beta/zego-uikit-prebuilt.js"></script>
19
+ <script>
20
+ // Generate a Token by calling a method.
21
+ // @param 1: appID
22
+ // @param 2: serverSecret
23
+ // @param 3: Room ID
24
+ // @param 4: User ID
25
+ // @param 5: Username
26
+ const roomID = 'room01';
27
+ const userID = Math.floor(Math.random() * 10000) + "";
28
+ const userName = "userName" + userID;
29
+ const appID = 11111;
30
+ const serverSecret = "22076fd0a8388.......";
31
+ const TOKEN = generatePrebuiltToken(appID, serverSecret, roomID, userID, userName);
32
+
33
+
34
+
35
+ const zp = ZegoUIKitPrebuilt.create(TOKEN);
36
+ zp.joinRoom({
37
+ container: document.querySelector("#root"),
38
+ sharedLinks: [{
39
+ name: 'Join as Host',
40
+ url: window.location.origin + window.location.pathname + '?roomID=' + roomID,
41
+ }],
42
+ scenario: {
43
+ mode: ZegoUIKitPrebuilt.VideoConference,
44
+ },
45
+
46
+ });
47
+ </script>
48
+
49
+ </html>
@@ -1566,7 +1566,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
1566
1566
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1567
1567
 
1568
1568
  "use strict";
1569
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ZegoCloudRTCCore\": function() { return /* binding */ ZegoCloudRTCCore; }\n/* harmony export */ });\n/* harmony import */ var _tools_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./tools/util */ \"./src/sdk/modules/tools/util.ts\");\n/* harmony import */ var zego_express_engine_webrtc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! zego-express-engine-webrtc */ \"./node_modules/zego-express-engine-webrtc/ZegoExpressWebRTC.js\");\n/* harmony import */ var zego_express_engine_webrtc__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(zego_express_engine_webrtc__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _model__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../model */ \"./src/sdk/model/index.ts\");\n/* harmony import */ var _tools_UserListManager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./tools/UserListManager */ \"./src/sdk/modules/tools/UserListManager.ts\");\nvar __assign = (undefined && undefined.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __awaiter = (undefined && undefined.__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 = (undefined && undefined.__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 __spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\n\n\n\n\nvar ZegoCloudRTCCore = /** @class */ (function () {\n function ZegoCloudRTCCore() {\n var _this = this;\n this.status = {\n loginRsp: false,\n videoRefuse: false,\n audioRefuse: false,\n };\n this.remoteStreamMap = {};\n this._config = {\n // @ts-ignore\n container: undefined,\n preJoinViewConfig: {\n title: \"Join Room\",\n invitationLink: window.location.href, // 邀请链接,空则不显示,默认空\n },\n showPreJoinView: true,\n turnOnMicrophoneWhenJoining: true,\n turnOnCameraWhenJoining: true,\n showMyCameraToggleButton: true,\n showMyMicrophoneToggleButton: true,\n showAudioVideoSettingsButton: true,\n showTextChat: true,\n showUserList: true,\n lowerLeftNotification: {\n showUserJoinAndLeave: true,\n showTextChat: true, // 是否显示未读消息,默认显示\n },\n branding: {\n logoURL: \"\",\n },\n showLeavingView: true,\n maxUsers: 2,\n layout: \"Auto\",\n showNonVideoUser: true,\n showOnlyAudioUser: false,\n useFrontFacingCamera: true,\n onJoinRoom: function () { },\n onLeaveRoom: function () { },\n onUserJoin: function (user) { },\n onUserLeave: function (user) { },\n sharedLinks: [],\n showScreenSharingButton: true,\n scenario: {\n mode: _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.OneONoneCall,\n config: { role: _model__WEBPACK_IMPORTED_MODULE_2__.LiveRole.Host }, // 对应场景专有配置\n },\n facingMode: \"user\",\n joinRoomCallback: function () { },\n leaveRoomCallback: function () { },\n userUpdateCallback: function () { },\n showLayoutButton: true,\n showPinButton: true, // 是否显pin按钮\n };\n this._currentPage = \"BrowserCheckPage\";\n this.extraInfoKey = \"extra_info\";\n this._roomExtraInfo = {\n live_status: {\n v: 0,\n u: \"xxx\",\n r: 0,\n },\n };\n this.waitingHandlerStreams = { add: [], delete: [] };\n this.onRemoteMediaUpdateCallBack = function (updateType, streamList) { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.zum.mainStreamUpdate(updateType, streamList)];\n case 1:\n _a.sent();\n return [4 /*yield*/, this.zum.screenStreamUpdate(updateType, streamList)];\n case 2:\n _a.sent();\n this.subscribeUserListCallBack &&\n this.subscribeUserListCallBack(__spreadArray([], this.zum.remoteUserList, true));\n this.subscribeScreenStreamCallBack &&\n this.subscribeScreenStreamCallBack(__spreadArray([], this.zum.remoteScreenStreamList, true));\n return [2 /*return*/];\n }\n });\n }); };\n this.NetworkStatusTimer = null;\n }\n // static _soundMeter: SoundMeter;\n ZegoCloudRTCCore.getInstance = function (token) {\n var config = (0,_tools_util__WEBPACK_IMPORTED_MODULE_0__.getConfig)(token);\n if (!ZegoCloudRTCCore._instance && config) {\n ZegoCloudRTCCore._instance = new ZegoCloudRTCCore();\n ZegoCloudRTCCore._instance._expressConfig = config;\n // ZegoCloudRTCCore._soundMeter = new SoundMeter();\n ZegoCloudRTCCore._zg = new zego_express_engine_webrtc__WEBPACK_IMPORTED_MODULE_1__.ZegoExpressEngine(ZegoCloudRTCCore._instance._expressConfig.appID, \"wss://webliveroom\" +\n ZegoCloudRTCCore._instance._expressConfig.appID +\n \"-api.zegocloud.com/ws\");\n ZegoCloudRTCCore._instance.zum = new _tools_UserListManager__WEBPACK_IMPORTED_MODULE_3__.ZegoCloudUserListManager(ZegoCloudRTCCore._zg);\n }\n return ZegoCloudRTCCore._instance;\n };\n ZegoCloudRTCCore.prototype.checkWebRTC = function () {\n return __awaiter(this, void 0, void 0, function () {\n var result;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, ZegoCloudRTCCore._zg.checkSystemRequirements(\"webRTC\")];\n case 1:\n result = _a.sent();\n return [2 /*return*/, !!result.result];\n }\n });\n });\n };\n ZegoCloudRTCCore.prototype.setConfig = function (config) {\n var _a, _b, _c, _d;\n if (config.scenario &&\n config.scenario.mode === _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.LiveStreaming) {\n if (config.showNonVideoUser === true) {\n console.error(\"【ZEGOCLOUD】 showNonVideoUser have be false scenario.mode is LiveStreaming!!\");\n return false;\n }\n config.showNonVideoUser = false;\n config.showOnlyAudioUser = true;\n if (config.scenario.config &&\n config.scenario.config.role === _model__WEBPACK_IMPORTED_MODULE_2__.LiveRole.Host) {\n if (config.turnOnMicrophoneWhenJoining === false &&\n config.turnOnCameraWhenJoining === false &&\n config.showMyCameraToggleButton === false &&\n config.showAudioVideoSettingsButton === false) {\n console.error(\"【ZEGOCLOUD】 Host could turn on at least one of the camera and the microphone!!\");\n return false;\n }\n }\n else if (config.scenario.config &&\n config.scenario.config.role === _model__WEBPACK_IMPORTED_MODULE_2__.LiveRole.Audience) {\n if (config.turnOnMicrophoneWhenJoining === true ||\n config.turnOnCameraWhenJoining === true ||\n config.showMyCameraToggleButton === true ||\n config.showMyMicrophoneToggleButton === true ||\n config.showAudioVideoSettingsButton === true ||\n config.showScreenSharingButton === true ||\n config.useFrontFacingCamera === true ||\n (!!config.layout && config.layout !== \"Grid\")) {\n console.error(\"【ZEGOCLOUD】 Audience cannot configure camera and microphone related params\");\n return false;\n }\n }\n if (!config.maxUsers) {\n config.maxUsers = 5000;\n }\n if (config.scenario.config &&\n config.scenario.config.role === _model__WEBPACK_IMPORTED_MODULE_2__.LiveRole.Audience) {\n config.turnOnMicrophoneWhenJoining = false;\n config.turnOnCameraWhenJoining = false;\n config.showMyCameraToggleButton = false;\n config.showMyMicrophoneToggleButton = false;\n config.showAudioVideoSettingsButton = false;\n config.showScreenSharingButton = false;\n config.useFrontFacingCamera = false;\n config.useFrontFacingCamera = false;\n config.showUserList = false;\n config.showPinButton = false;\n config.showLayoutButton = false;\n config.layout = \"Grid\";\n config.lowerLeftNotification = {\n showTextChat: false,\n showUserJoinAndLeave: false,\n };\n }\n }\n if (config.scenario &&\n config.scenario.mode === _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.OneONoneCall) {\n if (!config.maxUsers) {\n config.maxUsers = 2;\n }\n config.showLayoutButton = false;\n config.showPinButton = false;\n }\n if (config.scenario && config.scenario.mode === _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.GroupCall) {\n if (!config.maxUsers) {\n config.maxUsers = 50;\n }\n }\n config.facingMode &&\n (config.useFrontFacingCamera = config.facingMode === \"user\");\n config.joinRoomCallback && (config.onJoinRoom = config.joinRoomCallback);\n config.leaveRoomCallback && (config.onLeaveRoom = config.leaveRoomCallback);\n if (config.userUpdateCallback) {\n config.onUserJoin = function (users) {\n config.userUpdateCallback && config.userUpdateCallback(\"ADD\", users);\n };\n config.onUserLeave = function (users) {\n config.userUpdateCallback && config.userUpdateCallback(\"DELETE\", users);\n };\n }\n if (config.preJoinViewConfig && config.preJoinViewConfig.invitationLink) {\n config.sharedLinks = [\n {\n name: \"Share the link\",\n url: config.preJoinViewConfig.invitationLink,\n },\n ];\n }\n config.preJoinViewConfig &&\n (config.preJoinViewConfig = __assign(__assign({}, this._config.preJoinViewConfig), config.preJoinViewConfig));\n config.scenario &&\n config.scenario.config &&\n (config.scenario.config = __assign(__assign({}, (_a = this._config.scenario) === null || _a === void 0 ? void 0 : _a.config), config.scenario.config));\n this._config = __assign(__assign({}, this._config), config);\n this.zum.scenario =\n ((_b = this._config.scenario) === null || _b === void 0 ? void 0 : _b.mode) || _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.OneONoneCall;\n this.zum.role = ((_d = (_c = this._config.scenario) === null || _c === void 0 ? void 0 : _c.config) === null || _d === void 0 ? void 0 : _d.role) || _model__WEBPACK_IMPORTED_MODULE_2__.LiveRole.Host;\n this.zum.showOnlyAudioUser = !!this._config.showOnlyAudioUser;\n this.zum.setShowNonVideo(!!this._config.showNonVideoUser);\n return true;\n };\n ZegoCloudRTCCore.prototype.setPin = function (userID, pined) {\n this.zum.setPin(userID, pined);\n this.subscribeUserListCallBack &&\n this.subscribeUserListCallBack(__spreadArray([], this.zum.remoteUserList, true));\n };\n ZegoCloudRTCCore.prototype.setMaxScreenNum = function (num) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.zum.setMaxScreenNum(num)];\n case 1:\n _a.sent();\n this.subscribeUserListCallBack &&\n this.subscribeUserListCallBack(__spreadArray([], this.zum.remoteUserList, true));\n return [2 /*return*/];\n }\n });\n });\n };\n ZegoCloudRTCCore.prototype.setSidebarLayOut = function (enable) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.zum.setSidebarLayOut(enable)];\n case 1:\n _a.sent();\n this.subscribeUserListCallBack &&\n this.subscribeUserListCallBack(__spreadArray([], this.zum.remoteUserList, true));\n return [2 /*return*/];\n }\n });\n });\n };\n ZegoCloudRTCCore.prototype.setShowNonVideo = function (enable) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.zum.setShowNonVideo(enable)];\n case 1:\n _a.sent();\n this.subscribeUserListCallBack &&\n this.subscribeUserListCallBack(__spreadArray([], this.zum.remoteUserList, true));\n return [2 /*return*/];\n }\n });\n });\n };\n ZegoCloudRTCCore.prototype.setCurrentPage = function (page) {\n this._currentPage = page;\n };\n ZegoCloudRTCCore.prototype.getCameras = function () {\n return ZegoCloudRTCCore._zg.getCameras();\n };\n ZegoCloudRTCCore.prototype.useVideoDevice = function (localStream, deviceID) {\n return ZegoCloudRTCCore._zg.useVideoDevice(localStream, deviceID);\n };\n ZegoCloudRTCCore.prototype.getMicrophones = function () {\n return ZegoCloudRTCCore._zg.getMicrophones();\n };\n ZegoCloudRTCCore.prototype.getSpeakers = function () {\n return ZegoCloudRTCCore._zg.getSpeakers();\n };\n ZegoCloudRTCCore.prototype.setVolume = function (media, volume) {\n media.volume = volume;\n };\n ZegoCloudRTCCore.prototype.createStream = function (source) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, ZegoCloudRTCCore._zg.createStream(source)];\n });\n });\n };\n ZegoCloudRTCCore.prototype.setVideoConfig = function (media, constraints) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, ZegoCloudRTCCore._zg.setVideoConfig(media, constraints)];\n });\n });\n };\n ZegoCloudRTCCore.prototype.stopPublishingStream = function (streamID) {\n return ZegoCloudRTCCore._zg.stopPublishingStream(streamID);\n };\n ZegoCloudRTCCore.prototype.destroyStream = function (stream) {\n ZegoCloudRTCCore._zg.destroyStream(stream);\n };\n ZegoCloudRTCCore.prototype.useCameraDevice = function (media, deviceID) {\n return ZegoCloudRTCCore._zg.useVideoDevice(media, deviceID);\n };\n ZegoCloudRTCCore.prototype.useMicrophoneDevice = function (media, deviceID) {\n return ZegoCloudRTCCore._zg.useAudioDevice(media, deviceID);\n };\n ZegoCloudRTCCore.prototype.useSpeakerDevice = function (media, deviceID) {\n return __awaiter(this, void 0, void 0, function () {\n var res, error_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!media.srcObject) {\n return [2 /*return*/, Promise.resolve({ errorCode: -1 })];\n }\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, ZegoCloudRTCCore._zg.useAudioOutputDevice(media, deviceID)];\n case 2:\n res = _a.sent();\n return [2 /*return*/, { errorCode: res ? 0 : -1 }];\n case 3:\n error_1 = _a.sent();\n return [2 /*return*/, { errorCode: -1 }];\n case 4: return [2 /*return*/];\n }\n });\n });\n };\n ZegoCloudRTCCore.prototype.enableVideoCaptureDevice = function (localStream, enable) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, ZegoCloudRTCCore._zg.enableVideoCaptureDevice(localStream, enable)];\n });\n });\n };\n ZegoCloudRTCCore.prototype.mutePublishStreamVideo = function (localStream, enable) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, ZegoCloudRTCCore._zg.mutePublishStreamVideo(localStream, enable)];\n });\n });\n };\n ZegoCloudRTCCore.prototype.mutePublishStreamAudio = function (localStream, enable) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, ZegoCloudRTCCore._zg.mutePublishStreamAudio(localStream, enable)];\n });\n });\n };\n ZegoCloudRTCCore.prototype.muteMicrophone = function (enable) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, ZegoCloudRTCCore._zg.muteMicrophone(enable)];\n });\n });\n };\n Object.defineProperty(ZegoCloudRTCCore.prototype, \"roomExtraInfo\", {\n get: function () {\n return this._roomExtraInfo;\n },\n set: function (value) {\n var _this = this;\n if (this._currentPage === \"Room\") {\n this._roomExtraInfo = value;\n this.zum.setLiveStates(this._roomExtraInfo.live_status.v);\n console.error(\"【ZEGOCLOUD】roomExtraInfo choui\", value, this.onRoomLiveStateUpdateCallBack);\n this.onRoomLiveStateUpdateCallBack &&\n this.onRoomLiveStateUpdateCallBack(this._roomExtraInfo.live_status.v);\n }\n else if (this._currentPage === \"BrowserCheckPage\") {\n setTimeout(function () {\n _this.roomExtraInfo = value;\n }, 1000);\n }\n },\n enumerable: false,\n configurable: true\n });\n ZegoCloudRTCCore.prototype.setLive = function (status) {\n var _a, _b, _c, _d;\n return __awaiter(this, void 0, void 0, function () {\n var setRoomExtraInfo, res;\n return __generator(this, function (_e) {\n switch (_e.label) {\n case 0:\n setRoomExtraInfo = __assign(__assign({}, this._roomExtraInfo), {\n live_status: {\n v: status === \"live\" ? 1 : 0,\n u: ZegoCloudRTCCore._instance._expressConfig.userID,\n r: ((_b = (_a = ZegoCloudRTCCore._instance._config.scenario) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.role) ===\n _model__WEBPACK_IMPORTED_MODULE_2__.LiveRole.Host\n ? 1\n : ((_d = (_c = ZegoCloudRTCCore._instance._config.scenario) === null || _c === void 0 ? void 0 : _c.config) === null || _d === void 0 ? void 0 : _d.role) ===\n _model__WEBPACK_IMPORTED_MODULE_2__.LiveRole.Audience\n ? 2\n : 3,\n },\n });\n return [4 /*yield*/, ZegoCloudRTCCore._zg.setRoomExtraInfo(ZegoCloudRTCCore._instance._expressConfig.roomID, \"extra_info\", JSON.stringify(setRoomExtraInfo))];\n case 1:\n res = _e.sent();\n res.errorCode === 0 && (this.roomExtraInfo = setRoomExtraInfo);\n return [2 /*return*/, res.errorCode === 0];\n }\n });\n });\n };\n ZegoCloudRTCCore.prototype.enterRoom = function () {\n return __awaiter(this, void 0, void 0, function () {\n var resp;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n // 已经登陆过不再登录\n if (this.status.loginRsp)\n return [2 /*return*/, Promise.resolve(0)];\n ZegoCloudRTCCore._zg.off(\"roomExtraInfoUpdate\");\n ZegoCloudRTCCore._zg.off(\"roomStreamUpdate\");\n ZegoCloudRTCCore._zg.off(\"remoteCameraStatusUpdate\");\n ZegoCloudRTCCore._zg.off(\"remoteMicStatusUpdate\");\n ZegoCloudRTCCore._zg.off(\"playerStateUpdate\");\n ZegoCloudRTCCore._zg.off(\"roomUserUpdate\");\n ZegoCloudRTCCore._zg.off(\"IMRecvBroadcastMessage\");\n ZegoCloudRTCCore._zg.off(\"roomStateUpdate\");\n ZegoCloudRTCCore._zg.off(\"publisherStateUpdate\");\n ZegoCloudRTCCore._zg.off(\"publishQualityUpdate\");\n ZegoCloudRTCCore._zg.off(\"soundLevelUpdate\");\n ZegoCloudRTCCore._zg.on(\"roomStreamUpdate\", function (roomID, updateType, streamList, extendedData) { return __awaiter(_this, void 0, void 0, function () {\n var willDelete_1;\n return __generator(this, function (_a) {\n console.warn(\"【ZEGOCLOUD】roomStreamUpdate\", updateType, streamList);\n if (updateType === \"ADD\") {\n this.waitingHandlerStreams.add = __spreadArray(__spreadArray([], this.waitingHandlerStreams.add, true), streamList, true);\n this.waitingHandlerStreams.delete =\n this.waitingHandlerStreams.delete.filter(function (stream) {\n if (streamList.some(function (add_stream) { return add_stream.streamID === stream.streamID; })) {\n return false;\n }\n else {\n return true;\n }\n });\n }\n else {\n willDelete_1 = [];\n // 新增流中,删除下线的流\n this.waitingHandlerStreams.add =\n this.waitingHandlerStreams.add.filter(function (stream) {\n if (streamList.some(function (delete_stream) {\n if (delete_stream.streamID === stream.streamID) {\n willDelete_1.push(delete_stream.streamID);\n return true;\n }\n else {\n return false;\n }\n })) {\n return false;\n }\n else {\n return true;\n }\n });\n // 删除流中,去除上次要新增的\n streamList = streamList.filter(function (s) {\n if (willDelete_1.some(function (wd) { return wd == s.streamID; })) {\n return false;\n }\n else {\n return true;\n }\n });\n this.waitingHandlerStreams.delete = __spreadArray(__spreadArray([], this.waitingHandlerStreams.delete, true), streamList, true);\n }\n return [2 /*return*/];\n });\n }); });\n ZegoCloudRTCCore._zg.on(\"roomExtraInfoUpdate\", function (roomID, roomExtraInfoList) {\n roomExtraInfoList.forEach(function (info) {\n if (info.key === _this.extraInfoKey) {\n console.error(\"【ZEGOCLOUD】choui\", info.value);\n _this.roomExtraInfo = JSON.parse(info.value);\n }\n });\n });\n ZegoCloudRTCCore._zg.on(\"remoteCameraStatusUpdate\", function (streamID, status) {\n if (_this.remoteStreamMap[streamID]) {\n _this.remoteStreamMap[streamID].cameraStatus = status;\n _this.onRemoteMediaUpdateCallBack &&\n _this.onRemoteMediaUpdateCallBack(\"UPDATE\", [\n _this.remoteStreamMap[streamID],\n ]);\n }\n });\n ZegoCloudRTCCore._zg.on(\"remoteMicStatusUpdate\", function (streamID, status) {\n if (_this.remoteStreamMap[streamID]) {\n _this.remoteStreamMap[streamID].micStatus = status;\n _this.onRemoteMediaUpdateCallBack &&\n _this.onRemoteMediaUpdateCallBack(\"UPDATE\", [\n _this.remoteStreamMap[streamID],\n ]);\n }\n });\n ZegoCloudRTCCore._zg.on(\"playerStateUpdate\", function (streamInfo) {\n console.warn(\"【ZEGOCLOUD】\", streamInfo);\n if (_this.remoteStreamMap[streamInfo.streamID]) {\n _this.remoteStreamMap[streamInfo.streamID].state = streamInfo.state;\n _this.onRemoteMediaUpdateCallBack &&\n _this.onRemoteMediaUpdateCallBack(\"UPDATE\", [\n _this.remoteStreamMap[streamInfo.streamID],\n ]);\n }\n });\n ZegoCloudRTCCore._zg.on(\"roomUserUpdate\", function (roomID, updateType, userList) {\n console.warn(\"【ZEGOCLOUD】roomUserUpdate\", updateType, userList);\n _this.onRemoteUserUpdateCallBack &&\n _this.onRemoteUserUpdateCallBack(roomID, updateType, userList);\n setTimeout(function () {\n if (updateType === \"ADD\") {\n _this._config.onUserJoin && _this._config.onUserJoin(userList);\n }\n else {\n _this._config.onUserLeave && _this._config.onUserLeave(userList);\n }\n }, 0);\n });\n ZegoCloudRTCCore._zg.on(\"IMRecvBroadcastMessage\", function (roomID, chatData) {\n _this.onRoomMessageUpdateCallBack &&\n _this.onRoomMessageUpdateCallBack(roomID, chatData);\n });\n ZegoCloudRTCCore._zg.on(\"publisherStateUpdate\", function (streamInfo) {\n var state = \"DISCONNECTED\";\n if (streamInfo.state === \"PUBLISHING\") {\n state = \"CONNECTED\";\n }\n else if (streamInfo.state === \"NO_PUBLISH\") {\n state = \"DISCONNECTED\";\n }\n else if (streamInfo.state === \"PUBLISH_REQUESTING\") {\n state = \"CONNECTING\";\n }\n _this.onNetworkStatusCallBack &&\n _this.onNetworkStatusCallBack(ZegoCloudRTCCore._instance._expressConfig.roomID, \"STREAM\", state);\n });\n ZegoCloudRTCCore._zg.on(\"playQualityUpdate\", function (streamID, stats) {\n _this.onNetworkStatusQualityCallBack &&\n _this.onNetworkStatusQualityCallBack(streamID, Math.max(stats.video.videoQuality, stats.audio.audioQuality));\n });\n ZegoCloudRTCCore._zg.on(\"publishQualityUpdate\", function (streamID, stats) {\n _this.onNetworkStatusQualityCallBack &&\n _this.onNetworkStatusQualityCallBack(streamID, Math.max(stats.video.videoQuality, stats.audio.audioQuality));\n });\n ZegoCloudRTCCore._zg.on(\"soundLevelUpdate\", function (soundLevelList) {\n _this.onSoundLevelUpdateCallBack &&\n _this.onSoundLevelUpdateCallBack(soundLevelList);\n });\n ZegoCloudRTCCore._zg.on(\"screenSharingEnded\", function (stream) {\n _this.onScreenSharingEndedCallBack &&\n _this.onScreenSharingEndedCallBack(stream);\n });\n return [4 /*yield*/, new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n ZegoCloudRTCCore._zg.on(\"roomStateUpdate\", function (roomID, state, errorCode, extendedData) {\n _this.onNetworkStatusCallBack &&\n _this.onNetworkStatusCallBack(roomID, \"ROOM\", state);\n if (state === \"CONNECTED\" || state === \"DISCONNECTED\") {\n _this.status.loginRsp = errorCode === 0;\n res(errorCode);\n }\n });\n return [4 /*yield*/, ZegoCloudRTCCore._zg.loginRoom(ZegoCloudRTCCore._instance._expressConfig.roomID, ZegoCloudRTCCore._instance._expressConfig.token, {\n userID: ZegoCloudRTCCore._instance._expressConfig.userID,\n userName: ZegoCloudRTCCore._instance._expressConfig.userName,\n }, {\n userUpdate: true,\n maxMemberCount: ZegoCloudRTCCore._instance._config.maxUsers,\n })];\n case 1:\n _a.sent();\n return [2 /*return*/];\n }\n });\n }); })];\n case 1:\n resp = _a.sent();\n ZegoCloudRTCCore._zg.setSoundLevelDelegate(true, 300);\n this.streamUpdateTimer(this.waitingHandlerStreams);\n return [2 /*return*/, resp];\n }\n });\n });\n };\n ZegoCloudRTCCore.prototype.streamUpdateTimer = function (_waitingHandlerStreams) {\n return __awaiter(this, void 0, void 0, function () {\n var _streamList, i, streamInfo, stream, error_2, i, streamInfo;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!(this._currentPage === \"Room\")) return [3 /*break*/, 13];\n _streamList = [];\n if (!(_waitingHandlerStreams.add.length > 0)) return [3 /*break*/, 7];\n i = 0;\n _a.label = 1;\n case 1:\n if (!(i < _waitingHandlerStreams.add.length)) return [3 /*break*/, 6];\n streamInfo = _waitingHandlerStreams.add[i];\n _a.label = 2;\n case 2:\n _a.trys.push([2, 4, , 5]);\n return [4 /*yield*/, this.zum.startPullStream(streamInfo.user.userID, streamInfo.streamID)];\n case 3:\n stream = _a.sent();\n this.remoteStreamMap[streamInfo.streamID] = {\n fromUser: streamInfo.user,\n media: stream,\n micStatus: stream && stream.getAudioTracks().length > 0 ? \"OPEN\" : \"MUTE\",\n cameraStatus: stream && stream.getVideoTracks().length > 0 ? \"OPEN\" : \"MUTE\",\n state: \"PLAYING\",\n streamID: streamInfo.streamID,\n };\n _streamList.push(this.remoteStreamMap[streamInfo.streamID]);\n return [3 /*break*/, 5];\n case 4:\n error_2 = _a.sent();\n console.warn(\"【ZEGOCLOUD】:startPlayingStream error\", error_2);\n return [3 /*break*/, 5];\n case 5:\n i++;\n return [3 /*break*/, 1];\n case 6:\n this.onRemoteMediaUpdateCallBack &&\n _streamList.length > 0 &&\n this.onRemoteMediaUpdateCallBack(\"ADD\", _streamList);\n _a.label = 7;\n case 7:\n if (!(_waitingHandlerStreams.delete.length > 0)) return [3 /*break*/, 12];\n _streamList = [];\n i = 0;\n _a.label = 8;\n case 8:\n if (!(i < _waitingHandlerStreams.delete.length)) return [3 /*break*/, 11];\n streamInfo = _waitingHandlerStreams.delete[i];\n if (!this.remoteStreamMap[streamInfo.streamID]) {\n debugger;\n }\n this.remoteStreamMap[streamInfo.streamID] &&\n _streamList.push(this.remoteStreamMap[streamInfo.streamID]);\n return [4 /*yield*/, this.zum.stopPullStream(streamInfo.user.userID, streamInfo.streamID)];\n case 9:\n _a.sent();\n delete this.remoteStreamMap[streamInfo.streamID];\n _a.label = 10;\n case 10:\n i++;\n return [3 /*break*/, 8];\n case 11:\n this.onRemoteMediaUpdateCallBack &&\n _streamList.length > 0 &&\n this.onRemoteMediaUpdateCallBack(\"DELETE\", _streamList);\n _a.label = 12;\n case 12:\n setTimeout(function () {\n var nextWaitingHandlerStreams = {\n add: __spreadArray([], _this.waitingHandlerStreams.add, true),\n delete: __spreadArray([], _this.waitingHandlerStreams.delete, true),\n };\n _this.waitingHandlerStreams = {\n add: [],\n delete: [],\n };\n _this.streamUpdateTimer(nextWaitingHandlerStreams);\n }, 700);\n return [3 /*break*/, 14];\n case 13:\n if (this._currentPage === \"BrowserCheckPage\") {\n setTimeout(function () {\n _this.streamUpdateTimer(_waitingHandlerStreams);\n }, 1000);\n }\n _a.label = 14;\n case 14: return [2 /*return*/];\n }\n });\n });\n };\n ZegoCloudRTCCore.prototype.publishLocalStream = function (media, streamType) {\n if (!media)\n return false;\n var streamID = (0,_tools_util__WEBPACK_IMPORTED_MODULE_0__.generateStreamID)(this._expressConfig.userID, this._expressConfig.roomID, streamType);\n var res = ZegoCloudRTCCore._zg.startPublishingStream(streamID, media);\n return res && streamID;\n };\n ZegoCloudRTCCore.prototype.replaceTrack = function (media, mediaStreamTrack) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, ZegoCloudRTCCore._zg.replaceTrack(media, mediaStreamTrack)];\n });\n });\n };\n ZegoCloudRTCCore.prototype.subscribeUserList = function (callback) {\n this.subscribeUserListCallBack = callback;\n };\n ZegoCloudRTCCore.prototype.subscribeScreenStream = function (callback) {\n this.subscribeScreenStreamCallBack = callback;\n };\n ZegoCloudRTCCore.prototype.onRemoteMediaUpdate = function (func) {\n var _this = this;\n this.onRemoteMediaUpdateCallBack = function (updateType, streamList) { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n func(updateType, streamList);\n return [4 /*yield*/, this.zum.mainStreamUpdate(updateType, streamList)];\n case 1:\n _a.sent();\n return [4 /*yield*/, this.zum.screenStreamUpdate(updateType, streamList)];\n case 2:\n _a.sent();\n this.subscribeUserListCallBack &&\n this.subscribeUserListCallBack(__spreadArray([], this.zum.remoteUserList, true));\n this.subscribeScreenStreamCallBack &&\n this.subscribeScreenStreamCallBack(__spreadArray([], this.zum.remoteScreenStreamList, true));\n return [2 /*return*/];\n }\n });\n }); };\n };\n ZegoCloudRTCCore.prototype.onNetworkStatusQuality = function (func) {\n this.onNetworkStatusQualityCallBack = func;\n };\n ZegoCloudRTCCore.prototype.onRemoteUserUpdate = function (func) {\n var _this = this;\n this.onRemoteUserUpdateCallBack = function (roomID, updateType, users) { return __awaiter(_this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!(this._currentPage === \"BrowserCheckPage\")) return [3 /*break*/, 1];\n setTimeout(function () {\n _this.onRemoteUserUpdateCallBack(roomID, updateType, users);\n }, 1000);\n return [3 /*break*/, 3];\n case 1:\n if (!(this._currentPage === \"Room\")) return [3 /*break*/, 3];\n func(roomID, updateType, users);\n return [4 /*yield*/, this.zum.userUpdate(roomID, updateType, users)];\n case 2:\n _a.sent();\n setTimeout(function () {\n console.warn(\"【ZEGOCLOUD】roomUserUpdate\", __spreadArray([], _this.zum.remoteUserList, true), __spreadArray([], _this.zum.remoteUserList, true).length);\n _this.subscribeUserListCallBack &&\n _this.subscribeUserListCallBack(__spreadArray([], _this.zum.remoteUserList, true));\n }, 0);\n _a.label = 3;\n case 3: return [2 /*return*/];\n }\n });\n }); };\n };\n ZegoCloudRTCCore.prototype.onSoundLevelUpdate = function (func) {\n this.onSoundLevelUpdateCallBack = func;\n };\n ZegoCloudRTCCore.prototype.onRoomLiveStateUpdate = function (func) {\n this.onRoomLiveStateUpdateCallBack = func;\n };\n ZegoCloudRTCCore.prototype.sendRoomMessage = function (message) {\n return ZegoCloudRTCCore._zg.sendBroadcastMessage(ZegoCloudRTCCore._instance._expressConfig.roomID, message);\n };\n ZegoCloudRTCCore.prototype.onRoomMessageUpdate = function (func) {\n this.onRoomMessageUpdateCallBack = func;\n };\n ZegoCloudRTCCore.prototype.onScreenSharingEnded = function (func) {\n this.onScreenSharingEndedCallBack = func;\n };\n ZegoCloudRTCCore.prototype.onNetworkStatus = function (func) {\n var _this = this;\n this.onNetworkStatusCallBack = function (roomID, type, status) {\n if (status === \"CONNECTING\") {\n !_this.NetworkStatusTimer &&\n (_this.NetworkStatusTimer = setTimeout(function () {\n func(roomID, type, \"DISCONNECTED\");\n }, 60000));\n }\n else {\n if (_this.NetworkStatusTimer) {\n clearTimeout(_this.NetworkStatusTimer);\n _this.NetworkStatusTimer = null;\n }\n }\n func(roomID, type, status);\n };\n };\n ZegoCloudRTCCore.prototype.leaveRoom = function () {\n var _this = this;\n if (!this.status.loginRsp)\n return;\n ZegoCloudRTCCore._zg.off(\"roomExtraInfoUpdate\");\n ZegoCloudRTCCore._zg.off(\"roomStreamUpdate\");\n ZegoCloudRTCCore._zg.off(\"remoteCameraStatusUpdate\");\n ZegoCloudRTCCore._zg.off(\"remoteMicStatusUpdate\");\n ZegoCloudRTCCore._zg.off(\"playerStateUpdate\");\n ZegoCloudRTCCore._zg.off(\"roomUserUpdate\");\n ZegoCloudRTCCore._zg.off(\"IMRecvBroadcastMessage\");\n ZegoCloudRTCCore._zg.off(\"roomStateUpdate\");\n ZegoCloudRTCCore._zg.off(\"publisherStateUpdate\");\n ZegoCloudRTCCore._zg.off(\"publishQualityUpdate\");\n ZegoCloudRTCCore._zg.off(\"soundLevelUpdate\");\n ZegoCloudRTCCore._zg.off(\"screenSharingEnded\");\n ZegoCloudRTCCore._zg.setSoundLevelDelegate(false);\n this.onNetworkStatusCallBack = function () { };\n this.onRemoteMediaUpdateCallBack = function (updateType, streamList) { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.zum.mainStreamUpdate(updateType, streamList)];\n case 1:\n _a.sent();\n return [4 /*yield*/, this.zum.screenStreamUpdate(updateType, streamList)];\n case 2:\n _a.sent();\n this.subscribeUserListCallBack &&\n this.subscribeUserListCallBack(__spreadArray([], this.zum.remoteUserList, true));\n this.subscribeScreenStreamCallBack &&\n this.subscribeScreenStreamCallBack(__spreadArray([], this.zum.remoteScreenStreamList, true));\n return [2 /*return*/];\n }\n });\n }); };\n this.onRemoteUserUpdateCallBack = function () { };\n this.onRoomMessageUpdateCallBack = function () { };\n this.onRoomLiveStateUpdateCallBack = function () { };\n this.subscribeUserListCallBack = function () { };\n this.zum.reset();\n for (var key in this.remoteStreamMap) {\n ZegoCloudRTCCore._zg.stopPlayingStream(key);\n }\n this.remoteStreamMap = {};\n ZegoCloudRTCCore._zg.logoutRoom();\n this.status.loginRsp = false;\n };\n return ZegoCloudRTCCore;\n}());\n\n\n\n//# sourceURL=webpack://zegocloud_client_sdk_web/./src/sdk/modules/index.ts?");
1569
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ZegoCloudRTCCore\": function() { return /* binding */ ZegoCloudRTCCore; }\n/* harmony export */ });\n/* harmony import */ var _tools_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./tools/util */ \"./src/sdk/modules/tools/util.ts\");\n/* harmony import */ var zego_express_engine_webrtc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! zego-express-engine-webrtc */ \"./node_modules/zego-express-engine-webrtc/ZegoExpressWebRTC.js\");\n/* harmony import */ var zego_express_engine_webrtc__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(zego_express_engine_webrtc__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _model__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../model */ \"./src/sdk/model/index.ts\");\n/* harmony import */ var _tools_UserListManager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./tools/UserListManager */ \"./src/sdk/modules/tools/UserListManager.ts\");\nvar __assign = (undefined && undefined.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __awaiter = (undefined && undefined.__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 = (undefined && undefined.__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 __spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\n\n\n\n\nvar ZegoCloudRTCCore = /** @class */ (function () {\n function ZegoCloudRTCCore() {\n var _this = this;\n this.status = {\n loginRsp: false,\n videoRefuse: false,\n audioRefuse: false,\n };\n this.remoteStreamMap = {};\n this._config = {\n // @ts-ignore\n container: undefined,\n preJoinViewConfig: {\n title: \"Join Room\",\n invitationLink: window.location.href, // 邀请链接,空则不显示,默认空\n },\n showPreJoinView: true,\n turnOnMicrophoneWhenJoining: true,\n turnOnCameraWhenJoining: true,\n showMyCameraToggleButton: true,\n showMyMicrophoneToggleButton: true,\n showAudioVideoSettingsButton: true,\n showTextChat: true,\n showUserList: true,\n lowerLeftNotification: {\n showUserJoinAndLeave: true,\n showTextChat: true, // 是否显示未读消息,默认显示\n },\n branding: {\n logoURL: \"\",\n },\n showLeavingView: true,\n maxUsers: 2,\n layout: \"Auto\",\n showNonVideoUser: true,\n showOnlyAudioUser: false,\n useFrontFacingCamera: true,\n onJoinRoom: function () { },\n onLeaveRoom: function () { },\n onUserJoin: function (user) { },\n onUserLeave: function (user) { },\n sharedLinks: [],\n showScreenSharingButton: true,\n scenario: {\n mode: _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.OneONoneCall,\n config: { role: _model__WEBPACK_IMPORTED_MODULE_2__.LiveRole.Host }, // 对应场景专有配置\n },\n facingMode: \"user\",\n joinRoomCallback: function () { },\n leaveRoomCallback: function () { },\n userUpdateCallback: function () { },\n showLayoutButton: true,\n showPinButton: true, // 是否显pin按钮\n };\n this._currentPage = \"BrowserCheckPage\";\n this.extraInfoKey = \"extra_info\";\n this._roomExtraInfo = {\n live_status: {\n v: 0,\n u: \"xxx\",\n r: 0,\n },\n };\n this.waitingHandlerStreams = { add: [], delete: [] };\n this.onRemoteMediaUpdateCallBack = function (updateType, streamList) { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.zum.mainStreamUpdate(updateType, streamList)];\n case 1:\n _a.sent();\n return [4 /*yield*/, this.zum.screenStreamUpdate(updateType, streamList)];\n case 2:\n _a.sent();\n this.subscribeUserListCallBack &&\n this.subscribeUserListCallBack(__spreadArray([], this.zum.remoteUserList, true));\n this.subscribeScreenStreamCallBack &&\n this.subscribeScreenStreamCallBack(__spreadArray([], this.zum.remoteScreenStreamList, true));\n return [2 /*return*/];\n }\n });\n }); };\n this.NetworkStatusTimer = null;\n }\n // static _soundMeter: SoundMeter;\n ZegoCloudRTCCore.getInstance = function (token) {\n var config = (0,_tools_util__WEBPACK_IMPORTED_MODULE_0__.getConfig)(token);\n if (!ZegoCloudRTCCore._instance && config) {\n ZegoCloudRTCCore._instance = new ZegoCloudRTCCore();\n ZegoCloudRTCCore._instance._expressConfig = config;\n // ZegoCloudRTCCore._soundMeter = new SoundMeter();\n ZegoCloudRTCCore._zg = new zego_express_engine_webrtc__WEBPACK_IMPORTED_MODULE_1__.ZegoExpressEngine(ZegoCloudRTCCore._instance._expressConfig.appID, \"wss://webliveroom\" +\n ZegoCloudRTCCore._instance._expressConfig.appID +\n \"-api.zegocloud.com/ws\");\n ZegoCloudRTCCore._instance.zum = new _tools_UserListManager__WEBPACK_IMPORTED_MODULE_3__.ZegoCloudUserListManager(ZegoCloudRTCCore._zg);\n }\n return ZegoCloudRTCCore._instance;\n };\n ZegoCloudRTCCore.prototype.checkWebRTC = function () {\n return __awaiter(this, void 0, void 0, function () {\n var result;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, ZegoCloudRTCCore._zg.checkSystemRequirements(\"webRTC\")];\n case 1:\n result = _a.sent();\n return [2 /*return*/, !!result.result];\n }\n });\n });\n };\n ZegoCloudRTCCore.prototype.setConfig = function (config) {\n var _a, _b, _c, _d;\n if (config.scenario &&\n config.scenario.mode === _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.LiveStreaming) {\n if (config.showNonVideoUser === true) {\n console.error(\"【ZEGOCLOUD】 showNonVideoUser have be false scenario.mode is LiveStreaming!!\");\n return false;\n }\n config.showNonVideoUser = false;\n config.showOnlyAudioUser = true;\n if (config.scenario.config &&\n config.scenario.config.role === _model__WEBPACK_IMPORTED_MODULE_2__.LiveRole.Host) {\n if (config.turnOnMicrophoneWhenJoining === false &&\n config.turnOnCameraWhenJoining === false &&\n config.showMyCameraToggleButton === false &&\n config.showAudioVideoSettingsButton === false) {\n console.error(\"【ZEGOCLOUD】 Host could turn on at least one of the camera and the microphone!!\");\n return false;\n }\n }\n else if (config.scenario.config &&\n config.scenario.config.role === _model__WEBPACK_IMPORTED_MODULE_2__.LiveRole.Audience) {\n if (config.turnOnMicrophoneWhenJoining === true ||\n config.turnOnCameraWhenJoining === true ||\n config.showMyCameraToggleButton === true ||\n config.showMyMicrophoneToggleButton === true ||\n config.showAudioVideoSettingsButton === true ||\n config.showScreenSharingButton === true ||\n config.useFrontFacingCamera === true ||\n (!!config.layout && config.layout !== \"Grid\")) {\n console.error(\"【ZEGOCLOUD】 Audience cannot configure camera and microphone related params\");\n return false;\n }\n }\n if (!config.maxUsers) {\n config.maxUsers = 5000;\n }\n if (config.scenario.config &&\n config.scenario.config.role === _model__WEBPACK_IMPORTED_MODULE_2__.LiveRole.Audience) {\n config.turnOnMicrophoneWhenJoining = false;\n config.turnOnCameraWhenJoining = false;\n config.showMyCameraToggleButton = false;\n config.showMyMicrophoneToggleButton = false;\n config.showAudioVideoSettingsButton = false;\n config.showScreenSharingButton = false;\n config.useFrontFacingCamera = false;\n config.useFrontFacingCamera = false;\n config.showUserList = false;\n config.showPinButton = false;\n config.showLayoutButton = false;\n config.layout = \"Grid\";\n config.lowerLeftNotification = {\n showTextChat: false,\n showUserJoinAndLeave: false,\n };\n }\n }\n if (config.scenario &&\n config.scenario.mode === _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.OneONoneCall) {\n if (!config.maxUsers) {\n config.maxUsers = 2;\n }\n config.showLayoutButton = false;\n config.showPinButton = false;\n }\n if (config.scenario && config.scenario.mode === _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.GroupCall) {\n if (!config.maxUsers) {\n config.maxUsers = 50;\n }\n }\n config.facingMode &&\n (config.useFrontFacingCamera = config.facingMode === \"user\");\n config.joinRoomCallback && (config.onJoinRoom = config.joinRoomCallback);\n config.leaveRoomCallback && (config.onLeaveRoom = config.leaveRoomCallback);\n if (config.userUpdateCallback) {\n config.onUserJoin = function (users) {\n config.userUpdateCallback && config.userUpdateCallback(\"ADD\", users);\n };\n config.onUserLeave = function (users) {\n config.userUpdateCallback && config.userUpdateCallback(\"DELETE\", users);\n };\n }\n if (config.preJoinViewConfig && config.preJoinViewConfig.invitationLink) {\n config.sharedLinks = [\n {\n name: \"Share the link\",\n url: config.preJoinViewConfig.invitationLink,\n },\n ];\n }\n config.preJoinViewConfig &&\n (config.preJoinViewConfig = __assign(__assign({}, this._config.preJoinViewConfig), config.preJoinViewConfig));\n config.scenario &&\n config.scenario.config &&\n (config.scenario.config = __assign(__assign({}, (_a = this._config.scenario) === null || _a === void 0 ? void 0 : _a.config), config.scenario.config));\n this._config = __assign(__assign({}, this._config), config);\n this.zum.scenario =\n ((_b = this._config.scenario) === null || _b === void 0 ? void 0 : _b.mode) || _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.OneONoneCall;\n this.zum.role = ((_d = (_c = this._config.scenario) === null || _c === void 0 ? void 0 : _c.config) === null || _d === void 0 ? void 0 : _d.role) || _model__WEBPACK_IMPORTED_MODULE_2__.LiveRole.Host;\n this.zum.showOnlyAudioUser = !!this._config.showOnlyAudioUser;\n this.zum.setShowNonVideo(!!this._config.showNonVideoUser);\n return true;\n };\n ZegoCloudRTCCore.prototype.setPin = function (userID, pined) {\n this.zum.setPin(userID, pined);\n this.subscribeUserListCallBack &&\n this.subscribeUserListCallBack(__spreadArray([], this.zum.remoteUserList, true));\n };\n ZegoCloudRTCCore.prototype.setMaxScreenNum = function (num) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.zum.setMaxScreenNum(num)];\n case 1:\n _a.sent();\n this.subscribeUserListCallBack &&\n this.subscribeUserListCallBack(__spreadArray([], this.zum.remoteUserList, true));\n return [2 /*return*/];\n }\n });\n });\n };\n ZegoCloudRTCCore.prototype.setSidebarLayOut = function (enable) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.zum.setSidebarLayOut(enable)];\n case 1:\n _a.sent();\n this.subscribeUserListCallBack &&\n this.subscribeUserListCallBack(__spreadArray([], this.zum.remoteUserList, true));\n return [2 /*return*/];\n }\n });\n });\n };\n ZegoCloudRTCCore.prototype.setShowNonVideo = function (enable) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.zum.setShowNonVideo(enable)];\n case 1:\n _a.sent();\n this.subscribeUserListCallBack &&\n this.subscribeUserListCallBack(__spreadArray([], this.zum.remoteUserList, true));\n return [2 /*return*/];\n }\n });\n });\n };\n ZegoCloudRTCCore.prototype.setCurrentPage = function (page) {\n this._currentPage = page;\n };\n ZegoCloudRTCCore.prototype.getCameras = function () {\n return ZegoCloudRTCCore._zg.getCameras();\n };\n ZegoCloudRTCCore.prototype.useVideoDevice = function (localStream, deviceID) {\n return ZegoCloudRTCCore._zg.useVideoDevice(localStream, deviceID);\n };\n ZegoCloudRTCCore.prototype.getMicrophones = function () {\n return ZegoCloudRTCCore._zg.getMicrophones();\n };\n ZegoCloudRTCCore.prototype.getSpeakers = function () {\n return ZegoCloudRTCCore._zg.getSpeakers();\n };\n ZegoCloudRTCCore.prototype.setVolume = function (media, volume) {\n media.volume = volume;\n };\n ZegoCloudRTCCore.prototype.createStream = function (source) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, ZegoCloudRTCCore._zg.createStream(source)];\n });\n });\n };\n ZegoCloudRTCCore.prototype.setVideoConfig = function (media, constraints) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, ZegoCloudRTCCore._zg.setVideoConfig(media, constraints)];\n });\n });\n };\n ZegoCloudRTCCore.prototype.stopPublishingStream = function (streamID) {\n return ZegoCloudRTCCore._zg.stopPublishingStream(streamID);\n };\n ZegoCloudRTCCore.prototype.destroyStream = function (stream) {\n ZegoCloudRTCCore._zg.destroyStream(stream);\n };\n ZegoCloudRTCCore.prototype.useCameraDevice = function (media, deviceID) {\n return ZegoCloudRTCCore._zg.useVideoDevice(media, deviceID);\n };\n ZegoCloudRTCCore.prototype.useMicrophoneDevice = function (media, deviceID) {\n return ZegoCloudRTCCore._zg.useAudioDevice(media, deviceID);\n };\n ZegoCloudRTCCore.prototype.useSpeakerDevice = function (media, deviceID) {\n return __awaiter(this, void 0, void 0, function () {\n var res, error_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!media.srcObject) {\n return [2 /*return*/, Promise.resolve({ errorCode: -1 })];\n }\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, ZegoCloudRTCCore._zg.useAudioOutputDevice(media, deviceID)];\n case 2:\n res = _a.sent();\n return [2 /*return*/, { errorCode: res ? 0 : -1 }];\n case 3:\n error_1 = _a.sent();\n return [2 /*return*/, { errorCode: -1 }];\n case 4: return [2 /*return*/];\n }\n });\n });\n };\n ZegoCloudRTCCore.prototype.enableVideoCaptureDevice = function (localStream, enable) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, ZegoCloudRTCCore._zg.enableVideoCaptureDevice(localStream, enable)];\n });\n });\n };\n ZegoCloudRTCCore.prototype.mutePublishStreamVideo = function (localStream, enable) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, ZegoCloudRTCCore._zg.mutePublishStreamVideo(localStream, enable)];\n });\n });\n };\n ZegoCloudRTCCore.prototype.mutePublishStreamAudio = function (localStream, enable) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, ZegoCloudRTCCore._zg.mutePublishStreamAudio(localStream, enable)];\n });\n });\n };\n ZegoCloudRTCCore.prototype.muteMicrophone = function (enable) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, ZegoCloudRTCCore._zg.muteMicrophone(enable)];\n });\n });\n };\n Object.defineProperty(ZegoCloudRTCCore.prototype, \"roomExtraInfo\", {\n get: function () {\n return this._roomExtraInfo;\n },\n set: function (value) {\n var _this = this;\n if (this._currentPage === \"Room\") {\n this._roomExtraInfo = value;\n this.zum.setLiveStates(this._roomExtraInfo.live_status.v);\n console.error(\"【ZEGOCLOUD】roomExtraInfo choui\", value, this.onRoomLiveStateUpdateCallBack);\n this.onRoomLiveStateUpdateCallBack &&\n this.onRoomLiveStateUpdateCallBack(this._roomExtraInfo.live_status.v);\n }\n else if (this._currentPage === \"BrowserCheckPage\" ||\n this._currentPage === \"RejoinRoom\") {\n setTimeout(function () {\n _this.roomExtraInfo = value;\n }, 1000);\n }\n },\n enumerable: false,\n configurable: true\n });\n ZegoCloudRTCCore.prototype.setLive = function (status) {\n var _a, _b, _c, _d;\n return __awaiter(this, void 0, void 0, function () {\n var setRoomExtraInfo, res;\n return __generator(this, function (_e) {\n switch (_e.label) {\n case 0:\n setRoomExtraInfo = __assign(__assign({}, this._roomExtraInfo), {\n live_status: {\n v: status === \"live\" ? 1 : 0,\n u: ZegoCloudRTCCore._instance._expressConfig.userID,\n r: ((_b = (_a = ZegoCloudRTCCore._instance._config.scenario) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.role) ===\n _model__WEBPACK_IMPORTED_MODULE_2__.LiveRole.Host\n ? 1\n : ((_d = (_c = ZegoCloudRTCCore._instance._config.scenario) === null || _c === void 0 ? void 0 : _c.config) === null || _d === void 0 ? void 0 : _d.role) ===\n _model__WEBPACK_IMPORTED_MODULE_2__.LiveRole.Audience\n ? 2\n : 3,\n },\n });\n return [4 /*yield*/, ZegoCloudRTCCore._zg.setRoomExtraInfo(ZegoCloudRTCCore._instance._expressConfig.roomID, \"extra_info\", JSON.stringify(setRoomExtraInfo))];\n case 1:\n res = _e.sent();\n res.errorCode === 0 && (this.roomExtraInfo = setRoomExtraInfo);\n return [2 /*return*/, res.errorCode === 0];\n }\n });\n });\n };\n ZegoCloudRTCCore.prototype.enterRoom = function () {\n return __awaiter(this, void 0, void 0, function () {\n var resp;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n // 已经登陆过不再登录\n if (this.status.loginRsp)\n return [2 /*return*/, Promise.resolve(0)];\n ZegoCloudRTCCore._zg.off(\"roomExtraInfoUpdate\");\n ZegoCloudRTCCore._zg.off(\"roomStreamUpdate\");\n ZegoCloudRTCCore._zg.off(\"remoteCameraStatusUpdate\");\n ZegoCloudRTCCore._zg.off(\"remoteMicStatusUpdate\");\n ZegoCloudRTCCore._zg.off(\"playerStateUpdate\");\n ZegoCloudRTCCore._zg.off(\"roomUserUpdate\");\n ZegoCloudRTCCore._zg.off(\"IMRecvBroadcastMessage\");\n ZegoCloudRTCCore._zg.off(\"roomStateUpdate\");\n ZegoCloudRTCCore._zg.off(\"publisherStateUpdate\");\n ZegoCloudRTCCore._zg.off(\"publishQualityUpdate\");\n ZegoCloudRTCCore._zg.off(\"soundLevelUpdate\");\n ZegoCloudRTCCore._zg.on(\"roomStreamUpdate\", function (roomID, updateType, streamList, extendedData) { return __awaiter(_this, void 0, void 0, function () {\n var willDelete_1;\n return __generator(this, function (_a) {\n console.warn(\"【ZEGOCLOUD】roomStreamUpdate\", updateType, streamList);\n if (updateType === \"ADD\") {\n this.waitingHandlerStreams.add = __spreadArray(__spreadArray([], this.waitingHandlerStreams.add, true), streamList, true);\n this.waitingHandlerStreams.delete =\n this.waitingHandlerStreams.delete.filter(function (stream) {\n if (streamList.some(function (add_stream) { return add_stream.streamID === stream.streamID; })) {\n return false;\n }\n else {\n return true;\n }\n });\n }\n else {\n willDelete_1 = [];\n // 新增流中,删除下线的流\n this.waitingHandlerStreams.add =\n this.waitingHandlerStreams.add.filter(function (stream) {\n if (streamList.some(function (delete_stream) {\n if (delete_stream.streamID === stream.streamID) {\n willDelete_1.push(delete_stream.streamID);\n return true;\n }\n else {\n return false;\n }\n })) {\n return false;\n }\n else {\n return true;\n }\n });\n // 删除流中,去除上次要新增的\n streamList = streamList.filter(function (s) {\n if (willDelete_1.some(function (wd) { return wd == s.streamID; })) {\n return false;\n }\n else {\n return true;\n }\n });\n this.waitingHandlerStreams.delete = __spreadArray(__spreadArray([], this.waitingHandlerStreams.delete, true), streamList, true);\n }\n return [2 /*return*/];\n });\n }); });\n ZegoCloudRTCCore._zg.on(\"roomExtraInfoUpdate\", function (roomID, roomExtraInfoList) {\n roomExtraInfoList.forEach(function (info) {\n if (info.key === _this.extraInfoKey) {\n console.error(\"【ZEGOCLOUD】choui\", info.value);\n _this.roomExtraInfo = JSON.parse(info.value);\n }\n });\n });\n ZegoCloudRTCCore._zg.on(\"remoteCameraStatusUpdate\", function (streamID, status) {\n if (_this.remoteStreamMap[streamID]) {\n _this.remoteStreamMap[streamID].cameraStatus = status;\n _this.onRemoteMediaUpdateCallBack &&\n _this.onRemoteMediaUpdateCallBack(\"UPDATE\", [\n _this.remoteStreamMap[streamID],\n ]);\n }\n });\n ZegoCloudRTCCore._zg.on(\"remoteMicStatusUpdate\", function (streamID, status) {\n if (_this.remoteStreamMap[streamID]) {\n _this.remoteStreamMap[streamID].micStatus = status;\n _this.onRemoteMediaUpdateCallBack &&\n _this.onRemoteMediaUpdateCallBack(\"UPDATE\", [\n _this.remoteStreamMap[streamID],\n ]);\n }\n });\n ZegoCloudRTCCore._zg.on(\"playerStateUpdate\", function (streamInfo) {\n console.warn(\"【ZEGOCLOUD】\", streamInfo);\n if (_this.remoteStreamMap[streamInfo.streamID]) {\n _this.remoteStreamMap[streamInfo.streamID].state = streamInfo.state;\n _this.onRemoteMediaUpdateCallBack &&\n _this.onRemoteMediaUpdateCallBack(\"UPDATE\", [\n _this.remoteStreamMap[streamInfo.streamID],\n ]);\n }\n });\n ZegoCloudRTCCore._zg.on(\"roomUserUpdate\", function (roomID, updateType, userList) {\n console.warn(\"【ZEGOCLOUD】roomUserUpdate\", updateType, userList);\n _this.onRemoteUserUpdateCallBack &&\n _this.onRemoteUserUpdateCallBack(roomID, updateType, userList);\n setTimeout(function () {\n if (updateType === \"ADD\") {\n _this._config.onUserJoin && _this._config.onUserJoin(userList);\n }\n else {\n _this._config.onUserLeave && _this._config.onUserLeave(userList);\n }\n }, 0);\n });\n ZegoCloudRTCCore._zg.on(\"IMRecvBroadcastMessage\", function (roomID, chatData) {\n _this.onRoomMessageUpdateCallBack &&\n _this.onRoomMessageUpdateCallBack(roomID, chatData);\n });\n ZegoCloudRTCCore._zg.on(\"publisherStateUpdate\", function (streamInfo) {\n var state = \"DISCONNECTED\";\n if (streamInfo.state === \"PUBLISHING\") {\n state = \"CONNECTED\";\n }\n else if (streamInfo.state === \"NO_PUBLISH\") {\n state = \"DISCONNECTED\";\n }\n else if (streamInfo.state === \"PUBLISH_REQUESTING\") {\n state = \"CONNECTING\";\n }\n _this.onNetworkStatusCallBack &&\n _this.onNetworkStatusCallBack(ZegoCloudRTCCore._instance._expressConfig.roomID, \"STREAM\", state);\n });\n ZegoCloudRTCCore._zg.on(\"playQualityUpdate\", function (streamID, stats) {\n _this.onNetworkStatusQualityCallBack &&\n _this.onNetworkStatusQualityCallBack(streamID, Math.max(stats.video.videoQuality, stats.audio.audioQuality));\n });\n ZegoCloudRTCCore._zg.on(\"publishQualityUpdate\", function (streamID, stats) {\n _this.onNetworkStatusQualityCallBack &&\n _this.onNetworkStatusQualityCallBack(streamID, Math.max(stats.video.videoQuality, stats.audio.audioQuality));\n });\n ZegoCloudRTCCore._zg.on(\"soundLevelUpdate\", function (soundLevelList) {\n _this.onSoundLevelUpdateCallBack &&\n _this.onSoundLevelUpdateCallBack(soundLevelList);\n });\n ZegoCloudRTCCore._zg.on(\"screenSharingEnded\", function (stream) {\n _this.onScreenSharingEndedCallBack &&\n _this.onScreenSharingEndedCallBack(stream);\n });\n return [4 /*yield*/, new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n ZegoCloudRTCCore._zg.on(\"roomStateUpdate\", function (roomID, state, errorCode, extendedData) {\n _this.onNetworkStatusCallBack &&\n _this.onNetworkStatusCallBack(roomID, \"ROOM\", state);\n if (state === \"CONNECTED\" || state === \"DISCONNECTED\") {\n _this.status.loginRsp = errorCode === 0;\n res(errorCode);\n }\n });\n return [4 /*yield*/, ZegoCloudRTCCore._zg.loginRoom(ZegoCloudRTCCore._instance._expressConfig.roomID, ZegoCloudRTCCore._instance._expressConfig.token, {\n userID: ZegoCloudRTCCore._instance._expressConfig.userID,\n userName: ZegoCloudRTCCore._instance._expressConfig.userName,\n }, {\n userUpdate: true,\n maxMemberCount: ZegoCloudRTCCore._instance._config.maxUsers,\n })];\n case 1:\n _a.sent();\n return [2 /*return*/];\n }\n });\n }); })];\n case 1:\n resp = _a.sent();\n ZegoCloudRTCCore._zg.setSoundLevelDelegate(true, 300);\n this.streamUpdateTimer(this.waitingHandlerStreams);\n return [2 /*return*/, resp];\n }\n });\n });\n };\n ZegoCloudRTCCore.prototype.streamUpdateTimer = function (_waitingHandlerStreams) {\n return __awaiter(this, void 0, void 0, function () {\n var _streamList, i, streamInfo, stream, error_2, i, streamInfo;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!(this._currentPage === \"Room\")) return [3 /*break*/, 13];\n _streamList = [];\n if (!(_waitingHandlerStreams.add.length > 0)) return [3 /*break*/, 7];\n i = 0;\n _a.label = 1;\n case 1:\n if (!(i < _waitingHandlerStreams.add.length)) return [3 /*break*/, 6];\n streamInfo = _waitingHandlerStreams.add[i];\n _a.label = 2;\n case 2:\n _a.trys.push([2, 4, , 5]);\n return [4 /*yield*/, this.zum.startPullStream(streamInfo.user.userID, streamInfo.streamID)];\n case 3:\n stream = _a.sent();\n this.remoteStreamMap[streamInfo.streamID] = {\n fromUser: streamInfo.user,\n media: stream,\n micStatus: stream && stream.getAudioTracks().length > 0 ? \"OPEN\" : \"MUTE\",\n cameraStatus: stream && stream.getVideoTracks().length > 0 ? \"OPEN\" : \"MUTE\",\n state: \"PLAYING\",\n streamID: streamInfo.streamID,\n };\n _streamList.push(this.remoteStreamMap[streamInfo.streamID]);\n return [3 /*break*/, 5];\n case 4:\n error_2 = _a.sent();\n console.warn(\"【ZEGOCLOUD】:startPlayingStream error\", error_2);\n return [3 /*break*/, 5];\n case 5:\n i++;\n return [3 /*break*/, 1];\n case 6:\n this.onRemoteMediaUpdateCallBack &&\n _streamList.length > 0 &&\n this.onRemoteMediaUpdateCallBack(\"ADD\", _streamList);\n _a.label = 7;\n case 7:\n if (!(_waitingHandlerStreams.delete.length > 0)) return [3 /*break*/, 12];\n _streamList = [];\n i = 0;\n _a.label = 8;\n case 8:\n if (!(i < _waitingHandlerStreams.delete.length)) return [3 /*break*/, 11];\n streamInfo = _waitingHandlerStreams.delete[i];\n if (!this.remoteStreamMap[streamInfo.streamID]) {\n debugger;\n }\n this.remoteStreamMap[streamInfo.streamID] &&\n _streamList.push(this.remoteStreamMap[streamInfo.streamID]);\n return [4 /*yield*/, this.zum.stopPullStream(streamInfo.user.userID, streamInfo.streamID)];\n case 9:\n _a.sent();\n delete this.remoteStreamMap[streamInfo.streamID];\n _a.label = 10;\n case 10:\n i++;\n return [3 /*break*/, 8];\n case 11:\n this.onRemoteMediaUpdateCallBack &&\n _streamList.length > 0 &&\n this.onRemoteMediaUpdateCallBack(\"DELETE\", _streamList);\n _a.label = 12;\n case 12:\n setTimeout(function () {\n var nextWaitingHandlerStreams = {\n add: __spreadArray([], _this.waitingHandlerStreams.add, true),\n delete: __spreadArray([], _this.waitingHandlerStreams.delete, true),\n };\n _this.waitingHandlerStreams = {\n add: [],\n delete: [],\n };\n _this.streamUpdateTimer(nextWaitingHandlerStreams);\n }, 700);\n return [3 /*break*/, 14];\n case 13:\n if (this._currentPage === \"BrowserCheckPage\" ||\n this._currentPage === \"RejoinRoom\") {\n setTimeout(function () {\n _this.streamUpdateTimer(_waitingHandlerStreams);\n }, 1000);\n }\n _a.label = 14;\n case 14: return [2 /*return*/];\n }\n });\n });\n };\n ZegoCloudRTCCore.prototype.publishLocalStream = function (media, streamType) {\n if (!media)\n return false;\n var streamID = (0,_tools_util__WEBPACK_IMPORTED_MODULE_0__.generateStreamID)(this._expressConfig.userID, this._expressConfig.roomID, streamType);\n var res = ZegoCloudRTCCore._zg.startPublishingStream(streamID, media);\n return res && streamID;\n };\n ZegoCloudRTCCore.prototype.replaceTrack = function (media, mediaStreamTrack) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, ZegoCloudRTCCore._zg.replaceTrack(media, mediaStreamTrack)];\n });\n });\n };\n ZegoCloudRTCCore.prototype.subscribeUserList = function (callback) {\n this.subscribeUserListCallBack = callback;\n };\n ZegoCloudRTCCore.prototype.subscribeScreenStream = function (callback) {\n this.subscribeScreenStreamCallBack = callback;\n };\n ZegoCloudRTCCore.prototype.onRemoteMediaUpdate = function (func) {\n var _this = this;\n this.onRemoteMediaUpdateCallBack = function (updateType, streamList) { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n func(updateType, streamList);\n return [4 /*yield*/, this.zum.mainStreamUpdate(updateType, streamList)];\n case 1:\n _a.sent();\n return [4 /*yield*/, this.zum.screenStreamUpdate(updateType, streamList)];\n case 2:\n _a.sent();\n this.subscribeUserListCallBack &&\n this.subscribeUserListCallBack(__spreadArray([], this.zum.remoteUserList, true));\n this.subscribeScreenStreamCallBack &&\n this.subscribeScreenStreamCallBack(__spreadArray([], this.zum.remoteScreenStreamList, true));\n return [2 /*return*/];\n }\n });\n }); };\n };\n ZegoCloudRTCCore.prototype.onNetworkStatusQuality = function (func) {\n this.onNetworkStatusQualityCallBack = func;\n };\n ZegoCloudRTCCore.prototype.onRemoteUserUpdate = function (func) {\n var _this = this;\n this.onRemoteUserUpdateCallBack = function (roomID, updateType, users) { return __awaiter(_this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!(this._currentPage === \"BrowserCheckPage\" ||\n this._currentPage === \"RejoinRoom\")) return [3 /*break*/, 1];\n setTimeout(function () {\n _this.onRemoteUserUpdateCallBack(roomID, updateType, users);\n }, 1000);\n return [3 /*break*/, 3];\n case 1:\n if (!(this._currentPage === \"Room\")) return [3 /*break*/, 3];\n func(roomID, updateType, users);\n return [4 /*yield*/, this.zum.userUpdate(roomID, updateType, users)];\n case 2:\n _a.sent();\n setTimeout(function () {\n console.warn(\"【ZEGOCLOUD】roomUserUpdate\", __spreadArray([], _this.zum.remoteUserList, true), __spreadArray([], _this.zum.remoteUserList, true).length);\n _this.subscribeUserListCallBack &&\n _this.subscribeUserListCallBack(__spreadArray([], _this.zum.remoteUserList, true));\n }, 0);\n _a.label = 3;\n case 3: return [2 /*return*/];\n }\n });\n }); };\n };\n ZegoCloudRTCCore.prototype.onSoundLevelUpdate = function (func) {\n this.onSoundLevelUpdateCallBack = func;\n };\n ZegoCloudRTCCore.prototype.onRoomLiveStateUpdate = function (func) {\n this.onRoomLiveStateUpdateCallBack = func;\n };\n ZegoCloudRTCCore.prototype.sendRoomMessage = function (message) {\n return ZegoCloudRTCCore._zg.sendBroadcastMessage(ZegoCloudRTCCore._instance._expressConfig.roomID, message);\n };\n ZegoCloudRTCCore.prototype.onRoomMessageUpdate = function (func) {\n this.onRoomMessageUpdateCallBack = func;\n };\n ZegoCloudRTCCore.prototype.onScreenSharingEnded = function (func) {\n this.onScreenSharingEndedCallBack = func;\n };\n ZegoCloudRTCCore.prototype.onNetworkStatus = function (func) {\n var _this = this;\n this.onNetworkStatusCallBack = function (roomID, type, status) {\n if (status === \"CONNECTING\") {\n !_this.NetworkStatusTimer &&\n (_this.NetworkStatusTimer = setTimeout(function () {\n func(roomID, type, \"DISCONNECTED\");\n }, 60000));\n }\n else {\n if (_this.NetworkStatusTimer) {\n clearTimeout(_this.NetworkStatusTimer);\n _this.NetworkStatusTimer = null;\n }\n }\n func(roomID, type, status);\n };\n };\n ZegoCloudRTCCore.prototype.leaveRoom = function () {\n var _this = this;\n if (!this.status.loginRsp)\n return;\n ZegoCloudRTCCore._zg.off(\"roomExtraInfoUpdate\");\n ZegoCloudRTCCore._zg.off(\"roomStreamUpdate\");\n ZegoCloudRTCCore._zg.off(\"remoteCameraStatusUpdate\");\n ZegoCloudRTCCore._zg.off(\"remoteMicStatusUpdate\");\n ZegoCloudRTCCore._zg.off(\"playerStateUpdate\");\n ZegoCloudRTCCore._zg.off(\"roomUserUpdate\");\n ZegoCloudRTCCore._zg.off(\"IMRecvBroadcastMessage\");\n ZegoCloudRTCCore._zg.off(\"roomStateUpdate\");\n ZegoCloudRTCCore._zg.off(\"publisherStateUpdate\");\n ZegoCloudRTCCore._zg.off(\"publishQualityUpdate\");\n ZegoCloudRTCCore._zg.off(\"soundLevelUpdate\");\n ZegoCloudRTCCore._zg.off(\"screenSharingEnded\");\n ZegoCloudRTCCore._zg.setSoundLevelDelegate(false);\n this.onNetworkStatusCallBack = function () { };\n this.onRemoteMediaUpdateCallBack = function (updateType, streamList) { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.zum.mainStreamUpdate(updateType, streamList)];\n case 1:\n _a.sent();\n return [4 /*yield*/, this.zum.screenStreamUpdate(updateType, streamList)];\n case 2:\n _a.sent();\n this.subscribeUserListCallBack &&\n this.subscribeUserListCallBack(__spreadArray([], this.zum.remoteUserList, true));\n this.subscribeScreenStreamCallBack &&\n this.subscribeScreenStreamCallBack(__spreadArray([], this.zum.remoteScreenStreamList, true));\n return [2 /*return*/];\n }\n });\n }); };\n this.onRemoteUserUpdateCallBack = function () { };\n this.onRoomMessageUpdateCallBack = function () { };\n this.onRoomLiveStateUpdateCallBack = function () { };\n this.subscribeUserListCallBack = function () { };\n this.zum.reset();\n for (var key in this.remoteStreamMap) {\n ZegoCloudRTCCore._zg.stopPlayingStream(key);\n }\n this.remoteStreamMap = {};\n ZegoCloudRTCCore._zg.logoutRoom();\n this.status.loginRsp = false;\n };\n return ZegoCloudRTCCore;\n}());\n\n\n\n//# sourceURL=webpack://zegocloud_client_sdk_web/./src/sdk/modules/index.ts?");
1570
1570
 
1571
1571
  /***/ }),
1572
1572
 
@@ -2028,7 +2028,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var reac
2028
2028
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
2029
2029
 
2030
2030
  "use strict";
2031
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ZegoRoomMobile\": function() { return /* binding */ ZegoRoomMobile; }\n/* harmony export */ });\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ \"./node_modules/react/jsx-runtime.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _model__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../model */ \"./src/sdk/model/index.ts\");\n/* harmony import */ var _index_module_scss__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./index.module.scss */ \"./src/sdk/view/pages/ZegoRoomMobile/index.module.scss\");\n/* harmony import */ var _components_zegoOne2One__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./components/zegoOne2One */ \"./src/sdk/view/pages/ZegoRoomMobile/components/zegoOne2One.tsx\");\n/* harmony import */ var _components_zegoMessage__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./components/zegoMessage */ \"./src/sdk/view/pages/ZegoRoomMobile/components/zegoMessage.tsx\");\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../util */ \"./src/sdk/util.ts\");\n/* harmony import */ var _components_mobile_zegoConfirm__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../components/mobile/zegoConfirm */ \"./src/sdk/view/components/mobile/zegoConfirm/index.tsx\");\n/* harmony import */ var _components_zegoUserList__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./components/zegoUserList */ \"./src/sdk/view/pages/ZegoRoomMobile/components/zegoUserList.tsx\");\n/* harmony import */ var _components_zegoRoomInvite__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./components/zegoRoomInvite */ \"./src/sdk/view/pages/ZegoRoomMobile/components/zegoRoomInvite.tsx\");\n/* harmony import */ var _components_ZegoReconnect__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./components/ZegoReconnect */ \"./src/sdk/view/pages/ZegoRoomMobile/components/ZegoReconnect.tsx\");\n/* harmony import */ var _components_mobile_zegoToast__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../components/mobile/zegoToast */ \"./src/sdk/view/components/mobile/zegoToast/index.tsx\");\n/* harmony import */ var _components_zegoLayout__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./components/zegoLayout */ \"./src/sdk/view/pages/ZegoRoomMobile/components/zegoLayout.tsx\");\n/* harmony import */ var _components_zegoManage__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./components/zegoManage */ \"./src/sdk/view/pages/ZegoRoomMobile/components/zegoManage.tsx\");\n/* harmony import */ var _components_zegoGrid__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./components/zegoGrid */ \"./src/sdk/view/pages/ZegoRoomMobile/components/zegoGrid.tsx\");\n/* harmony import */ var _components_zegoSidebar__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./components/zegoSidebar */ \"./src/sdk/view/pages/ZegoRoomMobile/components/zegoSidebar.tsx\");\n/* harmony import */ var _context_showManage__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./context/showManage */ \"./src/sdk/view/pages/ZegoRoomMobile/context/showManage.ts\");\n/* harmony import */ var _components_zegoModel__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../../components/zegoModel */ \"./src/sdk/view/components/zegoModel/index.tsx\");\n/* harmony import */ var _components_zegoScreen__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./components/zegoScreen */ \"./src/sdk/view/pages/ZegoRoomMobile/components/zegoScreen.tsx\");\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __assign = (undefined && undefined.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __awaiter = (undefined && undefined.__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 = (undefined && undefined.__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 __spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar ZegoRoomMobile = /** @class */ (function (_super) {\n __extends(ZegoRoomMobile, _super);\n function ZegoRoomMobile() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.state = {\n micOpen: !!_this.props.core._config.turnOnMicrophoneWhenJoining,\n cameraOpen: !!_this.props.core._config.turnOnCameraWhenJoining,\n localStream: undefined,\n layOutStatus: \"ONE_VIDEO\",\n userLayoutStatus: _this.props.core._config.layout || \"Auto\",\n zegoCloudUserList: [],\n memberList: [],\n messageList: [],\n notificationList: [],\n showMore: false,\n connecting: false,\n firstLoading: true,\n cameraFront: true,\n showFooter: true,\n isNetworkPoor: false,\n soundLevel: {},\n liveCountdown: -1,\n liveStatus: 0,\n screenSharingUserList: [],\n };\n _this.micStatus = !!_this.props.core._config.turnOnMicrophoneWhenJoining\n ? 1\n : 0;\n _this.cameraStatus = !!_this.props.core._config.turnOnCameraWhenJoining\n ? 1\n : 0;\n _this.localUserPin = false;\n _this.faceModel = _this.props.core._config.facingMode === \"user\" ? 1 : 0;\n _this.notifyTimer = null;\n _this.cameraDevices = [];\n _this.userUpdateCallBack = function () { };\n _this.localStreamID = \"\";\n _this.safariLimitationNoticed = -1;\n _this.onblur = function (e) {\n if (e.path &&\n !e.path.includes(document.querySelector(\"#ZegoRoomCssMobileMore\")) &&\n !e.path.includes(document.querySelector(\"#ZegoRoomCssMobilePopMore\"))) {\n _this.setState({ showMore: false });\n // @ts-ignore\n document.removeEventListener(\"click\", _this.onblur);\n }\n };\n return _this;\n }\n ZegoRoomMobile.prototype.componentDidMount = function () {\n var _this = this;\n this.initSDK();\n this.footerTimer = setTimeout(function () {\n _this.setState({\n showFooter: false,\n });\n }, 5000);\n };\n ZegoRoomMobile.prototype.componentDidUpdate = function (preProps, preState) {\n var _this = this;\n if ((preState.notificationList.length > 0 &&\n this.state.notificationList.length > 0 &&\n preState.notificationList[preState.notificationList.length - 1]\n .messageID !==\n this.state.notificationList[this.state.notificationList.length - 1]\n .messageID) ||\n (preState.notificationList.length === 0 &&\n this.state.notificationList.length > 0)) {\n if (this.notifyTimer) {\n clearTimeout(this.notifyTimer);\n this.notifyTimer = null;\n }\n this.notifyTimer = setTimeout(function () {\n _this.setState({\n notificationList: [],\n });\n }, 3000);\n }\n if (preState.userLayoutStatus !== this.state.userLayoutStatus) {\n this.handleLayoutChange(this.state.userLayoutStatus);\n }\n };\n ZegoRoomMobile.prototype.initSDK = function () {\n return __awaiter(this, void 0, void 0, function () {\n var logInRsp;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n this.props.core.onNetworkStatusQuality(function (roomID, level) {\n _this.setState({\n isNetworkPoor: level > 2,\n });\n });\n this.props.core.onNetworkStatus(function (roomID, type, status) {\n if (status === \"DISCONNECTED\") {\n _this.props.core.leaveRoom();\n _this.props.leaveRoom && _this.props.leaveRoom();\n }\n else if (status === \"CONNECTING\") {\n _this.setState({\n connecting: true,\n });\n }\n else if (status === \"CONNECTED\") {\n _this.setState({\n connecting: false,\n firstLoading: false,\n });\n }\n });\n this.props.core.onRemoteUserUpdate(function (roomID, updateType, userList) {\n var _a;\n var notificationList = [];\n if ((_a = _this.props.core._config.lowerLeftNotification) === null || _a === void 0 ? void 0 : _a.showUserJoinAndLeave) {\n userList.map(function (u) {\n notificationList.push({\n content: u.userName +\n \" \" +\n (updateType === \"ADD\" ? \"enter\" : \"quite\") +\n \" the room\",\n type: \"USER\",\n userName: u.userName,\n messageID: (0,_util__WEBPACK_IMPORTED_MODULE_6__.randomNumber)(5),\n });\n });\n }\n _this.setState(function (state) {\n return {\n notificationList: __spreadArray(__spreadArray([], state.notificationList, true), notificationList, true),\n };\n });\n });\n this.props.core.onRoomMessageUpdate(function (roomID, messageList) {\n _this.setState(function (state) {\n var _a;\n var lowerLeftNotification = [];\n if (_this.state.layOutStatus !== \"MESSAGE\" &&\n ((_a = _this.props.core._config.lowerLeftNotification) === null || _a === void 0 ? void 0 : _a.showTextChat)) {\n lowerLeftNotification = __spreadArray(__spreadArray([], state.notificationList, true), messageList.map(function (m) {\n return {\n content: m.message,\n type: \"MSG\",\n userName: m.fromUser.userName,\n messageID: m.messageID,\n };\n }), true);\n }\n return {\n messageList: __spreadArray(__spreadArray([], state.messageList, true), messageList, true),\n notificationList: lowerLeftNotification,\n };\n });\n });\n this.props.core.subscribeUserList(function (userList) {\n _this.userUpdateCallBack();\n var notSupportPhone = !(0,_util__WEBPACK_IMPORTED_MODULE_6__.isPc)() &&\n (0,_util__WEBPACK_IMPORTED_MODULE_6__.isIOS)() &&\n (0,_util__WEBPACK_IMPORTED_MODULE_6__.IsLowVersionSafari)() &&\n userList.filter(function (u) {\n return (u.streamList.length > 0 && u.streamList[0].micStatus === \"OPEN\");\n }).length > (_this.state.screenSharingUserList.length > 0 ? 0 : 1);\n if (notSupportPhone) {\n var targetUsers = userList.reverse();\n var targetUser_1 = targetUsers.find(function (u) { return u.streamList.length > 0 && u.streamList[0].micStatus === \"OPEN\"; });\n if (_this.safariLimitationNoticed === -1) {\n _this.safariLimitationNoticed = 0;\n (0,_components_zegoModel__WEBPACK_IMPORTED_MODULE_17__.ZegoModelShow)({\n header: \"Notice\",\n contentText: \"The current browser does not support the display of multiple video screens, we suggest you change your browser.\",\n okText: \"Okay\",\n onOk: function () {\n _this.safariLimitationNoticed = 1;\n _this.setState({\n zegoCloudUserList: [targetUser_1],\n memberList: userList,\n screenSharingUserList: [],\n }, function () {\n _this.handleLayoutChange(_this.state.userLayoutStatus);\n });\n },\n });\n }\n else if (_this.safariLimitationNoticed != 0) {\n _this.setState({\n zegoCloudUserList: [targetUser_1],\n memberList: userList,\n screenSharingUserList: [],\n }, function () {\n _this.handleLayoutChange(_this.state.userLayoutStatus);\n });\n }\n }\n else {\n _this.setState({\n zegoCloudUserList: userList,\n memberList: userList,\n });\n }\n });\n this.props.core.subscribeScreenStream(function (userList) {\n var notSupportPhone = !(0,_util__WEBPACK_IMPORTED_MODULE_6__.isPc)() &&\n (0,_util__WEBPACK_IMPORTED_MODULE_6__.isIOS)() &&\n (0,_util__WEBPACK_IMPORTED_MODULE_6__.IsLowVersionSafari)() &&\n _this.state.zegoCloudUserList.filter(function (u) {\n return (u.streamList.length > 0 && u.streamList[0].micStatus === \"OPEN\");\n }).length > 0;\n !notSupportPhone &&\n _this.setState({ screenSharingUserList: userList }, function () {\n _this.handleLayoutChange(_this.state.userLayoutStatus);\n });\n });\n this.props.core.onSoundLevelUpdate(function (soundLevelList) {\n var list = {};\n soundLevelList.forEach(function (s) {\n var _a;\n var userId = s.streamID.split(\"_\")[1];\n if (list[userId]) {\n list[userId][s.streamID] = Math.floor(s.soundLevel);\n }\n else {\n list[userId] = (_a = {},\n _a[s.streamID] = Math.floor(s.soundLevel),\n _a);\n }\n });\n _this.setState({\n soundLevel: list,\n });\n });\n this.props.core.onRoomLiveStateUpdate(function (res) {\n console.error(\"【ZEGOCLOUD】choui\", res);\n _this.setState(function (preState) {\n return {\n liveStatus: res,\n liveCountdown: preState.liveCountdown === -1 || preState.liveCountdown == 0\n ? res == 1\n ? 0\n : -1\n : preState.liveCountdown,\n };\n }, function () {\n console.error(\"【ZEGOCLOUD】choui liveStatus\", _this.state.liveStatus);\n });\n });\n return [4 /*yield*/, this.props.core.enterRoom()];\n case 1:\n logInRsp = _a.sent();\n if (logInRsp === 0) {\n this.createStream();\n setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {\n var _a, _b;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n _a = this.props.core._config.showMyCameraToggleButton;\n if (!_a) return [3 /*break*/, 2];\n _b = this;\n return [4 /*yield*/, this.props.core.getCameras()];\n case 1:\n _a = (_b.cameraDevices = _c.sent());\n _c.label = 2;\n case 2:\n _a;\n return [2 /*return*/];\n }\n });\n }); }, 1000);\n }\n return [2 /*return*/];\n }\n });\n });\n };\n ZegoRoomMobile.prototype.createStream = function () {\n return __awaiter(this, void 0, void 0, function () {\n var localStream, error_1, res, error_2;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!this.props.core._config.turnOnCameraWhenJoining &&\n !this.props.core._config.turnOnMicrophoneWhenJoining &&\n !this.props.core._config.showMyCameraToggleButton &&\n !this.props.core._config.showMyMicrophoneToggleButton) {\n return [2 /*return*/, false];\n }\n if (!(!this.props.core.status.videoRefuse ||\n !this.props.core.status.audioRefuse)) return [3 /*break*/, 10];\n _a.label = 1;\n case 1:\n _a.trys.push([1, 8, , 9]);\n localStream = null;\n _a.label = 2;\n case 2:\n _a.trys.push([2, 4, , 7]);\n return [4 /*yield*/, this.props.core.createStream({\n camera: {\n video: !this.props.core.status.videoRefuse,\n audio: !this.props.core.status.audioRefuse,\n videoQuality: 4,\n facingMode: this.faceModel ? \"user\" : \"environment\",\n width: 640,\n height: 360,\n bitrate: 400,\n frameRate: 15,\n },\n })];\n case 3:\n localStream = _a.sent();\n return [3 /*break*/, 7];\n case 4:\n error_1 = _a.sent();\n if (!JSON.stringify(error_1).includes(\"constrain\")) return [3 /*break*/, 6];\n return [4 /*yield*/, this.props.core.createStream({\n camera: {\n video: !this.props.core.status.videoRefuse,\n audio: !this.props.core.status.audioRefuse,\n facingMode: this.faceModel ? \"user\" : \"environment\",\n },\n })];\n case 5:\n localStream = _a.sent();\n _a.label = 6;\n case 6: return [3 /*break*/, 7];\n case 7:\n if (!localStream)\n return [2 /*return*/, false];\n this.props.core.mutePublishStreamVideo(localStream, !this.props.core._config.turnOnCameraWhenJoining);\n this.props.core.muteMicrophone(!this.props.core._config.turnOnMicrophoneWhenJoining);\n this.setState({\n localStream: localStream,\n });\n res = this.props.core.publishLocalStream(localStream);\n if (res !== false) {\n this.localStreamID = res;\n }\n return [2 /*return*/, true];\n case 8:\n error_2 = _a.sent();\n console.error(\"【ZEGOCLOUD】createStream or publishLocalStream failed,Reason: \", JSON.stringify(error_2));\n return [2 /*return*/, false];\n case 9: return [3 /*break*/, 11];\n case 10: return [2 /*return*/, false];\n case 11: return [2 /*return*/];\n }\n });\n });\n };\n ZegoRoomMobile.prototype.toggleMic = function () {\n return __awaiter(this, void 0, void 0, function () {\n var result;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (this.props.core.status.audioRefuse) {\n (0,_components_mobile_zegoConfirm__WEBPACK_IMPORTED_MODULE_7__.ZegoConfirm)({\n title: \"Equipment authorization\",\n content: \"We can't detect your devices. Please check your devices and allow us access your devices in your browser's address bar. Then reload this page and try again.\",\n confirm: \"Okay\",\n });\n return [2 /*return*/];\n }\n if (this.micStatus === -1)\n return [2 /*return*/];\n this.micStatus = -1;\n if (!(this.state.localStream &&\n this.state.localStream.getAudioTracks().length > 0)) return [3 /*break*/, 2];\n return [4 /*yield*/, this.props.core.muteMicrophone(this.state.micOpen)];\n case 1:\n result = _a.sent();\n _a.label = 2;\n case 2:\n this.micStatus = !this.state.micOpen ? 1 : 0;\n if (result) {\n (0,_components_mobile_zegoToast__WEBPACK_IMPORTED_MODULE_11__.ZegoToast)({\n content: \"The microphone is \" + (this.micStatus ? \"on\" : \"off\"),\n });\n result &&\n this.setState({\n micOpen: !!this.micStatus,\n }, function () {\n _this.handleLayoutChange(_this.state.userLayoutStatus);\n });\n }\n return [2 /*return*/];\n }\n });\n });\n };\n ZegoRoomMobile.prototype.toggleCamera = function () {\n return __awaiter(this, void 0, void 0, function () {\n var result;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (this.props.core.status.videoRefuse) {\n (0,_components_mobile_zegoConfirm__WEBPACK_IMPORTED_MODULE_7__.ZegoConfirm)({\n title: \"Equipment authorization\",\n content: \"We can't detect your devices. Please check your devices and allow us access your devices in your browser's address bar. Then reload this page and try again.\",\n confirm: \"Okay\",\n });\n return [2 /*return*/];\n }\n if (this.cameraStatus === -1)\n return [2 /*return*/];\n this.cameraStatus = -1;\n if (!(this.state.localStream &&\n this.state.localStream.getVideoTracks().length > 0)) return [3 /*break*/, 2];\n return [4 /*yield*/, this.props.core.mutePublishStreamVideo(this.state.localStream, this.state.cameraOpen)];\n case 1:\n result = _a.sent();\n _a.label = 2;\n case 2:\n this.cameraStatus = !this.state.cameraOpen ? 1 : 0;\n if (result) {\n (0,_components_mobile_zegoToast__WEBPACK_IMPORTED_MODULE_11__.ZegoToast)({\n content: \"The camera is \" + (this.cameraStatus ? \"on\" : \"off\"),\n });\n result &&\n this.setState({\n cameraOpen: !!this.cameraStatus,\n }, function () {\n _this.handleLayoutChange(_this.state.userLayoutStatus);\n });\n }\n return [2 /*return*/];\n }\n });\n });\n };\n ZegoRoomMobile.prototype.switchCamera = function () {\n return __awaiter(this, void 0, void 0, function () {\n var targetModel, targetCameraID;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (this.props.core.status.videoRefuse) {\n (0,_components_mobile_zegoConfirm__WEBPACK_IMPORTED_MODULE_7__.ZegoConfirm)({\n title: \"Equipment authorization\",\n content: \"We can't detect your devices. Please check your devices and allow us access your devices in your browser's address bar. Then reload this page and try again.\",\n confirm: \"Okay\",\n });\n return [2 /*return*/];\n }\n if (!this.state.localStream || this.cameraDevices.length < 2) {\n return [2 /*return*/];\n }\n targetModel = false;\n if (this.faceModel === -1) {\n return [2 /*return*/];\n }\n else if (this.faceModel === 0) {\n targetModel = true;\n }\n this.faceModel = -1;\n if (this.cameraDevices.length < 4) {\n targetCameraID = targetModel\n ? this.cameraDevices[this.cameraDevices.length - 2].deviceID\n : this.cameraDevices[this.cameraDevices.length - 1].deviceID;\n }\n else {\n targetCameraID = targetModel\n ? this.cameraDevices[0].deviceID\n : this.cameraDevices[this.cameraDevices.length - 1].deviceID;\n }\n return [4 /*yield*/, this.props.core.useCameraDevice(this.state.localStream, targetCameraID)];\n case 1:\n _a.sent();\n this.faceModel = targetModel ? 1 : 0;\n this.setState({\n cameraFront: targetModel,\n });\n return [2 /*return*/];\n }\n });\n });\n };\n ZegoRoomMobile.prototype.toggleLayOut = function (layOutStatus) {\n this.setState(function (state) {\n return {\n layOutStatus: state.layOutStatus === layOutStatus ? \"ONE_VIDEO\" : layOutStatus,\n showMore: false,\n };\n });\n };\n ZegoRoomMobile.prototype.sendMessage = function (msg) {\n return __awaiter(this, void 0, void 0, function () {\n var messageID, resp, err_1;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n messageID = (0,_util__WEBPACK_IMPORTED_MODULE_6__.randomNumber)(3);\n this.setState(function (state) {\n return {\n messageList: __spreadArray(__spreadArray([], state.messageList, true), [\n {\n fromUser: {\n userID: _this.props.core._expressConfig.userID,\n userName: _this.props.core._expressConfig.userName,\n },\n message: msg,\n sendTime: Date.now(),\n messageID: messageID,\n status: \"SENDING\",\n },\n ], false),\n };\n });\n resp = {};\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, this.props.core.sendRoomMessage(msg)];\n case 2:\n resp = _a.sent();\n return [3 /*break*/, 4];\n case 3:\n err_1 = _a.sent();\n console.error(\"【ZEGOCLOUD】sendMessage failed!\", JSON.stringify(err_1));\n return [3 /*break*/, 4];\n case 4:\n this.setState(function (state) {\n var _messageList = state.messageList.map(function (msg) {\n if (msg.messageID === messageID) {\n msg.status = resp.errorCode === 0 ? \"SENDED\" : \"FAILED\";\n }\n return msg;\n });\n console.log(_messageList);\n return {\n messageList: _messageList,\n };\n });\n return [2 /*return*/];\n }\n });\n });\n };\n ZegoRoomMobile.prototype.openMore = function () {\n var _this = this;\n this.setState(function (state) {\n return { showMore: !state.showMore };\n }, function () {\n if (_this.state.showMore) {\n // @ts-ignore\n document.addEventListener(\"click\", _this.onblur);\n }\n else {\n // @ts-ignore\n document.removeEventListener(\"click\", _this.onblur);\n }\n });\n };\n ZegoRoomMobile.prototype.leaveRoom = function () {\n var _this = this;\n (0,_components_mobile_zegoConfirm__WEBPACK_IMPORTED_MODULE_7__.ZegoConfirm)({\n title: \"Leave the room\",\n content: \"Are you sure to leave the room?\",\n cancel: \"Cancel\",\n confirm: \"Confirm\",\n closeCallBack: function (confirm) {\n if (confirm) {\n _this.props.core._config.turnOnCameraWhenJoining =\n _this.state.cameraOpen;\n _this.props.core._config.turnOnMicrophoneWhenJoining =\n _this.state.micOpen;\n _this.state.localStream &&\n _this.props.core.destroyStream(_this.state.localStream);\n _this.props.core.leaveRoom();\n _this.props.leaveRoom && _this.props.leaveRoom();\n }\n },\n });\n };\n ZegoRoomMobile.prototype.getAllUser = function () {\n return __spreadArray([\n {\n userID: this.props.core._expressConfig.userID,\n userName: this.props.core._expressConfig.userName,\n pin: this.localUserPin,\n streamList: [\n {\n media: this.state.localStream,\n fromUser: {\n userID: this.props.core._expressConfig.userID,\n userName: this.props.core._expressConfig.userName,\n },\n micStatus: this.state.micOpen ? \"OPEN\" : \"MUTE\",\n cameraStatus: this.state.cameraOpen ? \"OPEN\" : \"MUTE\",\n state: \"PLAYING\",\n streamID: this.localStreamID,\n },\n ],\n }\n ], this.state.zegoCloudUserList, true);\n };\n ZegoRoomMobile.prototype.getAllMemberList = function () {\n return __spreadArray([\n {\n userID: this.props.core._expressConfig.userID,\n userName: this.props.core._expressConfig.userName,\n pin: this.localUserPin,\n streamList: [\n {\n media: this.state.localStream,\n fromUser: {\n userID: this.props.core._expressConfig.userID,\n userName: this.props.core._expressConfig.userName,\n },\n micStatus: this.state.micOpen ? \"OPEN\" : \"MUTE\",\n cameraStatus: this.state.cameraOpen ? \"OPEN\" : \"MUTE\",\n state: \"PLAYING\",\n streamID: this.localStreamID,\n },\n ],\n }\n ], this.state.memberList, true);\n };\n ZegoRoomMobile.prototype.getShownUser = function () {\n var _this = this;\n var shownUser = this.getAllUser().filter(function (item) {\n if (!_this.props.core._config.showNonVideoUser) {\n if (item.streamList && item.streamList[0] && item.streamList[0].media) {\n if (item.streamList[0].cameraStatus === \"OPEN\") {\n return true;\n }\n else if (_this.props.core._config.showOnlyAudioUser &&\n item.streamList[0].micStatus === \"OPEN\") {\n return true;\n }\n else {\n return false;\n }\n }\n else {\n return false;\n }\n }\n else {\n return true;\n }\n });\n return shownUser;\n };\n ZegoRoomMobile.prototype.getHiddenUser = function () {\n var _this = this;\n var hiddenUser = this.getAllUser().filter(function (item) {\n if (!_this.props.core._config.showNonVideoUser &&\n item.streamList &&\n item.streamList[0] &&\n item.streamList[0].media &&\n item.streamList[0].cameraStatus !== \"OPEN\" &&\n !_this.props.core._config.showOnlyAudioUser &&\n item.streamList[0].micStatus === \"OPEN\") {\n return true;\n }\n else {\n return false;\n }\n });\n return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, { children: hiddenUser.map(function (user) {\n return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"audio\", { autoPlay: true, muted: user.userID === _this.props.core._expressConfig.userID, onCanPlay: function (ev) {\n ev.target.play();\n }, ref: function (el) {\n el &&\n el.srcObject !== user.streamList[0].media &&\n (el.srcObject = user.streamList[0].media);\n } }, user.userID + \"_hiddenAudio\"));\n }) }));\n };\n Object.defineProperty(ZegoRoomMobile.prototype, \"showSelf\", {\n get: function () {\n if (this.props.core._config.showNonVideoUser) {\n return true;\n }\n else {\n if (this.props.core._config.showOnlyAudioUser) {\n return (this.localStreamID && (this.state.micOpen || this.state.cameraOpen));\n }\n else {\n return this.localStreamID && this.state.cameraOpen;\n }\n }\n },\n enumerable: false,\n configurable: true\n });\n ZegoRoomMobile.prototype.handleLayoutChange = function (selectLayout) {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n if (selectLayout !== \"Sidebar\") {\n this._selectedUser && (this._selectedUser.pin = false);\n this.localUserPin = false;\n this.props.core.setPin();\n }\n this.setState({\n userLayoutStatus: selectLayout,\n });\n return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n this.userUpdateCallBack = function () {\n resolve(true);\n };\n setTimeout(function () {\n resolve(false);\n }, 5000);\n if (!this.state.screenSharingUserList.length) return [3 /*break*/, 2];\n return [4 /*yield*/, this.props.core.setMaxScreenNum(this.showSelf ? 3 : 4)];\n case 1:\n _a.sent();\n return [3 /*break*/, 6];\n case 2:\n if (!(selectLayout !== \"Sidebar\")) return [3 /*break*/, 4];\n return [4 /*yield*/, this.props.core.setMaxScreenNum(this.showSelf ? 5 : 6)];\n case 3:\n _a.sent();\n return [3 /*break*/, 6];\n case 4: return [4 /*yield*/, this.props.core.setMaxScreenNum(this.showSelf ? 4 : 5)];\n case 5:\n _a.sent();\n _a.label = 6;\n case 6: return [4 /*yield*/, this.props.core.setSidebarLayOut(this.state.screenSharingUserList.length > 0\n ? false\n : selectLayout === \"Sidebar\"\n ? !this.localUserPin\n : false)];\n case 7:\n _a.sent();\n return [2 /*return*/];\n }\n });\n }); })];\n });\n });\n };\n ZegoRoomMobile.prototype.getListScreen = function () {\n var _this = this;\n var pages;\n if (this.state.layOutStatus === \"INVITE\") {\n pages = ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_zegoRoomInvite__WEBPACK_IMPORTED_MODULE_9__.ZegoRoomInvite, { core: this.props.core, closeCallBack: function () {\n _this.setState({\n layOutStatus: \"ONE_VIDEO\",\n });\n } }));\n }\n else if (this.state.layOutStatus === \"USER_LIST\") {\n pages = ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_zegoUserList__WEBPACK_IMPORTED_MODULE_8__.ZegoUserList, { core: this.props.core, userList: this.getAllMemberList(), closeCallBack: function (_user) {\n _user && (_this._selectedUser = _user);\n _this.setState({\n layOutStatus: _user ? \"MANAGE\" : \"ONE_VIDEO\",\n });\n } }));\n }\n else if (this.state.layOutStatus === \"MESSAGE\") {\n pages = ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_zegoMessage__WEBPACK_IMPORTED_MODULE_5__.ZegoMessage, { userID: this.props.core._expressConfig.userID, messageList: this.state.messageList, sendMessage: function (msg) {\n _this.sendMessage(msg);\n }, closeCallBac: function () {\n _this.setState({\n layOutStatus: \"ONE_VIDEO\",\n });\n } }));\n }\n else if (this.state.layOutStatus === \"LAYOUT\") {\n pages = ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_zegoLayout__WEBPACK_IMPORTED_MODULE_12__.ZegoLayout, { selectLayout: this.state.userLayoutStatus, closeCallBac: function () {\n _this.setState({\n layOutStatus: \"ONE_VIDEO\",\n });\n }, selectCallBack: this.handleLayoutChange.bind(this) }));\n }\n else if (this.state.layOutStatus === \"MANAGE\") {\n pages = ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_zegoManage__WEBPACK_IMPORTED_MODULE_13__.ZegoManage, { closeCallBac: function () {\n _this.setState({\n layOutStatus: \"ONE_VIDEO\",\n });\n }, selectCallBac: function (type, value) {\n if (type === \"Pin\" && typeof value != \"undefined\") {\n if (_this._selectedUser.userID !==\n _this.props.core._expressConfig.userID) {\n _this.props.core.setPin(_this._selectedUser.userID, value);\n _this.localUserPin = false;\n }\n else {\n _this.localUserPin = value;\n _this._selectedUser.pin = value;\n _this.props.core.setPin();\n }\n _this.setState({\n userLayoutStatus: \"Sidebar\",\n });\n _this.props.core.setSidebarLayOut(_this.state.screenSharingUserList.length > 0\n ? false\n : !_this.localUserPin);\n }\n }, selectedUser: this._selectedUser }));\n }\n if (pages) {\n return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].mask }, { children: pages }));\n }\n };\n ZegoRoomMobile.prototype.getLayoutScreen = function () {\n var _this = this;\n var _a, _b, _c, _d, _e;\n if (((_a = this.props.core._config.scenario) === null || _a === void 0 ? void 0 : _a.mode) === _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.LiveStreaming &&\n ((_c = (_b = this.props.core._config.scenario) === null || _b === void 0 ? void 0 : _b.config) === null || _c === void 0 ? void 0 : _c.role) === _model__WEBPACK_IMPORTED_MODULE_2__.LiveRole.Audience &&\n this.state.liveStatus != 1) {\n return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: \"\".concat(_index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].liveNotStart, \" zegoUserVideo_click\") }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"i\", {}), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", { children: \"The Live has not started yet\" })] })));\n }\n else if (!__spreadArray(__spreadArray([], this.getAllUser(), true), this.state.screenSharingUserList, true).some(function (u) {\n if (u.streamList) {\n return u.streamList.some(function (s) {\n return s.cameraStatus === \"OPEN\" || s.micStatus === \"OPEN\";\n });\n }\n return false;\n })) {\n return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: \"\".concat(_index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].noOneStreaming, \" zegoUserVideo_click\") }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"i\", {}), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", { children: \"No one has turned on the camera or microphone yet.\" })] })));\n }\n if (this.state.screenSharingUserList.length > 0) {\n return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].screenTopBar }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", __assign({ style: {\n color: (0,_util__WEBPACK_IMPORTED_MODULE_6__.userNameColor)(this.state.screenSharingUserList[0].userName),\n } }, { children: (_e = (_d = this.state.screenSharingUserList[0].userName) === null || _d === void 0 ? void 0 : _d.slice(0, 1)) === null || _e === void 0 ? void 0 : _e.toUpperCase() })), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"p\", { children: this.state.screenSharingUserList[0].userName + \" is presenting\" })] })), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_zegoScreen__WEBPACK_IMPORTED_MODULE_18__.ZegoScreen, { selfInfo: {\n userID: this.props.core._expressConfig.userID,\n }, userList: this.getShownUser(), screenSharingUser: this.state.screenSharingUserList[0], videoShowNumber: 5, soundLevel: this.state.soundLevel })] }));\n }\n if ((this.state.userLayoutStatus === \"Auto\" &&\n this.getShownUser().length < 3) ||\n this.getShownUser().length < 2) {\n return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_zegoOne2One__WEBPACK_IMPORTED_MODULE_4__.ZegoOne2One, { selfInfo: {\n userID: this.props.core._expressConfig.userID,\n }, userList: this.getShownUser(), soundLevel: this.state.soundLevel, onLocalStreamPaused: function () { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n console.warn(\"onLocalStreamPaused\");\n return [4 /*yield*/, this.props.core.enableVideoCaptureDevice(this.state.localStream, !this.state.cameraOpen)];\n case 1:\n _a.sent();\n this.props.core.enableVideoCaptureDevice(this.state.localStream, this.state.cameraOpen);\n return [2 /*return*/];\n }\n });\n }); } }));\n }\n else if ((this.state.userLayoutStatus === \"Grid\" &&\n this.getShownUser().length > 1) ||\n (this.state.userLayoutStatus === \"Auto\" && this.getShownUser().length > 2)) {\n return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_zegoGrid__WEBPACK_IMPORTED_MODULE_14__.ZegoGrid, { selfInfo: {\n userID: this.props.core._expressConfig.userID,\n }, userList: this.getShownUser(), videoShowNumber: 6, soundLevel: this.state.soundLevel }));\n }\n else if (this.state.userLayoutStatus === \"Sidebar\" &&\n this.getShownUser().length > 1) {\n return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_zegoSidebar__WEBPACK_IMPORTED_MODULE_15__.ZegoSidebar, { selfInfo: {\n userID: this.props.core._expressConfig.userID,\n }, userList: this.getShownUser(), videoShowNumber: 5, soundLevel: this.state.soundLevel }));\n }\n };\n ZegoRoomMobile.prototype.clickVideo = function (e) {\n var _this = this;\n // @ts-ignore\n var className = e.target.className;\n if (className.includes(\"zegoUserVideo_videoCommon\") ||\n className.includes(\"zegoMore_more\") ||\n className.includes(\"ZegoRoomMobile_ZegoRoom\") ||\n className.includes(\"zegoUserVideo_click\")) {\n if (!this.state.showFooter) {\n this.setState({ showFooter: true });\n }\n else {\n if (this.state.layOutStatus != \"ONE_VIDEO\") {\n this.setState({\n layOutStatus: \"ONE_VIDEO\",\n });\n clearTimeout(this.footerTimer);\n this.footerTimer = setTimeout(function () {\n _this.setState({ showFooter: false, showMore: false });\n }, 5000);\n }\n else {\n this.setState({ showFooter: false, showMore: false });\n }\n }\n e.stopPropagation();\n }\n else {\n clearTimeout(this.footerTimer);\n this.footerTimer = setTimeout(function () {\n _this.setState({ showFooter: false, showMore: false });\n }, 5000);\n }\n };\n ZegoRoomMobile.prototype.setLive = function () {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n if (this.state.liveCountdown === 0) {\n (0,_components_zegoModel__WEBPACK_IMPORTED_MODULE_17__.ZegoModelShow)({\n header: \"Stop broadcast\",\n contentText: \"Are you sure to stop broadcasting?\",\n okText: \"Stop\",\n cancelText: \"Cancel\",\n onOk: function () { return __awaiter(_this, void 0, void 0, function () {\n var res;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.props.core.setLive(\"stop\")];\n case 1:\n res = _a.sent();\n this.setState({\n liveCountdown: -1,\n });\n return [2 /*return*/];\n }\n });\n }); },\n });\n }\n else if (this.state.liveCountdown === -1) {\n this.setState({\n liveCountdown: 3,\n }, function () {\n setTimeout(function () {\n _this.liveCountdownTimer();\n }, 1000);\n });\n }\n return [2 /*return*/];\n });\n });\n };\n ZegoRoomMobile.prototype.liveCountdownTimer = function () {\n var _this = this;\n this.setState(function (preState) {\n return {\n liveCountdown: preState.liveCountdown - 1,\n };\n }, function () { return __awaiter(_this, void 0, void 0, function () {\n var res;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!(this.state.liveCountdown === 0)) return [3 /*break*/, 2];\n return [4 /*yield*/, this.props.core.setLive(\"live\")];\n case 1:\n res = _a.sent();\n return [3 /*break*/, 3];\n case 2:\n setTimeout(function () {\n _this.liveCountdownTimer();\n }, 1000);\n _a.label = 3;\n case 3: return [2 /*return*/];\n }\n });\n }); });\n };\n ZegoRoomMobile.prototype.render = function () {\n var _this = this;\n var _a, _b, _c, _d, _e, _f, _g;\n var startIndex = this.state.notificationList.length < 4\n ? 0\n : this.state.notificationList.length - 2;\n return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_context_showManage__WEBPACK_IMPORTED_MODULE_16__[\"default\"].Provider, __assign({ value: {\n show: function (_user) {\n _user && (_this._selectedUser = _user);\n _this.setState({\n layOutStatus: _user ? \"MANAGE\" : \"ONE_VIDEO\",\n });\n },\n showPinButton: !!this.props.core._config.showPinButton,\n userInfo: { userID: this.props.core._expressConfig.userID },\n } }, { children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: \"\".concat(_index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].ZegoRoom, \" ZegoRoomMobile_ZegoRoom\"), onClick: function (e) {\n // @ts-ignore\n _this.clickVideo(e);\n } }, { children: [this.getLayoutScreen(), this.state.isNetworkPoor && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", { className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].network })), (this.state.showFooter || false) && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].footer }, { children: [this.props.core._config.showMyCameraToggleButton &&\n ((_a = this.props.core._config.scenario) === null || _a === void 0 ? void 0 : _a.mode) !==\n _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.LiveStreaming && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"a\", { className: \"\".concat(_index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].switchCamera, \" \").concat(this.state.cameraFront ? \"\" : _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].switchCameraBack), onClick: function () {\n _this.switchCamera();\n } })), this.props.core._config.showMyCameraToggleButton && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"a\", { className: this.state.cameraOpen\n ? _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].toggleCamera\n : _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].cameraClose, onClick: function () {\n _this.toggleCamera();\n } })), this.props.core._config.showMyMicrophoneToggleButton && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"a\", { className: this.state.micOpen\n ? _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].toggleMic\n : _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].micClose, onClick: function () {\n _this.toggleMic();\n } })), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"a\", { className: ((_b = this.props.core._config.scenario) === null || _b === void 0 ? void 0 : _b.mode) ===\n _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.LiveStreaming\n ? _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].liveLeaveButton\n : _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].leaveRoom, onClick: function () {\n _this.leaveRoom();\n } }), (this.props.core._config.showTextChat ||\n this.props.core._config.showUserList ||\n this.props.core._config.sharedLinks) && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"a\", __assign({ id: \"ZegoRoomCssMobileMore\", className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].more, onClick: function () {\n _this.openMore();\n } }, { children: [(this.state.showMore || false) && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", __assign({ id: \"ZegoRoomCssMobilePopMore\", className: \"\".concat(_index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].popMore, \" \").concat(_index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].popLiveMore) }, { children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].popMoreContent }, { children: [this.props.core._config.showMyCameraToggleButton &&\n ((_c = this.props.core._config.scenario) === null || _c === void 0 ? void 0 : _c.mode) ===\n _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.LiveStreaming && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: \"\".concat(_index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].switchCamera, \" zegoUserVideo_click\"), onClick: function () {\n _this.switchCamera();\n } }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"i\", { className: \"\".concat(_index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].switchCamera, \" zegoUserVideo_click\") }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", { children: \"Flip\" })] }))), ((_d = this.props.core._config.preJoinViewConfig) === null || _d === void 0 ? void 0 : _d.invitationLink) && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].roomDetail, onClick: function (ev) {\n ev.stopPropagation();\n _this.toggleLayOut(\"INVITE\");\n } }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"i\", { className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].details }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", { children: \"Room details\" })] }))), this.props.core._config.showUserList && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ onClick: function (ev) {\n ev.stopPropagation();\n _this.toggleLayOut(\"USER_LIST\");\n } }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"i\", { className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].member }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", { children: \"Member\" })] }))), this.props.core._config.showTextChat && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ onClick: function (ev) {\n ev.stopPropagation();\n _this.toggleLayOut(\"MESSAGE\");\n } }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"i\", { className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].chat }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", { children: \"Chat\" })] }))), this.props.core._config.showLayoutButton && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ onClick: function (ev) {\n ev.stopPropagation();\n _this.toggleLayOut(\"LAYOUT\");\n } }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"i\", { className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layout }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", { children: \"Layout\" })] })))] })) }))), (this.state.showMore || false) && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", { className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].popMoreArray }))] }))), ((_e = this.props.core._config.scenario) === null || _e === void 0 ? void 0 : _e.mode) ===\n _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.LiveStreaming &&\n ((_f = this.props.core._config.scenario.config) === null || _f === void 0 ? void 0 : _f.role) ===\n _model__WEBPACK_IMPORTED_MODULE_2__.LiveRole.Host && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"a\", __assign({ className: \"\".concat(_index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].goLive, \" \").concat(this.state.liveCountdown === 0\n ? _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].goLiveEnabled\n : \"\"), onClick: function () {\n _this.setLive();\n } }, { children: this.state.liveCountdown === 3 ||\n this.state.liveCountdown === -1\n ? \"Go Live\"\n : this.state.liveCountdown === 0\n ? \"Stop\"\n : \"Go Live\" })))] }))), this.getListScreen(), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, { children: this.getHiddenUser() }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].notify }, { children: this.state.notificationList.slice(startIndex).map(function (notify) {\n if (notify.type === \"MSG\") {\n return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].notifyContent }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"h5\", { children: notify.userName }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", { children: notify.content })] }), notify.content));\n }\n else {\n return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].notifyContent }, { children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", { children: notify.content }) }), notify.content));\n }\n }) })), this.state.liveCountdown > 0 && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].countDown }, { children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", { children: this.state.liveCountdown }) }))), (this.state.connecting || false) && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_ZegoReconnect__WEBPACK_IMPORTED_MODULE_10__.ZegoReconnect, { content: this.state.firstLoading || false\n ? \"Joining Room\"\n : \"Trying to reconnect...\" })), ((_g = this.props.core._config.scenario) === null || _g === void 0 ? void 0 : _g.mode) ===\n _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.LiveStreaming &&\n (this.state.liveCountdown === 0 || this.state.liveStatus == 1) && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"button\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].LiveStateButton }, { children: \"Live\" })))] })) })));\n };\n ZegoRoomMobile.contextType = _context_showManage__WEBPACK_IMPORTED_MODULE_16__[\"default\"];\n return ZegoRoomMobile;\n}((react__WEBPACK_IMPORTED_MODULE_1___default().PureComponent)));\n\n\n\n//# sourceURL=webpack://zegocloud_client_sdk_web/./src/sdk/view/pages/ZegoRoomMobile/index.tsx?");
2031
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ZegoRoomMobile\": function() { return /* binding */ ZegoRoomMobile; }\n/* harmony export */ });\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ \"./node_modules/react/jsx-runtime.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _model__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../model */ \"./src/sdk/model/index.ts\");\n/* harmony import */ var _index_module_scss__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./index.module.scss */ \"./src/sdk/view/pages/ZegoRoomMobile/index.module.scss\");\n/* harmony import */ var _components_zegoOne2One__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./components/zegoOne2One */ \"./src/sdk/view/pages/ZegoRoomMobile/components/zegoOne2One.tsx\");\n/* harmony import */ var _components_zegoMessage__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./components/zegoMessage */ \"./src/sdk/view/pages/ZegoRoomMobile/components/zegoMessage.tsx\");\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../util */ \"./src/sdk/util.ts\");\n/* harmony import */ var _components_mobile_zegoConfirm__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../components/mobile/zegoConfirm */ \"./src/sdk/view/components/mobile/zegoConfirm/index.tsx\");\n/* harmony import */ var _components_zegoUserList__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./components/zegoUserList */ \"./src/sdk/view/pages/ZegoRoomMobile/components/zegoUserList.tsx\");\n/* harmony import */ var _components_zegoRoomInvite__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./components/zegoRoomInvite */ \"./src/sdk/view/pages/ZegoRoomMobile/components/zegoRoomInvite.tsx\");\n/* harmony import */ var _components_ZegoReconnect__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./components/ZegoReconnect */ \"./src/sdk/view/pages/ZegoRoomMobile/components/ZegoReconnect.tsx\");\n/* harmony import */ var _components_mobile_zegoToast__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../components/mobile/zegoToast */ \"./src/sdk/view/components/mobile/zegoToast/index.tsx\");\n/* harmony import */ var _components_zegoLayout__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./components/zegoLayout */ \"./src/sdk/view/pages/ZegoRoomMobile/components/zegoLayout.tsx\");\n/* harmony import */ var _components_zegoManage__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./components/zegoManage */ \"./src/sdk/view/pages/ZegoRoomMobile/components/zegoManage.tsx\");\n/* harmony import */ var _components_zegoGrid__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./components/zegoGrid */ \"./src/sdk/view/pages/ZegoRoomMobile/components/zegoGrid.tsx\");\n/* harmony import */ var _components_zegoSidebar__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./components/zegoSidebar */ \"./src/sdk/view/pages/ZegoRoomMobile/components/zegoSidebar.tsx\");\n/* harmony import */ var _context_showManage__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./context/showManage */ \"./src/sdk/view/pages/ZegoRoomMobile/context/showManage.ts\");\n/* harmony import */ var _components_zegoModel__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../../components/zegoModel */ \"./src/sdk/view/components/zegoModel/index.tsx\");\n/* harmony import */ var _components_zegoScreen__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./components/zegoScreen */ \"./src/sdk/view/pages/ZegoRoomMobile/components/zegoScreen.tsx\");\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __assign = (undefined && undefined.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __awaiter = (undefined && undefined.__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 = (undefined && undefined.__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 __spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar ZegoRoomMobile = /** @class */ (function (_super) {\n __extends(ZegoRoomMobile, _super);\n function ZegoRoomMobile() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.state = {\n micOpen: !!_this.props.core._config.turnOnMicrophoneWhenJoining,\n cameraOpen: !!_this.props.core._config.turnOnCameraWhenJoining,\n localStream: undefined,\n layOutStatus: \"ONE_VIDEO\",\n userLayoutStatus: _this.props.core._config.layout || \"Auto\",\n zegoCloudUserList: [],\n memberList: [],\n messageList: [],\n notificationList: [],\n showMore: false,\n connecting: false,\n firstLoading: true,\n cameraFront: true,\n showFooter: true,\n isNetworkPoor: false,\n soundLevel: {},\n liveCountdown: -1,\n liveStatus: 0,\n screenSharingUserList: [],\n };\n _this.micStatus = !!_this.props.core._config.turnOnMicrophoneWhenJoining\n ? 1\n : 0;\n _this.cameraStatus = !!_this.props.core._config.turnOnCameraWhenJoining\n ? 1\n : 0;\n _this.localUserPin = false;\n _this.faceModel = _this.props.core._config.facingMode === \"user\" ? 1 : 0;\n _this.notifyTimer = null;\n _this.cameraDevices = [];\n _this.userUpdateCallBack = function () { };\n _this.localStreamID = \"\";\n _this.safariLimitationNoticed = -1;\n _this.onblur = function (e) {\n if (e.path &&\n !e.path.includes(document.querySelector(\"#ZegoRoomCssMobileMore\")) &&\n !e.path.includes(document.querySelector(\"#ZegoRoomCssMobilePopMore\"))) {\n _this.setState({ showMore: false });\n // @ts-ignore\n document.removeEventListener(\"click\", _this.onblur);\n }\n };\n return _this;\n }\n ZegoRoomMobile.prototype.componentDidMount = function () {\n var _this = this;\n this.initSDK();\n this.footerTimer = setTimeout(function () {\n _this.setState({\n showFooter: false,\n });\n }, 5000);\n };\n ZegoRoomMobile.prototype.componentDidUpdate = function (preProps, preState) {\n var _this = this;\n if ((preState.notificationList.length > 0 &&\n this.state.notificationList.length > 0 &&\n preState.notificationList[preState.notificationList.length - 1]\n .messageID !==\n this.state.notificationList[this.state.notificationList.length - 1]\n .messageID) ||\n (preState.notificationList.length === 0 &&\n this.state.notificationList.length > 0)) {\n if (this.notifyTimer) {\n clearTimeout(this.notifyTimer);\n this.notifyTimer = null;\n }\n this.notifyTimer = setTimeout(function () {\n _this.setState({\n notificationList: [],\n });\n }, 3000);\n }\n if (preState.userLayoutStatus !== this.state.userLayoutStatus) {\n this.handleLayoutChange(this.state.userLayoutStatus);\n }\n };\n ZegoRoomMobile.prototype.initSDK = function () {\n return __awaiter(this, void 0, void 0, function () {\n var logInRsp;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n this.props.core.onNetworkStatusQuality(function (roomID, level) {\n _this.setState({\n isNetworkPoor: level > 2,\n });\n });\n this.props.core.onNetworkStatus(function (roomID, type, status) {\n if (status === \"DISCONNECTED\") {\n _this.props.core.leaveRoom();\n _this.props.leaveRoom && _this.props.leaveRoom();\n }\n else if (status === \"CONNECTING\") {\n _this.setState({\n connecting: true,\n });\n }\n else if (status === \"CONNECTED\") {\n _this.setState({\n connecting: false,\n firstLoading: false,\n });\n }\n });\n this.props.core.onRemoteUserUpdate(function (roomID, updateType, userList) {\n var _a;\n var notificationList = [];\n if ((_a = _this.props.core._config.lowerLeftNotification) === null || _a === void 0 ? void 0 : _a.showUserJoinAndLeave) {\n userList.map(function (u) {\n notificationList.push({\n content: u.userName +\n \" \" +\n (updateType === \"ADD\" ? \"enter\" : \"quite\") +\n \" the room\",\n type: \"USER\",\n userName: u.userName,\n messageID: (0,_util__WEBPACK_IMPORTED_MODULE_6__.randomNumber)(5),\n });\n });\n }\n _this.setState(function (state) {\n return {\n notificationList: __spreadArray(__spreadArray([], state.notificationList, true), notificationList, true),\n };\n });\n });\n this.props.core.onRoomMessageUpdate(function (roomID, messageList) {\n _this.setState(function (state) {\n var _a;\n var lowerLeftNotification = [];\n if (_this.state.layOutStatus !== \"MESSAGE\" &&\n ((_a = _this.props.core._config.lowerLeftNotification) === null || _a === void 0 ? void 0 : _a.showTextChat)) {\n lowerLeftNotification = __spreadArray(__spreadArray([], state.notificationList, true), messageList.map(function (m) {\n return {\n content: m.message,\n type: \"MSG\",\n userName: m.fromUser.userName,\n messageID: m.messageID,\n };\n }), true);\n }\n return {\n messageList: __spreadArray(__spreadArray([], state.messageList, true), messageList, true),\n notificationList: lowerLeftNotification,\n };\n });\n });\n this.props.core.subscribeUserList(function (userList) {\n _this.userUpdateCallBack();\n var notSupportPhone = !(0,_util__WEBPACK_IMPORTED_MODULE_6__.isPc)() &&\n (0,_util__WEBPACK_IMPORTED_MODULE_6__.isIOS)() &&\n (0,_util__WEBPACK_IMPORTED_MODULE_6__.IsLowVersionSafari)() &&\n userList.filter(function (u) {\n return (u.streamList.length > 0 && u.streamList[0].micStatus === \"OPEN\");\n }).length > (_this.state.screenSharingUserList.length > 0 ? 0 : 1);\n if (notSupportPhone) {\n var targetUsers = userList.reverse();\n var targetUser_1 = targetUsers.find(function (u) { return u.streamList.length > 0 && u.streamList[0].micStatus === \"OPEN\"; });\n if (_this.safariLimitationNoticed === -1) {\n _this.safariLimitationNoticed = 0;\n (0,_components_zegoModel__WEBPACK_IMPORTED_MODULE_17__.ZegoModelShow)({\n header: \"Notice\",\n contentText: \"The current browser does not support the display of multiple video screens, we suggest you change your browser.\",\n okText: \"Okay\",\n onOk: function () {\n _this.safariLimitationNoticed = 1;\n _this.setState({\n zegoCloudUserList: [targetUser_1],\n memberList: userList,\n screenSharingUserList: [],\n }, function () {\n _this.handleLayoutChange(_this.state.userLayoutStatus);\n });\n },\n });\n }\n else if (_this.safariLimitationNoticed != 0) {\n // do nothing\n }\n }\n else {\n _this.setState({\n zegoCloudUserList: userList,\n memberList: userList,\n });\n }\n });\n this.props.core.subscribeScreenStream(function (userList) {\n var notSupportPhone = !(0,_util__WEBPACK_IMPORTED_MODULE_6__.isPc)() &&\n (0,_util__WEBPACK_IMPORTED_MODULE_6__.isIOS)() &&\n (0,_util__WEBPACK_IMPORTED_MODULE_6__.IsLowVersionSafari)() &&\n _this.state.zegoCloudUserList.filter(function (u) {\n return (u.streamList.length > 0 && u.streamList[0].micStatus === \"OPEN\");\n }).length > 0;\n !notSupportPhone &&\n _this.setState({ screenSharingUserList: userList }, function () {\n _this.handleLayoutChange(_this.state.userLayoutStatus);\n });\n });\n this.props.core.onSoundLevelUpdate(function (soundLevelList) {\n var list = {};\n soundLevelList.forEach(function (s) {\n var _a;\n var userId = s.streamID.split(\"_\")[1];\n if (list[userId]) {\n list[userId][s.streamID] = Math.floor(s.soundLevel);\n }\n else {\n list[userId] = (_a = {},\n _a[s.streamID] = Math.floor(s.soundLevel),\n _a);\n }\n });\n _this.setState({\n soundLevel: list,\n });\n });\n this.props.core.onRoomLiveStateUpdate(function (res) {\n console.error(\"【ZEGOCLOUD】choui\", res);\n _this.setState(function (preState) {\n return {\n liveStatus: res,\n liveCountdown: preState.liveCountdown === -1 || preState.liveCountdown == 0\n ? res == 1\n ? 0\n : -1\n : preState.liveCountdown,\n };\n }, function () {\n console.error(\"【ZEGOCLOUD】choui liveStatus\", _this.state.liveStatus);\n });\n });\n return [4 /*yield*/, this.props.core.enterRoom()];\n case 1:\n logInRsp = _a.sent();\n if (logInRsp === 0) {\n this.createStream();\n setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {\n var _a, _b;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n _a = this.props.core._config.showMyCameraToggleButton;\n if (!_a) return [3 /*break*/, 2];\n _b = this;\n return [4 /*yield*/, this.props.core.getCameras()];\n case 1:\n _a = (_b.cameraDevices = _c.sent());\n _c.label = 2;\n case 2:\n _a;\n return [2 /*return*/];\n }\n });\n }); }, 1300);\n }\n return [2 /*return*/];\n }\n });\n });\n };\n ZegoRoomMobile.prototype.createStream = function () {\n return __awaiter(this, void 0, void 0, function () {\n var localStream, error_1, res, error_2;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!this.props.core._config.turnOnCameraWhenJoining &&\n !this.props.core._config.turnOnMicrophoneWhenJoining &&\n !this.props.core._config.showMyCameraToggleButton &&\n !this.props.core._config.showMyMicrophoneToggleButton) {\n return [2 /*return*/, false];\n }\n if (!(!this.props.core.status.videoRefuse ||\n !this.props.core.status.audioRefuse)) return [3 /*break*/, 10];\n _a.label = 1;\n case 1:\n _a.trys.push([1, 8, , 9]);\n localStream = null;\n _a.label = 2;\n case 2:\n _a.trys.push([2, 4, , 7]);\n return [4 /*yield*/, this.props.core.createStream({\n camera: {\n video: !this.props.core.status.videoRefuse,\n audio: !this.props.core.status.audioRefuse,\n videoQuality: 4,\n facingMode: this.faceModel ? \"user\" : \"environment\",\n width: 640,\n height: 360,\n bitrate: 400,\n frameRate: 15,\n },\n })];\n case 3:\n localStream = _a.sent();\n return [3 /*break*/, 7];\n case 4:\n error_1 = _a.sent();\n if (!JSON.stringify(error_1).includes(\"constrain\")) return [3 /*break*/, 6];\n return [4 /*yield*/, this.props.core.createStream({\n camera: {\n video: !this.props.core.status.videoRefuse,\n audio: !this.props.core.status.audioRefuse,\n facingMode: this.faceModel ? \"user\" : \"environment\",\n },\n })];\n case 5:\n localStream = _a.sent();\n _a.label = 6;\n case 6: return [3 /*break*/, 7];\n case 7:\n if (!localStream)\n return [2 /*return*/, false];\n this.props.core.mutePublishStreamVideo(localStream, !this.props.core._config.turnOnCameraWhenJoining);\n this.props.core.muteMicrophone(!this.props.core._config.turnOnMicrophoneWhenJoining);\n this.setState({\n localStream: localStream,\n });\n res = this.props.core.publishLocalStream(localStream);\n if (res !== false) {\n this.localStreamID = res;\n }\n return [2 /*return*/, true];\n case 8:\n error_2 = _a.sent();\n console.error(\"【ZEGOCLOUD】createStream or publishLocalStream failed,Reason: \", JSON.stringify(error_2));\n return [2 /*return*/, false];\n case 9: return [3 /*break*/, 11];\n case 10: return [2 /*return*/, false];\n case 11: return [2 /*return*/];\n }\n });\n });\n };\n ZegoRoomMobile.prototype.toggleMic = function () {\n return __awaiter(this, void 0, void 0, function () {\n var result;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (this.props.core.status.audioRefuse) {\n (0,_components_mobile_zegoConfirm__WEBPACK_IMPORTED_MODULE_7__.ZegoConfirm)({\n title: \"Equipment authorization\",\n content: \"We can't detect your devices. Please check your devices and allow us access your devices in your browser's address bar. Then reload this page and try again.\",\n confirm: \"Okay\",\n });\n return [2 /*return*/];\n }\n if (this.micStatus === -1)\n return [2 /*return*/];\n this.micStatus = -1;\n if (!(this.state.localStream &&\n this.state.localStream.getAudioTracks().length > 0)) return [3 /*break*/, 2];\n return [4 /*yield*/, this.props.core.muteMicrophone(this.state.micOpen)];\n case 1:\n result = _a.sent();\n _a.label = 2;\n case 2:\n this.micStatus = !this.state.micOpen ? 1 : 0;\n if (result) {\n (0,_components_mobile_zegoToast__WEBPACK_IMPORTED_MODULE_11__.ZegoToast)({\n content: \"The microphone is \" + (this.micStatus ? \"on\" : \"off\"),\n });\n result &&\n this.setState({\n micOpen: !!this.micStatus,\n }, function () {\n _this.handleLayoutChange(_this.state.userLayoutStatus);\n });\n }\n return [2 /*return*/];\n }\n });\n });\n };\n ZegoRoomMobile.prototype.toggleCamera = function () {\n return __awaiter(this, void 0, void 0, function () {\n var result;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (this.props.core.status.videoRefuse) {\n (0,_components_mobile_zegoConfirm__WEBPACK_IMPORTED_MODULE_7__.ZegoConfirm)({\n title: \"Equipment authorization\",\n content: \"We can't detect your devices. Please check your devices and allow us access your devices in your browser's address bar. Then reload this page and try again.\",\n confirm: \"Okay\",\n });\n return [2 /*return*/];\n }\n if (this.cameraStatus === -1)\n return [2 /*return*/];\n this.cameraStatus = -1;\n if (!(this.state.localStream &&\n this.state.localStream.getVideoTracks().length > 0)) return [3 /*break*/, 2];\n return [4 /*yield*/, this.props.core.mutePublishStreamVideo(this.state.localStream, this.state.cameraOpen)];\n case 1:\n result = _a.sent();\n _a.label = 2;\n case 2:\n this.cameraStatus = !this.state.cameraOpen ? 1 : 0;\n if (result) {\n (0,_components_mobile_zegoToast__WEBPACK_IMPORTED_MODULE_11__.ZegoToast)({\n content: \"The camera is \" + (this.cameraStatus ? \"on\" : \"off\"),\n });\n result &&\n this.setState({\n cameraOpen: !!this.cameraStatus,\n }, function () {\n _this.handleLayoutChange(_this.state.userLayoutStatus);\n });\n }\n return [2 /*return*/];\n }\n });\n });\n };\n ZegoRoomMobile.prototype.switchCamera = function () {\n return __awaiter(this, void 0, void 0, function () {\n var targetModel, targetCameraID;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (this.props.core.status.videoRefuse) {\n (0,_components_mobile_zegoConfirm__WEBPACK_IMPORTED_MODULE_7__.ZegoConfirm)({\n title: \"Equipment authorization\",\n content: \"We can't detect your devices. Please check your devices and allow us access your devices in your browser's address bar. Then reload this page and try again.\",\n confirm: \"Okay\",\n });\n return [2 /*return*/];\n }\n if (!this.state.localStream || this.cameraDevices.length < 2) {\n return [2 /*return*/];\n }\n targetModel = false;\n if (this.faceModel === -1) {\n return [2 /*return*/];\n }\n else if (this.faceModel === 0) {\n targetModel = true;\n }\n this.faceModel = -1;\n if (this.cameraDevices.length < 4) {\n targetCameraID = targetModel\n ? this.cameraDevices[this.cameraDevices.length - 2].deviceID\n : this.cameraDevices[this.cameraDevices.length - 1].deviceID;\n }\n else {\n targetCameraID = targetModel\n ? this.cameraDevices[0].deviceID\n : this.cameraDevices[this.cameraDevices.length - 1].deviceID;\n }\n return [4 /*yield*/, this.props.core.useCameraDevice(this.state.localStream, targetCameraID)];\n case 1:\n _a.sent();\n this.faceModel = targetModel ? 1 : 0;\n this.setState({\n cameraFront: targetModel,\n });\n return [2 /*return*/];\n }\n });\n });\n };\n ZegoRoomMobile.prototype.toggleLayOut = function (layOutStatus) {\n this.setState(function (state) {\n return {\n layOutStatus: state.layOutStatus === layOutStatus ? \"ONE_VIDEO\" : layOutStatus,\n showMore: false,\n };\n });\n };\n ZegoRoomMobile.prototype.sendMessage = function (msg) {\n return __awaiter(this, void 0, void 0, function () {\n var messageID, resp, err_1;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n messageID = (0,_util__WEBPACK_IMPORTED_MODULE_6__.randomNumber)(3);\n this.setState(function (state) {\n return {\n messageList: __spreadArray(__spreadArray([], state.messageList, true), [\n {\n fromUser: {\n userID: _this.props.core._expressConfig.userID,\n userName: _this.props.core._expressConfig.userName,\n },\n message: msg,\n sendTime: Date.now(),\n messageID: messageID,\n status: \"SENDING\",\n },\n ], false),\n };\n });\n resp = {};\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, this.props.core.sendRoomMessage(msg)];\n case 2:\n resp = _a.sent();\n return [3 /*break*/, 4];\n case 3:\n err_1 = _a.sent();\n console.error(\"【ZEGOCLOUD】sendMessage failed!\", JSON.stringify(err_1));\n return [3 /*break*/, 4];\n case 4:\n this.setState(function (state) {\n var _messageList = state.messageList.map(function (msg) {\n if (msg.messageID === messageID) {\n msg.status = resp.errorCode === 0 ? \"SENDED\" : \"FAILED\";\n }\n return msg;\n });\n console.log(_messageList);\n return {\n messageList: _messageList,\n };\n });\n return [2 /*return*/];\n }\n });\n });\n };\n ZegoRoomMobile.prototype.openMore = function () {\n var _this = this;\n this.setState(function (state) {\n return { showMore: !state.showMore };\n }, function () {\n if (_this.state.showMore) {\n // @ts-ignore\n document.addEventListener(\"click\", _this.onblur);\n }\n else {\n // @ts-ignore\n document.removeEventListener(\"click\", _this.onblur);\n }\n });\n };\n ZegoRoomMobile.prototype.leaveRoom = function () {\n var _this = this;\n (0,_components_mobile_zegoConfirm__WEBPACK_IMPORTED_MODULE_7__.ZegoConfirm)({\n title: \"Leave the room\",\n content: \"Are you sure to leave the room?\",\n cancel: \"Cancel\",\n confirm: \"Confirm\",\n closeCallBack: function (confirm) {\n if (confirm) {\n _this.props.core._config.turnOnCameraWhenJoining =\n _this.state.cameraOpen;\n _this.props.core._config.turnOnMicrophoneWhenJoining =\n _this.state.micOpen;\n _this.state.localStream &&\n _this.props.core.destroyStream(_this.state.localStream);\n _this.props.core.leaveRoom();\n _this.props.leaveRoom && _this.props.leaveRoom();\n }\n },\n });\n };\n ZegoRoomMobile.prototype.getAllUser = function () {\n return __spreadArray([\n {\n userID: this.props.core._expressConfig.userID,\n userName: this.props.core._expressConfig.userName,\n pin: this.localUserPin,\n streamList: [\n {\n media: this.state.localStream,\n fromUser: {\n userID: this.props.core._expressConfig.userID,\n userName: this.props.core._expressConfig.userName,\n },\n micStatus: this.state.micOpen ? \"OPEN\" : \"MUTE\",\n cameraStatus: this.state.cameraOpen ? \"OPEN\" : \"MUTE\",\n state: \"PLAYING\",\n streamID: this.localStreamID,\n },\n ],\n }\n ], this.state.zegoCloudUserList, true);\n };\n ZegoRoomMobile.prototype.getAllMemberList = function () {\n return __spreadArray([\n {\n userID: this.props.core._expressConfig.userID,\n userName: this.props.core._expressConfig.userName,\n pin: this.localUserPin,\n streamList: [\n {\n media: this.state.localStream,\n fromUser: {\n userID: this.props.core._expressConfig.userID,\n userName: this.props.core._expressConfig.userName,\n },\n micStatus: this.state.micOpen ? \"OPEN\" : \"MUTE\",\n cameraStatus: this.state.cameraOpen ? \"OPEN\" : \"MUTE\",\n state: \"PLAYING\",\n streamID: this.localStreamID,\n },\n ],\n }\n ], this.state.memberList, true);\n };\n ZegoRoomMobile.prototype.getShownUser = function () {\n var _this = this;\n var shownUser = this.getAllUser().filter(function (item) {\n if (!_this.props.core._config.showNonVideoUser) {\n if (item.streamList && item.streamList[0] && item.streamList[0].media) {\n if (item.streamList[0].cameraStatus === \"OPEN\") {\n return true;\n }\n else if (_this.props.core._config.showOnlyAudioUser &&\n item.streamList[0].micStatus === \"OPEN\") {\n return true;\n }\n else {\n return false;\n }\n }\n else {\n return false;\n }\n }\n else {\n return true;\n }\n });\n return shownUser;\n };\n ZegoRoomMobile.prototype.getHiddenUser = function () {\n var _this = this;\n var hiddenUser = this.getAllUser().filter(function (item) {\n if (!_this.props.core._config.showNonVideoUser &&\n item.streamList &&\n item.streamList[0] &&\n item.streamList[0].media &&\n item.streamList[0].cameraStatus !== \"OPEN\" &&\n !_this.props.core._config.showOnlyAudioUser &&\n item.streamList[0].micStatus === \"OPEN\") {\n return true;\n }\n else {\n return false;\n }\n });\n return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, { children: hiddenUser.map(function (user) {\n return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"audio\", { autoPlay: true, muted: user.userID === _this.props.core._expressConfig.userID, onCanPlay: function (ev) {\n ev.target.play();\n }, ref: function (el) {\n el &&\n el.srcObject !== user.streamList[0].media &&\n (el.srcObject = user.streamList[0].media);\n } }, user.userID + \"_hiddenAudio\"));\n }) }));\n };\n Object.defineProperty(ZegoRoomMobile.prototype, \"showSelf\", {\n get: function () {\n if (this.props.core._config.showNonVideoUser) {\n return true;\n }\n else {\n if (this.props.core._config.showOnlyAudioUser) {\n return (this.localStreamID && (this.state.micOpen || this.state.cameraOpen));\n }\n else {\n return this.localStreamID && this.state.cameraOpen;\n }\n }\n },\n enumerable: false,\n configurable: true\n });\n ZegoRoomMobile.prototype.handleLayoutChange = function (selectLayout) {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n if (selectLayout !== \"Sidebar\") {\n this._selectedUser && (this._selectedUser.pin = false);\n this.localUserPin = false;\n this.props.core.setPin();\n }\n this.setState({\n userLayoutStatus: selectLayout,\n });\n return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n this.userUpdateCallBack = function () {\n resolve(true);\n };\n setTimeout(function () {\n resolve(false);\n }, 5000);\n if (!this.state.screenSharingUserList.length) return [3 /*break*/, 2];\n return [4 /*yield*/, this.props.core.setMaxScreenNum(this.showSelf ? 3 : 4)];\n case 1:\n _a.sent();\n return [3 /*break*/, 6];\n case 2:\n if (!(selectLayout !== \"Sidebar\")) return [3 /*break*/, 4];\n return [4 /*yield*/, this.props.core.setMaxScreenNum(this.showSelf ? 5 : 6)];\n case 3:\n _a.sent();\n return [3 /*break*/, 6];\n case 4: return [4 /*yield*/, this.props.core.setMaxScreenNum(this.showSelf ? 4 : 5)];\n case 5:\n _a.sent();\n _a.label = 6;\n case 6: return [4 /*yield*/, this.props.core.setSidebarLayOut(this.state.screenSharingUserList.length > 0\n ? false\n : selectLayout === \"Sidebar\"\n ? !this.localUserPin\n : false)];\n case 7:\n _a.sent();\n return [2 /*return*/];\n }\n });\n }); })];\n });\n });\n };\n ZegoRoomMobile.prototype.getListScreen = function () {\n var _this = this;\n var pages;\n if (this.state.layOutStatus === \"INVITE\") {\n pages = ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_zegoRoomInvite__WEBPACK_IMPORTED_MODULE_9__.ZegoRoomInvite, { core: this.props.core, closeCallBack: function () {\n _this.setState({\n layOutStatus: \"ONE_VIDEO\",\n });\n } }));\n }\n else if (this.state.layOutStatus === \"USER_LIST\") {\n pages = ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_zegoUserList__WEBPACK_IMPORTED_MODULE_8__.ZegoUserList, { core: this.props.core, userList: this.getAllMemberList(), closeCallBack: function (_user) {\n _user && (_this._selectedUser = _user);\n _this.setState({\n layOutStatus: _user ? \"MANAGE\" : \"ONE_VIDEO\",\n });\n } }));\n }\n else if (this.state.layOutStatus === \"MESSAGE\") {\n pages = ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_zegoMessage__WEBPACK_IMPORTED_MODULE_5__.ZegoMessage, { userID: this.props.core._expressConfig.userID, messageList: this.state.messageList, sendMessage: function (msg) {\n _this.sendMessage(msg);\n }, closeCallBac: function () {\n _this.setState({\n layOutStatus: \"ONE_VIDEO\",\n });\n } }));\n }\n else if (this.state.layOutStatus === \"LAYOUT\") {\n pages = ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_zegoLayout__WEBPACK_IMPORTED_MODULE_12__.ZegoLayout, { selectLayout: this.state.userLayoutStatus, closeCallBac: function () {\n _this.setState({\n layOutStatus: \"ONE_VIDEO\",\n });\n }, selectCallBack: this.handleLayoutChange.bind(this) }));\n }\n else if (this.state.layOutStatus === \"MANAGE\") {\n pages = ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_zegoManage__WEBPACK_IMPORTED_MODULE_13__.ZegoManage, { closeCallBac: function () {\n _this.setState({\n layOutStatus: \"ONE_VIDEO\",\n });\n }, selectCallBac: function (type, value) {\n if (type === \"Pin\" && typeof value != \"undefined\") {\n if (_this._selectedUser.userID !==\n _this.props.core._expressConfig.userID) {\n _this.props.core.setPin(_this._selectedUser.userID, value);\n _this.localUserPin = false;\n }\n else {\n _this.localUserPin = value;\n _this._selectedUser.pin = value;\n _this.props.core.setPin();\n }\n _this.setState({\n userLayoutStatus: \"Sidebar\",\n });\n _this.props.core.setSidebarLayOut(_this.state.screenSharingUserList.length > 0\n ? false\n : !_this.localUserPin);\n }\n }, selectedUser: this._selectedUser }));\n }\n if (pages) {\n return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].mask }, { children: pages }));\n }\n };\n ZegoRoomMobile.prototype.getLayoutScreen = function () {\n var _this = this;\n var _a, _b, _c, _d, _e;\n if (((_a = this.props.core._config.scenario) === null || _a === void 0 ? void 0 : _a.mode) === _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.LiveStreaming &&\n ((_c = (_b = this.props.core._config.scenario) === null || _b === void 0 ? void 0 : _b.config) === null || _c === void 0 ? void 0 : _c.role) === _model__WEBPACK_IMPORTED_MODULE_2__.LiveRole.Audience &&\n this.state.liveStatus != 1) {\n return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: \"\".concat(_index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].liveNotStart, \" zegoUserVideo_click\") }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"i\", {}), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", { children: \"The Live has not started yet\" })] })));\n }\n else if (!__spreadArray(__spreadArray([], this.getAllUser(), true), this.state.screenSharingUserList, true).some(function (u) {\n if (u.streamList) {\n return u.streamList.some(function (s) {\n return s.cameraStatus === \"OPEN\" || s.micStatus === \"OPEN\";\n });\n }\n return false;\n })) {\n return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: \"\".concat(_index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].noOneStreaming, \" zegoUserVideo_click\") }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"i\", {}), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", { children: \"No one has turned on the camera or microphone yet.\" })] })));\n }\n if (this.state.screenSharingUserList.length > 0) {\n return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].screenTopBar }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", __assign({ style: {\n color: (0,_util__WEBPACK_IMPORTED_MODULE_6__.userNameColor)(this.state.screenSharingUserList[0].userName),\n } }, { children: (_e = (_d = this.state.screenSharingUserList[0].userName) === null || _d === void 0 ? void 0 : _d.slice(0, 1)) === null || _e === void 0 ? void 0 : _e.toUpperCase() })), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"p\", { children: this.state.screenSharingUserList[0].userName + \" is presenting\" })] })), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_zegoScreen__WEBPACK_IMPORTED_MODULE_18__.ZegoScreen, { selfInfo: {\n userID: this.props.core._expressConfig.userID,\n }, userList: this.getShownUser(), screenSharingUser: this.state.screenSharingUserList[0], videoShowNumber: 5, soundLevel: this.state.soundLevel })] }));\n }\n if ((this.state.userLayoutStatus === \"Auto\" &&\n this.getShownUser().length < 3) ||\n this.getShownUser().length < 2) {\n return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_zegoOne2One__WEBPACK_IMPORTED_MODULE_4__.ZegoOne2One, { selfInfo: {\n userID: this.props.core._expressConfig.userID,\n }, userList: this.getShownUser(), soundLevel: this.state.soundLevel, onLocalStreamPaused: function () { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n console.warn(\"onLocalStreamPaused\");\n return [4 /*yield*/, this.props.core.enableVideoCaptureDevice(this.state.localStream, !this.state.cameraOpen)];\n case 1:\n _a.sent();\n this.props.core.enableVideoCaptureDevice(this.state.localStream, this.state.cameraOpen);\n return [2 /*return*/];\n }\n });\n }); } }));\n }\n else if ((this.state.userLayoutStatus === \"Grid\" &&\n this.getShownUser().length > 1) ||\n (this.state.userLayoutStatus === \"Auto\" && this.getShownUser().length > 2)) {\n return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_zegoGrid__WEBPACK_IMPORTED_MODULE_14__.ZegoGrid, { selfInfo: {\n userID: this.props.core._expressConfig.userID,\n }, userList: this.getShownUser(), videoShowNumber: 6, soundLevel: this.state.soundLevel }));\n }\n else if (this.state.userLayoutStatus === \"Sidebar\" &&\n this.getShownUser().length > 1) {\n return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_zegoSidebar__WEBPACK_IMPORTED_MODULE_15__.ZegoSidebar, { selfInfo: {\n userID: this.props.core._expressConfig.userID,\n }, userList: this.getShownUser(), videoShowNumber: 5, soundLevel: this.state.soundLevel }));\n }\n };\n ZegoRoomMobile.prototype.clickVideo = function (e) {\n var _this = this;\n // @ts-ignore\n var className = e.target.className;\n if (className.includes(\"zegoUserVideo_videoCommon\") ||\n className.includes(\"zegoMore_more\") ||\n className.includes(\"ZegoRoomMobile_ZegoRoom\") ||\n className.includes(\"zegoUserVideo_click\")) {\n if (!this.state.showFooter) {\n this.setState({ showFooter: true });\n }\n else {\n if (this.state.layOutStatus != \"ONE_VIDEO\") {\n this.setState({\n layOutStatus: \"ONE_VIDEO\",\n });\n clearTimeout(this.footerTimer);\n this.footerTimer = setTimeout(function () {\n _this.setState({ showFooter: false, showMore: false });\n }, 5000);\n }\n else {\n this.setState({ showFooter: false, showMore: false });\n }\n }\n e.stopPropagation();\n }\n else {\n clearTimeout(this.footerTimer);\n this.footerTimer = setTimeout(function () {\n _this.setState({ showFooter: false, showMore: false });\n }, 5000);\n }\n };\n ZegoRoomMobile.prototype.setLive = function () {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n if (this.state.liveCountdown === 0) {\n (0,_components_zegoModel__WEBPACK_IMPORTED_MODULE_17__.ZegoModelShow)({\n header: \"Stop broadcast\",\n contentText: \"Are you sure to stop broadcasting?\",\n okText: \"Stop\",\n cancelText: \"Cancel\",\n onOk: function () { return __awaiter(_this, void 0, void 0, function () {\n var res;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.props.core.setLive(\"stop\")];\n case 1:\n res = _a.sent();\n this.setState({\n liveCountdown: -1,\n });\n return [2 /*return*/];\n }\n });\n }); },\n });\n }\n else if (this.state.liveCountdown === -1) {\n this.setState({\n liveCountdown: 3,\n }, function () {\n setTimeout(function () {\n _this.liveCountdownTimer();\n }, 1000);\n });\n }\n return [2 /*return*/];\n });\n });\n };\n ZegoRoomMobile.prototype.liveCountdownTimer = function () {\n var _this = this;\n this.setState(function (preState) {\n return {\n liveCountdown: preState.liveCountdown - 1,\n };\n }, function () { return __awaiter(_this, void 0, void 0, function () {\n var res;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!(this.state.liveCountdown === 0)) return [3 /*break*/, 2];\n return [4 /*yield*/, this.props.core.setLive(\"live\")];\n case 1:\n res = _a.sent();\n return [3 /*break*/, 3];\n case 2:\n setTimeout(function () {\n _this.liveCountdownTimer();\n }, 1000);\n _a.label = 3;\n case 3: return [2 /*return*/];\n }\n });\n }); });\n };\n ZegoRoomMobile.prototype.render = function () {\n var _this = this;\n var _a, _b, _c, _d, _e, _f, _g;\n var startIndex = this.state.notificationList.length < 4\n ? 0\n : this.state.notificationList.length - 2;\n return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_context_showManage__WEBPACK_IMPORTED_MODULE_16__[\"default\"].Provider, __assign({ value: {\n show: function (_user) {\n _user && (_this._selectedUser = _user);\n _this.setState({\n layOutStatus: _user ? \"MANAGE\" : \"ONE_VIDEO\",\n });\n },\n showPinButton: !!this.props.core._config.showPinButton,\n userInfo: { userID: this.props.core._expressConfig.userID },\n } }, { children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: \"\".concat(_index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].ZegoRoom, \" ZegoRoomMobile_ZegoRoom\"), onClick: function (e) {\n // @ts-ignore\n _this.clickVideo(e);\n } }, { children: [this.getLayoutScreen(), this.state.isNetworkPoor && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", { className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].network })), (this.state.showFooter || false) && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].footer }, { children: [this.props.core._config.showMyCameraToggleButton &&\n ((_a = this.props.core._config.scenario) === null || _a === void 0 ? void 0 : _a.mode) !==\n _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.LiveStreaming && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"a\", { className: \"\".concat(_index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].switchCamera, \" \").concat(this.state.cameraFront ? \"\" : _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].switchCameraBack), onClick: function () {\n _this.switchCamera();\n } })), this.props.core._config.showMyCameraToggleButton && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"a\", { className: this.state.cameraOpen\n ? _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].toggleCamera\n : _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].cameraClose, onClick: function () {\n _this.toggleCamera();\n } })), this.props.core._config.showMyMicrophoneToggleButton && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"a\", { className: this.state.micOpen\n ? _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].toggleMic\n : _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].micClose, onClick: function () {\n _this.toggleMic();\n } })), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"a\", { className: ((_b = this.props.core._config.scenario) === null || _b === void 0 ? void 0 : _b.mode) ===\n _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.LiveStreaming\n ? _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].liveLeaveButton\n : _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].leaveRoom, onClick: function () {\n _this.leaveRoom();\n } }), (this.props.core._config.showTextChat ||\n this.props.core._config.showUserList ||\n this.props.core._config.sharedLinks) && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"a\", __assign({ id: \"ZegoRoomCssMobileMore\", className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].more, onClick: function () {\n _this.openMore();\n } }, { children: [(this.state.showMore || false) && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", __assign({ id: \"ZegoRoomCssMobilePopMore\", className: \"\".concat(_index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].popMore, \" \").concat(_index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].popLiveMore) }, { children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].popMoreContent }, { children: [this.props.core._config.showMyCameraToggleButton &&\n ((_c = this.props.core._config.scenario) === null || _c === void 0 ? void 0 : _c.mode) ===\n _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.LiveStreaming && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: \"\".concat(_index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].switchCamera, \" zegoUserVideo_click\"), onClick: function () {\n _this.switchCamera();\n } }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"i\", { className: \"\".concat(_index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].switchCamera, \" zegoUserVideo_click\") }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", { children: \"Flip\" })] }))), ((_d = this.props.core._config.preJoinViewConfig) === null || _d === void 0 ? void 0 : _d.invitationLink) && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].roomDetail, onClick: function (ev) {\n ev.stopPropagation();\n _this.toggleLayOut(\"INVITE\");\n } }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"i\", { className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].details }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", { children: \"Room details\" })] }))), this.props.core._config.showUserList && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ onClick: function (ev) {\n ev.stopPropagation();\n _this.toggleLayOut(\"USER_LIST\");\n } }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"i\", { className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].member }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", { children: \"Member\" })] }))), this.props.core._config.showTextChat && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ onClick: function (ev) {\n ev.stopPropagation();\n _this.toggleLayOut(\"MESSAGE\");\n } }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"i\", { className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].chat }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", { children: \"Chat\" })] }))), this.props.core._config.showLayoutButton && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ onClick: function (ev) {\n ev.stopPropagation();\n _this.toggleLayOut(\"LAYOUT\");\n } }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"i\", { className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layout }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", { children: \"Layout\" })] })))] })) }))), (this.state.showMore || false) && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", { className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].popMoreArray }))] }))), ((_e = this.props.core._config.scenario) === null || _e === void 0 ? void 0 : _e.mode) ===\n _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.LiveStreaming &&\n ((_f = this.props.core._config.scenario.config) === null || _f === void 0 ? void 0 : _f.role) ===\n _model__WEBPACK_IMPORTED_MODULE_2__.LiveRole.Host && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"a\", __assign({ className: \"\".concat(_index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].goLive, \" \").concat(this.state.liveCountdown === 0\n ? _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].goLiveEnabled\n : \"\"), onClick: function () {\n _this.setLive();\n } }, { children: this.state.liveCountdown === 3 ||\n this.state.liveCountdown === -1\n ? \"Go Live\"\n : this.state.liveCountdown === 0\n ? \"Stop\"\n : \"Go Live\" })))] }))), this.getListScreen(), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, { children: this.getHiddenUser() }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].notify }, { children: this.state.notificationList.slice(startIndex).map(function (notify) {\n if (notify.type === \"MSG\") {\n return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].notifyContent }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"h5\", { children: notify.userName }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", { children: notify.content })] }), notify.content));\n }\n else {\n return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].notifyContent }, { children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", { children: notify.content }) }), notify.content));\n }\n }) })), this.state.liveCountdown > 0 && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].countDown }, { children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", { children: this.state.liveCountdown }) }))), (this.state.connecting || false) && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_ZegoReconnect__WEBPACK_IMPORTED_MODULE_10__.ZegoReconnect, { content: this.state.firstLoading || false\n ? \"Joining Room\"\n : \"Trying to reconnect...\" })), ((_g = this.props.core._config.scenario) === null || _g === void 0 ? void 0 : _g.mode) ===\n _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.LiveStreaming &&\n (this.state.liveCountdown === 0 || this.state.liveStatus == 1) && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"button\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].LiveStateButton }, { children: \"Live\" })))] })) })));\n };\n ZegoRoomMobile.contextType = _context_showManage__WEBPACK_IMPORTED_MODULE_16__[\"default\"];\n return ZegoRoomMobile;\n}((react__WEBPACK_IMPORTED_MODULE_1___default().PureComponent)));\n\n\n\n//# sourceURL=webpack://zegocloud_client_sdk_web/./src/sdk/view/pages/ZegoRoomMobile/index.tsx?");
2032
2032
 
2033
2033
  /***/ }),
2034
2034
 
package/index.html DELETED
@@ -1,119 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
-
4
- <head>
5
- <meta charset="utf-8" />
6
-
7
- <meta name="viewport" content="width=device-width, initial-scale=1" />
8
- <meta name="theme-color" content="#000000" />
9
- <meta name="description" content="Web site created using create-react-app" />
10
-
11
-
12
- <!--
13
- Notice the use of %PUBLIC_URL% in the tags above.
14
- It will be replaced with the URL of the `public` folder during the build.
15
- Only files inside the `public` folder can be referenced from the HTML.
16
-
17
- Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
18
- work correctly both with client-side routing and a non-root public URL.
19
- Learn how to configure a non-root public URL by running `npm run build`.
20
- -->
21
- <title>ZEGOCLOUD video call Demo(prebuilt)</title>
22
- <style>
23
- #root {
24
- width: 100vw;
25
- height: 100vh;
26
-
27
- }
28
-
29
- @font-face {
30
- font-family: Emoji;
31
- src: local("Apple Color Emoji"), local("Segoe UI Emoji"),
32
- local("Segoe UI Symbol"), local("Noto Color Emoji");
33
- }
34
-
35
- body {
36
- margin: 0;
37
- font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system,
38
- "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans",
39
- "Droid Sans", "Helvetica Neue", sans-serif, Arial, Emoji;
40
- -webkit-font-smoothing: antialiased;
41
- -moz-osx-font-smoothing: grayscale;
42
- }
43
-
44
- code {
45
- font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
46
- monospace;
47
- }
48
- </style>
49
- </head>
50
-
51
- <body>
52
- <noscript>You need to enable JavaScript to run this app.</noscript>
53
- <div id="root"></div>
54
- <!--
55
- This HTML file is a template.
56
- If you open it directly in the browser, you will see an empty page.
57
-
58
- You can add webfonts, meta tags, or analytics to this file.
59
- The build step will place the bundled scripts into the <body> tag.
60
-
61
- To begin the development, run `npm start` or `yarn start`.
62
- To create a production bundle, use `npm run build` or `yarn build`.
63
- -->
64
- </body>
65
- <script src="./zego-uikit-prebuilt.js"></script>
66
- <script>
67
- // get token
68
- function generateToken(tokenServerUrl, userID, roomID, userName) {
69
- // Obtain the token interface provided by the App Server
70
- return fetch(
71
- `${tokenServerUrl}/access_token?userID=${userID}&userName=${userName}&roomID=${roomID}&expired_ts=7200`, {
72
- method: 'GET',
73
- }
74
- ).then((res) => res.json());
75
- }
76
-
77
- function randomID(len) {
78
- let result = '';
79
- if (result) return result;
80
- var chars = '12345qwertyuiopasdfgh67890jklmnbvcxzMNBVCZXASDQWERTYHGFUIOLKJP',
81
- maxPos = chars.length,
82
- i;
83
- len = len || 5;
84
- for (i = 0; i < len; i++) {
85
- result += chars.charAt(Math.floor(Math.random() * maxPos));
86
- }
87
- return result;
88
- }
89
-
90
- function getUrlParams(url) {
91
- let urlStr = url.split('?')[1];
92
- const urlSearchParams = new URLSearchParams(urlStr);
93
- const result = Object.fromEntries(urlSearchParams.entries());
94
- return result;
95
- }
96
-
97
- async function init() {
98
- const roomID = getUrlParams(window.location.href)['roomID'] || randomID(5);
99
- const {
100
- token
101
- } = await generateToken(
102
- 'https://choui-prebuilt.herokuapp.com',
103
- randomID(5),
104
- roomID,
105
- randomID(5)
106
- );
107
- const zp = ZegoUIKitPrebuilt.create(token);
108
- zp.joinRoom({
109
- container: document.querySelector("#root"),
110
- preJoinViewConfig: {
111
- invitationLink: window.location.origin + window.location.pathname + '?roomID=' + roomID,
112
- },
113
- });
114
- }
115
-
116
- window.onload = init;
117
- </script>
118
-
119
- </html>