@zegocloud/zego-uikit-prebuilt 1.3.3 → 1.3.4
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/package.json +1 -1
- package/zego-uikit-prebuilt.js +1 -1
package/package.json
CHANGED
package/zego-uikit-prebuilt.js
CHANGED
|
@@ -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, _a, _b;\n var _this = this;\n return __generator(this, function (_c) {\n switch (_c.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 = _c.sent();\n if (!(logInRsp === 0)) return [3 /*break*/, 4];\n this.createStream();\n _a = this.props.core._config.showMyCameraToggleButton;\n if (!_a) return [3 /*break*/, 3];\n _b = this;\n return [4 /*yield*/, this.props.core.getCameras()];\n case 2:\n _a = (_b.cameraDevices = _c.sent());\n _c.label = 3;\n case 3:\n _a;\n _c.label = 4;\n case 4: 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().Component)));\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 _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().Component)));\n\n\n\n//# sourceURL=webpack://zegocloud_client_sdk_web/./src/sdk/view/pages/ZegoRoomMobile/index.tsx?");
|
|
2032
2032
|
|
|
2033
2033
|
/***/ }),
|
|
2034
2034
|
|