@zegocloud/zego-uikit-prebuilt 1.3.0 → 1.3.2
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 +2 -2
package/package.json
CHANGED
package/zego-uikit-prebuilt.js
CHANGED
|
@@ -1445,7 +1445,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
1445
1445
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1446
1446
|
|
|
1447
1447
|
"use strict";
|
|
1448
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ZegoCloudRTCCore\": function() { return /* binding */ ZegoCloudRTCCore; }\n/* harmony export */ });\n/* harmony import */ var _tools_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./tools/util */ \"./src/sdk/modules/tools/util.ts\");\n/* harmony import */ var zego_express_engine_webrtc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! zego-express-engine-webrtc */ \"./node_modules/zego-express-engine-webrtc/ZegoExpressWebRTC.js\");\n/* harmony import */ var zego_express_engine_webrtc__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(zego_express_engine_webrtc__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _model__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../model */ \"./src/sdk/model/index.ts\");\n/* harmony import */ var _tools_UserListManager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./tools/UserListManager */ \"./src/sdk/modules/tools/UserListManager.ts\");\nvar __assign = (undefined && undefined.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\n\n\n\n\nvar ZegoCloudRTCCore = /** @class */ (function () {\n function ZegoCloudRTCCore() {\n var _this = this;\n this.status = {\n loginRsp: false,\n videoRefuse: false,\n audioRefuse: false,\n };\n this.remoteStreamMap = {};\n this._config = {\n // @ts-ignore\n container: undefined,\n preJoinViewConfig: {\n title: \"Join Room\",\n invitationLink: window.location.href, // 邀请链接,空则不显示,默认空\n },\n showPreJoinView: true,\n turnOnMicrophoneWhenJoining: true,\n turnOnCameraWhenJoining: true,\n showMyCameraToggleButton: true,\n showMyMicrophoneToggleButton: true,\n showAudioVideoSettingsButton: true,\n showTextChat: true,\n showUserList: true,\n lowerLeftNotification: {\n showUserJoinAndLeave: true,\n showTextChat: true, // 是否显示未读消息,默认显示\n },\n branding: {\n logoURL: \"\",\n },\n showLeavingView: true,\n maxUsers: 2,\n layout: \"Auto\",\n showNonVideoUser: true,\n showOnlyAudioUser: false,\n useFrontFacingCamera: true,\n onJoinRoom: function () { },\n onLeaveRoom: function () { },\n onUserJoin: function (user) { },\n onUserLeave: function (user) { },\n sharedLinks: [],\n showScreenSharingButton: true,\n scenario: {\n mode: _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.OneONoneCall,\n config: { role: _model__WEBPACK_IMPORTED_MODULE_2__.LiveRole.Host }, // 对应场景专有配置\n },\n facingMode: \"user\",\n joinRoomCallback: function () { },\n leaveRoomCallback: function () { },\n userUpdateCallback: function () { },\n showLayoutButton: true,\n showPinButton: true, // 是否显pin按钮\n };\n this.extraInfoKey = \"extra_info\";\n this._roomExtraInfo = {\n live_status: {\n v: 0,\n u: \"xxx\",\n r: 0,\n },\n };\n this.onRemoteMediaUpdateCallBack = function (updateType, streamList) {\n _this.zum.mainStreamUpdate(updateType, streamList);\n _this.zum.screenStreamUpdate(updateType, streamList);\n _this.subscribeUserListCallBack &&\n _this.subscribeUserListCallBack(__spreadArray([], _this.zum.remoteUserList, true));\n _this.subscribeScreenStreamCallBack &&\n _this.subscribeScreenStreamCallBack(__spreadArray([], _this.zum.remoteScreenStreamList, true));\n };\n this.NetworkStatusTimer = null;\n }\n // static _soundMeter: SoundMeter;\n ZegoCloudRTCCore.getInstance = function (token) {\n var config = (0,_tools_util__WEBPACK_IMPORTED_MODULE_0__.getConfig)(token);\n if (!ZegoCloudRTCCore._instance && config) {\n ZegoCloudRTCCore._instance = new ZegoCloudRTCCore();\n ZegoCloudRTCCore._instance._expressConfig = config;\n // ZegoCloudRTCCore._soundMeter = new SoundMeter();\n ZegoCloudRTCCore._zg = new zego_express_engine_webrtc__WEBPACK_IMPORTED_MODULE_1__.ZegoExpressEngine(ZegoCloudRTCCore._instance._expressConfig.appID, \"wss://webliveroom\" +\n ZegoCloudRTCCore._instance._expressConfig.appID +\n \"-api.zegocloud.com/ws\");\n ZegoCloudRTCCore._instance.zum = new _tools_UserListManager__WEBPACK_IMPORTED_MODULE_3__.ZegoCloudUserListManager(ZegoCloudRTCCore._zg);\n }\n return ZegoCloudRTCCore._instance;\n };\n ZegoCloudRTCCore.prototype.checkWebRTC = function () {\n return __awaiter(this, void 0, void 0, function () {\n var result;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, ZegoCloudRTCCore._zg.checkSystemRequirements(\"webRTC\")];\n case 1:\n result = _a.sent();\n return [2 /*return*/, !!result.result];\n }\n });\n });\n };\n ZegoCloudRTCCore.prototype.setConfig = function (config) {\n var _a, _b, _c, _d;\n if (config.scenario &&\n config.scenario.mode === _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.LiveStreaming) {\n if (config.showNonVideoUser === true) {\n console.error(\"【ZEGOCLOUD】 showNonVideoUser have be false scenario.mode is LiveStreaming!!\");\n return false;\n }\n config.showNonVideoUser = false;\n config.showOnlyAudioUser = true;\n if (config.scenario.config &&\n config.scenario.config.role === _model__WEBPACK_IMPORTED_MODULE_2__.LiveRole.Host) {\n if (config.turnOnMicrophoneWhenJoining === false &&\n config.turnOnCameraWhenJoining === false &&\n config.showMyCameraToggleButton === false &&\n config.showAudioVideoSettingsButton === false) {\n console.error(\"【ZEGOCLOUD】 Host could turn on at least one of the camera and the microphone!!\");\n return false;\n }\n }\n else if (config.scenario.config &&\n config.scenario.config.role === _model__WEBPACK_IMPORTED_MODULE_2__.LiveRole.Audience) {\n if (config.turnOnMicrophoneWhenJoining === true ||\n config.turnOnCameraWhenJoining === true ||\n config.showMyCameraToggleButton === true ||\n config.showMyMicrophoneToggleButton === true ||\n config.showAudioVideoSettingsButton === true ||\n config.showScreenSharingButton === true ||\n config.useFrontFacingCamera === true ||\n (!!config.layout && config.layout !== \"Grid\")) {\n console.error(\"【ZEGOCLOUD】 Audience cannot configure camera and microphone related params\");\n return false;\n }\n }\n if (!config.maxUsers) {\n config.maxUsers = 50;\n }\n if (config.scenario.config &&\n config.scenario.config.role === _model__WEBPACK_IMPORTED_MODULE_2__.LiveRole.Audience) {\n config.turnOnMicrophoneWhenJoining = false;\n config.turnOnCameraWhenJoining = false;\n config.showMyCameraToggleButton = false;\n config.showMyMicrophoneToggleButton = false;\n config.showAudioVideoSettingsButton = false;\n config.showScreenSharingButton = false;\n config.useFrontFacingCamera = false;\n config.useFrontFacingCamera = false;\n config.showUserList = false;\n config.showPinButton = false;\n config.showLayoutButton = false;\n config.layout = \"Grid\";\n config.lowerLeftNotification = {\n showTextChat: false,\n showUserJoinAndLeave: false,\n };\n }\n }\n if (config.scenario &&\n config.scenario.mode === _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.OneONoneCall) {\n if (!config.maxUsers) {\n config.maxUsers = 2;\n }\n config.showLayoutButton = false;\n config.showPinButton = false;\n }\n config.facingMode &&\n (config.useFrontFacingCamera = config.facingMode === \"user\");\n config.joinRoomCallback && (config.onJoinRoom = config.joinRoomCallback);\n config.leaveRoomCallback && (config.onLeaveRoom = config.leaveRoomCallback);\n if (config.userUpdateCallback) {\n config.onJoinRoom = function (users) {\n config.userUpdateCallback && config.userUpdateCallback(\"ADD\", users);\n };\n config.onLeaveRoom = function (users) {\n config.userUpdateCallback && config.userUpdateCallback(\"DELETE\", users);\n };\n }\n if (config.preJoinViewConfig && config.preJoinViewConfig.invitationLink) {\n config.sharedLinks = [\n {\n name: \"Share the link\",\n url: config.preJoinViewConfig.invitationLink,\n },\n ];\n }\n config.preJoinViewConfig &&\n (config.preJoinViewConfig = __assign(__assign({}, this._config.preJoinViewConfig), config.preJoinViewConfig));\n config.scenario &&\n config.scenario.config &&\n (config.scenario.config = __assign(__assign({}, (_a = this._config.scenario) === null || _a === void 0 ? void 0 : _a.config), config.scenario.config));\n this._config = __assign(__assign({}, this._config), config);\n this.zum.scenario =\n ((_b = this._config.scenario) === null || _b === void 0 ? void 0 : _b.mode) || _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.OneONoneCall;\n this.zum.role = ((_d = (_c = this._config.scenario) === null || _c === void 0 ? void 0 : _c.config) === null || _d === void 0 ? void 0 : _d.role) || _model__WEBPACK_IMPORTED_MODULE_2__.LiveRole.Host;\n this.zum.showOnlyAudioUser = !!this._config.showOnlyAudioUser;\n this.zum.setShowNonVideo(!!this._config.showNonVideoUser);\n return true;\n };\n ZegoCloudRTCCore.prototype.setPin = function (userID, pined) {\n this.zum.setPin(userID, pined);\n this.subscribeUserListCallBack &&\n this.subscribeUserListCallBack(__spreadArray([], this.zum.remoteUserList, true));\n };\n ZegoCloudRTCCore.prototype.setMaxScreenNum = function (num) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.zum.setMaxScreenNum(num)];\n case 1:\n _a.sent();\n this.subscribeUserListCallBack &&\n this.subscribeUserListCallBack(__spreadArray([], this.zum.remoteUserList, true));\n return [2 /*return*/];\n }\n });\n });\n };\n ZegoCloudRTCCore.prototype.setSidebarLayOut = function (enable) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.zum.setSidebarLayOut(enable)];\n case 1:\n _a.sent();\n this.subscribeUserListCallBack &&\n this.subscribeUserListCallBack(__spreadArray([], this.zum.remoteUserList, true));\n return [2 /*return*/];\n }\n });\n });\n };\n ZegoCloudRTCCore.prototype.setShowNonVideo = function (enable) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.zum.setShowNonVideo(enable)];\n case 1:\n _a.sent();\n this.subscribeUserListCallBack &&\n this.subscribeUserListCallBack(__spreadArray([], this.zum.remoteUserList, true));\n return [2 /*return*/];\n }\n });\n });\n };\n ZegoCloudRTCCore.prototype.getCameras = function () {\n return ZegoCloudRTCCore._zg.getCameras();\n };\n ZegoCloudRTCCore.prototype.useVideoDevice = function (localStream, deviceID) {\n return ZegoCloudRTCCore._zg.useVideoDevice(localStream, deviceID);\n };\n ZegoCloudRTCCore.prototype.getMicrophones = function () {\n return ZegoCloudRTCCore._zg.getMicrophones();\n };\n ZegoCloudRTCCore.prototype.getSpeakers = function () {\n return ZegoCloudRTCCore._zg.getSpeakers();\n };\n ZegoCloudRTCCore.prototype.setVolume = function (media, volume) {\n media.volume = volume;\n };\n ZegoCloudRTCCore.prototype.createStream = function (source) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, ZegoCloudRTCCore._zg.createStream(source)];\n });\n });\n };\n ZegoCloudRTCCore.prototype.setVideoConfig = function (media, constraints) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, ZegoCloudRTCCore._zg.setVideoConfig(media, constraints)];\n });\n });\n };\n ZegoCloudRTCCore.prototype.stopPublishingStream = function (streamID) {\n return ZegoCloudRTCCore._zg.stopPublishingStream(streamID);\n };\n ZegoCloudRTCCore.prototype.destroyStream = function (stream) {\n ZegoCloudRTCCore._zg.destroyStream(stream);\n };\n ZegoCloudRTCCore.prototype.useCameraDevice = function (media, deviceID) {\n return ZegoCloudRTCCore._zg.useVideoDevice(media, deviceID);\n };\n ZegoCloudRTCCore.prototype.useMicrophoneDevice = function (media, deviceID) {\n return ZegoCloudRTCCore._zg.useAudioDevice(media, deviceID);\n };\n ZegoCloudRTCCore.prototype.useSpeakerDevice = function (media, deviceID) {\n return __awaiter(this, void 0, void 0, function () {\n var res, error_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!media.srcObject) {\n return [2 /*return*/, Promise.resolve({ errorCode: -1 })];\n }\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, ZegoCloudRTCCore._zg.useAudioOutputDevice(media, deviceID)];\n case 2:\n res = _a.sent();\n return [2 /*return*/, { errorCode: res ? 0 : -1 }];\n case 3:\n error_1 = _a.sent();\n return [2 /*return*/, { errorCode: -1 }];\n case 4: return [2 /*return*/];\n }\n });\n });\n };\n ZegoCloudRTCCore.prototype.enableVideoCaptureDevice = function (localStream, enable) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, ZegoCloudRTCCore._zg.enableVideoCaptureDevice(localStream, enable)];\n });\n });\n };\n ZegoCloudRTCCore.prototype.mutePublishStreamVideo = function (localStream, enable) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, ZegoCloudRTCCore._zg.mutePublishStreamVideo(localStream, enable)];\n });\n });\n };\n ZegoCloudRTCCore.prototype.mutePublishStreamAudio = function (localStream, enable) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, ZegoCloudRTCCore._zg.mutePublishStreamAudio(localStream, enable)];\n });\n });\n };\n ZegoCloudRTCCore.prototype.muteMicrophone = function (enable) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, ZegoCloudRTCCore._zg.muteMicrophone(enable)];\n });\n });\n };\n Object.defineProperty(ZegoCloudRTCCore.prototype, \"roomExtraInfo\", {\n get: function () {\n return this._roomExtraInfo;\n },\n set: function (value) {\n this._roomExtraInfo = value;\n this.zum.setLiveStates(this._roomExtraInfo.live_status.v);\n this.onRoomLiveStateUpdateCallBack &&\n this.onRoomLiveStateUpdateCallBack(this._roomExtraInfo.live_status.v);\n },\n enumerable: false,\n configurable: true\n });\n ZegoCloudRTCCore.prototype.setLive = function (status) {\n var _a, _b, _c, _d;\n return __awaiter(this, void 0, void 0, function () {\n var setRoomExtraInfo, res;\n return __generator(this, function (_e) {\n switch (_e.label) {\n case 0:\n setRoomExtraInfo = __assign(__assign({}, this._roomExtraInfo), {\n live_status: {\n v: status === \"live\" ? 1 : 0,\n u: ZegoCloudRTCCore._instance._expressConfig.userID,\n r: ((_b = (_a = ZegoCloudRTCCore._instance._config.scenario) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.role) ===\n _model__WEBPACK_IMPORTED_MODULE_2__.LiveRole.Host\n ? 1\n : ((_d = (_c = ZegoCloudRTCCore._instance._config.scenario) === null || _c === void 0 ? void 0 : _c.config) === null || _d === void 0 ? void 0 : _d.role) ===\n _model__WEBPACK_IMPORTED_MODULE_2__.LiveRole.Audience\n ? 2\n : 3,\n },\n });\n return [4 /*yield*/, ZegoCloudRTCCore._zg.setRoomExtraInfo(ZegoCloudRTCCore._instance._expressConfig.roomID, \"extra_info\", JSON.stringify(setRoomExtraInfo))];\n case 1:\n res = _e.sent();\n res.errorCode === 0 && (this.roomExtraInfo = setRoomExtraInfo);\n return [2 /*return*/, res.errorCode === 0];\n }\n });\n });\n };\n ZegoCloudRTCCore.prototype.enterRoom = function () {\n return __awaiter(this, void 0, void 0, function () {\n var resp;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n // 已经登陆过不再登录\n if (this.status.loginRsp)\n return [2 /*return*/, Promise.resolve(0)];\n ZegoCloudRTCCore._zg.off(\"roomExtraInfoUpdate\");\n ZegoCloudRTCCore._zg.off(\"roomStreamUpdate\");\n ZegoCloudRTCCore._zg.off(\"remoteCameraStatusUpdate\");\n ZegoCloudRTCCore._zg.off(\"remoteMicStatusUpdate\");\n ZegoCloudRTCCore._zg.off(\"playerStateUpdate\");\n ZegoCloudRTCCore._zg.off(\"roomUserUpdate\");\n ZegoCloudRTCCore._zg.off(\"IMRecvBroadcastMessage\");\n ZegoCloudRTCCore._zg.off(\"roomStateUpdate\");\n ZegoCloudRTCCore._zg.off(\"publisherStateUpdate\");\n ZegoCloudRTCCore._zg.off(\"publishQualityUpdate\");\n ZegoCloudRTCCore._zg.off(\"soundLevelUpdate\");\n ZegoCloudRTCCore._zg.on(\"roomStreamUpdate\", function (roomID, updateType, streamList, extendedData) { return __awaiter(_this, void 0, void 0, function () {\n var _streamList, i, streamInfo, stream, error_2, _streamList, i, streamInfo;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!(updateType === \"ADD\")) return [3 /*break*/, 7];\n _streamList = [];\n i = 0;\n _a.label = 1;\n case 1:\n if (!(i < streamList.length)) return [3 /*break*/, 6];\n streamInfo = streamList[i];\n _a.label = 2;\n case 2:\n _a.trys.push([2, 4, , 5]);\n return [4 /*yield*/, this.zum.startPullStream(streamInfo.user.userID, streamInfo.streamID)];\n case 3:\n stream = _a.sent();\n this.remoteStreamMap[streamInfo.streamID] = {\n fromUser: streamInfo.user,\n media: stream,\n micStatus: stream && stream.getAudioTracks().length > 0\n ? \"OPEN\"\n : \"MUTE\",\n cameraStatus: stream && stream.getVideoTracks().length > 0\n ? \"OPEN\"\n : \"MUTE\",\n state: \"PLAYING\",\n streamID: streamInfo.streamID,\n };\n _streamList.push(this.remoteStreamMap[streamInfo.streamID]);\n return [3 /*break*/, 5];\n case 4:\n error_2 = _a.sent();\n console.warn(\"【ZEGOCLOUD】:startPlayingStream error\", error_2);\n return [3 /*break*/, 5];\n case 5:\n i++;\n return [3 /*break*/, 1];\n case 6:\n this.onRemoteMediaUpdateCallBack &&\n this.onRemoteMediaUpdateCallBack(\"ADD\", _streamList);\n return [3 /*break*/, 11];\n case 7:\n _streamList = [];\n i = 0;\n _a.label = 8;\n case 8:\n if (!(i < streamList.length)) return [3 /*break*/, 11];\n streamInfo = streamList[i];\n _streamList.push(this.remoteStreamMap[streamInfo.streamID]);\n return [4 /*yield*/, this.zum.stopPullStream(streamInfo.user.userID, streamInfo.streamID)];\n case 9:\n _a.sent();\n delete this.remoteStreamMap[streamInfo.streamID];\n this.onRemoteMediaUpdateCallBack &&\n this.onRemoteMediaUpdateCallBack(\"DELETE\", _streamList);\n _a.label = 10;\n case 10:\n i++;\n return [3 /*break*/, 8];\n case 11: return [2 /*return*/];\n }\n });\n }); });\n ZegoCloudRTCCore._zg.on(\"roomExtraInfoUpdate\", function (roomID, roomExtraInfoList) {\n roomExtraInfoList.forEach(function (info) {\n if (info.key === _this.extraInfoKey) {\n _this.roomExtraInfo = JSON.parse(info.value);\n }\n });\n });\n ZegoCloudRTCCore._zg.on(\"remoteCameraStatusUpdate\", function (streamID, status) {\n if (_this.remoteStreamMap[streamID]) {\n _this.remoteStreamMap[streamID].cameraStatus = status;\n _this.onRemoteMediaUpdateCallBack &&\n _this.onRemoteMediaUpdateCallBack(\"UPDATE\", [\n _this.remoteStreamMap[streamID],\n ]);\n }\n });\n ZegoCloudRTCCore._zg.on(\"remoteMicStatusUpdate\", function (streamID, status) {\n if (_this.remoteStreamMap[streamID]) {\n _this.remoteStreamMap[streamID].micStatus = status;\n _this.onRemoteMediaUpdateCallBack &&\n _this.onRemoteMediaUpdateCallBack(\"UPDATE\", [\n _this.remoteStreamMap[streamID],\n ]);\n }\n });\n ZegoCloudRTCCore._zg.on(\"playerStateUpdate\", function (streamInfo) {\n console.warn(\"【ZEGOCLOUD】\", streamInfo);\n if (_this.remoteStreamMap[streamInfo.streamID]) {\n _this.remoteStreamMap[streamInfo.streamID].state = streamInfo.state;\n _this.onRemoteMediaUpdateCallBack &&\n _this.onRemoteMediaUpdateCallBack(\"UPDATE\", [\n _this.remoteStreamMap[streamInfo.streamID],\n ]);\n }\n });\n ZegoCloudRTCCore._zg.on(\"roomUserUpdate\", function (roomID, updateType, userList) {\n _this.onRemoteUserUpdateCallBack &&\n _this.onRemoteUserUpdateCallBack(roomID, updateType, userList);\n setTimeout(function () {\n _this._config.userUpdateCallback &&\n _this._config.userUpdateCallback(updateType, userList);\n }, 0);\n });\n ZegoCloudRTCCore._zg.on(\"IMRecvBroadcastMessage\", function (roomID, chatData) {\n _this.onRoomMessageUpdateCallBack &&\n _this.onRoomMessageUpdateCallBack(roomID, chatData);\n });\n ZegoCloudRTCCore._zg.on(\"publisherStateUpdate\", function (streamInfo) {\n var state = \"DISCONNECTED\";\n if (streamInfo.state === \"PUBLISHING\") {\n state = \"CONNECTED\";\n }\n else if (streamInfo.state === \"NO_PUBLISH\") {\n state = \"DISCONNECTED\";\n }\n else if (streamInfo.state === \"PUBLISH_REQUESTING\") {\n state = \"CONNECTING\";\n }\n _this.onNetworkStatusCallBack &&\n _this.onNetworkStatusCallBack(ZegoCloudRTCCore._instance._expressConfig.roomID, \"STREAM\", state);\n });\n ZegoCloudRTCCore._zg.on(\"playQualityUpdate\", function (streamID, stats) {\n _this.onNetworkStatusQualityCallBack &&\n _this.onNetworkStatusQualityCallBack(streamID, Math.max(stats.video.videoQuality, stats.audio.audioQuality));\n });\n ZegoCloudRTCCore._zg.on(\"publishQualityUpdate\", function (streamID, stats) {\n _this.onNetworkStatusQualityCallBack &&\n _this.onNetworkStatusQualityCallBack(streamID, Math.max(stats.video.videoQuality, stats.audio.audioQuality));\n });\n ZegoCloudRTCCore._zg.on(\"soundLevelUpdate\", function (soundLevelList) {\n _this.onSoundLevelUpdateCallBack &&\n _this.onSoundLevelUpdateCallBack(soundLevelList);\n });\n ZegoCloudRTCCore._zg.on(\"screenSharingEnded\", function (stream) {\n _this.onScreenSharingEndedCallBack &&\n _this.onScreenSharingEndedCallBack(stream);\n });\n return [4 /*yield*/, new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n ZegoCloudRTCCore._zg.on(\"roomStateUpdate\", function (roomID, state, errorCode, extendedData) {\n _this.onNetworkStatusCallBack &&\n _this.onNetworkStatusCallBack(roomID, \"ROOM\", state);\n if (state === \"CONNECTED\" || state === \"DISCONNECTED\") {\n _this.status.loginRsp = errorCode === 0;\n res(errorCode);\n }\n });\n return [4 /*yield*/, ZegoCloudRTCCore._zg.loginRoom(ZegoCloudRTCCore._instance._expressConfig.roomID, ZegoCloudRTCCore._instance._expressConfig.token, {\n userID: ZegoCloudRTCCore._instance._expressConfig.userID,\n userName: ZegoCloudRTCCore._instance._expressConfig.userName,\n }, {\n userUpdate: true,\n maxMemberCount: ZegoCloudRTCCore._instance._config.maxUsers,\n })];\n case 1:\n _a.sent();\n return [2 /*return*/];\n }\n });\n }); })];\n case 1:\n resp = _a.sent();\n ZegoCloudRTCCore._zg.setSoundLevelDelegate(true, 300);\n return [2 /*return*/, resp];\n }\n });\n });\n };\n ZegoCloudRTCCore.prototype.publishLocalStream = function (media, streamType) {\n if (!media)\n return false;\n var streamID = (0,_tools_util__WEBPACK_IMPORTED_MODULE_0__.generateStreamID)(this._expressConfig.userID, this._expressConfig.roomID, streamType);\n var res = ZegoCloudRTCCore._zg.startPublishingStream(streamID, media);\n return res && streamID;\n };\n ZegoCloudRTCCore.prototype.replaceTrack = function (media, mediaStreamTrack) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, ZegoCloudRTCCore._zg.replaceTrack(media, mediaStreamTrack)];\n });\n });\n };\n ZegoCloudRTCCore.prototype.subscribeUserList = function (callback) {\n this.subscribeUserListCallBack = callback;\n };\n ZegoCloudRTCCore.prototype.subscribeScreenStream = function (callback) {\n this.subscribeScreenStreamCallBack = callback;\n };\n ZegoCloudRTCCore.prototype.onRemoteMediaUpdate = function (func) {\n var _this = this;\n this.onRemoteMediaUpdateCallBack = function (updateType, streamList) {\n func(updateType, streamList);\n _this.zum.mainStreamUpdate(updateType, streamList);\n _this.zum.screenStreamUpdate(updateType, streamList);\n _this.subscribeUserListCallBack &&\n _this.subscribeUserListCallBack(__spreadArray([], _this.zum.remoteUserList, true));\n _this.subscribeScreenStreamCallBack &&\n _this.subscribeScreenStreamCallBack(__spreadArray([], _this.zum.remoteScreenStreamList, true));\n };\n };\n ZegoCloudRTCCore.prototype.onNetworkStatusQuality = function (func) {\n this.onNetworkStatusQualityCallBack = func;\n };\n ZegoCloudRTCCore.prototype.onRemoteUserUpdate = function (func) {\n var _this = this;\n this.onRemoteUserUpdateCallBack = function (roomID, updateType, user) { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n func(roomID, updateType, user);\n return [4 /*yield*/, this.zum.userUpdate(roomID, updateType, user)];\n case 1:\n _a.sent();\n this.subscribeUserListCallBack &&\n this.subscribeUserListCallBack(__spreadArray([], this.zum.remoteUserList, true));\n return [2 /*return*/];\n }\n });\n }); };\n };\n ZegoCloudRTCCore.prototype.onSoundLevelUpdate = function (func) {\n this.onSoundLevelUpdateCallBack = func;\n };\n ZegoCloudRTCCore.prototype.onRoomLiveStateUpdate = function (func) {\n this.onRoomLiveStateUpdateCallBack = func;\n };\n ZegoCloudRTCCore.prototype.sendRoomMessage = function (message) {\n return ZegoCloudRTCCore._zg.sendBroadcastMessage(ZegoCloudRTCCore._instance._expressConfig.roomID, message);\n };\n ZegoCloudRTCCore.prototype.onRoomMessageUpdate = function (func) {\n this.onRoomMessageUpdateCallBack = func;\n };\n ZegoCloudRTCCore.prototype.onScreenSharingEnded = function (func) {\n this.onScreenSharingEndedCallBack = func;\n };\n ZegoCloudRTCCore.prototype.onNetworkStatus = function (func) {\n var _this = this;\n this.onNetworkStatusCallBack = function (roomID, type, status) {\n if (status === \"CONNECTING\") {\n !_this.NetworkStatusTimer &&\n (_this.NetworkStatusTimer = setTimeout(function () {\n func(roomID, type, \"DISCONNECTED\");\n }, 60000));\n }\n else {\n if (_this.NetworkStatusTimer) {\n clearTimeout(_this.NetworkStatusTimer);\n _this.NetworkStatusTimer = null;\n }\n }\n func(roomID, type, status);\n };\n };\n ZegoCloudRTCCore.prototype.leaveRoom = function () {\n var _this = this;\n if (!this.status.loginRsp)\n return;\n ZegoCloudRTCCore._zg.off(\"roomExtraInfoUpdate\");\n ZegoCloudRTCCore._zg.off(\"roomStreamUpdate\");\n ZegoCloudRTCCore._zg.off(\"remoteCameraStatusUpdate\");\n ZegoCloudRTCCore._zg.off(\"remoteMicStatusUpdate\");\n ZegoCloudRTCCore._zg.off(\"playerStateUpdate\");\n ZegoCloudRTCCore._zg.off(\"roomUserUpdate\");\n ZegoCloudRTCCore._zg.off(\"IMRecvBroadcastMessage\");\n ZegoCloudRTCCore._zg.off(\"roomStateUpdate\");\n ZegoCloudRTCCore._zg.off(\"publisherStateUpdate\");\n ZegoCloudRTCCore._zg.off(\"publishQualityUpdate\");\n ZegoCloudRTCCore._zg.off(\"soundLevelUpdate\");\n ZegoCloudRTCCore._zg.off(\"screenSharingEnded\");\n ZegoCloudRTCCore._zg.setSoundLevelDelegate(false);\n this.onNetworkStatusCallBack = function () { };\n this.onRemoteMediaUpdateCallBack = function (updateType, streamList) {\n _this.zum.mainStreamUpdate(updateType, streamList);\n _this.zum.screenStreamUpdate(updateType, streamList);\n _this.subscribeUserListCallBack &&\n _this.subscribeUserListCallBack(__spreadArray([], _this.zum.remoteUserList, true));\n _this.subscribeScreenStreamCallBack &&\n _this.subscribeScreenStreamCallBack(__spreadArray([], _this.zum.remoteScreenStreamList, true));\n };\n this.onRemoteUserUpdateCallBack = function () { };\n this.onRoomMessageUpdateCallBack = function () { };\n this.onRoomLiveStateUpdateCallBack = function () { };\n this.subscribeUserListCallBack = function () { };\n this.zum.reset();\n for (var key in this.remoteStreamMap) {\n ZegoCloudRTCCore._zg.stopPlayingStream(key);\n }\n this.remoteStreamMap = {};\n ZegoCloudRTCCore._zg.logoutRoom();\n this.status.loginRsp = false;\n };\n return ZegoCloudRTCCore;\n}());\n\n\n\n//# sourceURL=webpack://zegocloud_client_sdk_web/./src/sdk/modules/index.ts?");
|
|
1448
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ZegoCloudRTCCore\": function() { return /* binding */ ZegoCloudRTCCore; }\n/* harmony export */ });\n/* harmony import */ var _tools_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./tools/util */ \"./src/sdk/modules/tools/util.ts\");\n/* harmony import */ var zego_express_engine_webrtc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! zego-express-engine-webrtc */ \"./node_modules/zego-express-engine-webrtc/ZegoExpressWebRTC.js\");\n/* harmony import */ var zego_express_engine_webrtc__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(zego_express_engine_webrtc__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _model__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../model */ \"./src/sdk/model/index.ts\");\n/* harmony import */ var _tools_UserListManager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./tools/UserListManager */ \"./src/sdk/modules/tools/UserListManager.ts\");\nvar __assign = (undefined && undefined.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\n\n\n\n\nvar ZegoCloudRTCCore = /** @class */ (function () {\n function ZegoCloudRTCCore() {\n var _this = this;\n this.status = {\n loginRsp: false,\n videoRefuse: false,\n audioRefuse: false,\n };\n this.remoteStreamMap = {};\n this._config = {\n // @ts-ignore\n container: undefined,\n preJoinViewConfig: {\n title: \"Join Room\",\n invitationLink: window.location.href, // 邀请链接,空则不显示,默认空\n },\n showPreJoinView: true,\n turnOnMicrophoneWhenJoining: true,\n turnOnCameraWhenJoining: true,\n showMyCameraToggleButton: true,\n showMyMicrophoneToggleButton: true,\n showAudioVideoSettingsButton: true,\n showTextChat: true,\n showUserList: true,\n lowerLeftNotification: {\n showUserJoinAndLeave: true,\n showTextChat: true, // 是否显示未读消息,默认显示\n },\n branding: {\n logoURL: \"\",\n },\n showLeavingView: true,\n maxUsers: 2,\n layout: \"Auto\",\n showNonVideoUser: true,\n showOnlyAudioUser: false,\n useFrontFacingCamera: true,\n onJoinRoom: function () { },\n onLeaveRoom: function () { },\n onUserJoin: function (user) { },\n onUserLeave: function (user) { },\n sharedLinks: [],\n showScreenSharingButton: true,\n scenario: {\n mode: _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.OneONoneCall,\n config: { role: _model__WEBPACK_IMPORTED_MODULE_2__.LiveRole.Host }, // 对应场景专有配置\n },\n facingMode: \"user\",\n joinRoomCallback: function () { },\n leaveRoomCallback: function () { },\n userUpdateCallback: function () { },\n showLayoutButton: true,\n showPinButton: true, // 是否显pin按钮\n };\n this.extraInfoKey = \"extra_info\";\n this._roomExtraInfo = {\n live_status: {\n v: 0,\n u: \"xxx\",\n r: 0,\n },\n };\n this.onRemoteMediaUpdateCallBack = function (updateType, streamList) {\n _this.zum.mainStreamUpdate(updateType, streamList);\n _this.zum.screenStreamUpdate(updateType, streamList);\n _this.subscribeUserListCallBack &&\n _this.subscribeUserListCallBack(__spreadArray([], _this.zum.remoteUserList, true));\n _this.subscribeScreenStreamCallBack &&\n _this.subscribeScreenStreamCallBack(__spreadArray([], _this.zum.remoteScreenStreamList, true));\n };\n this.NetworkStatusTimer = null;\n }\n // static _soundMeter: SoundMeter;\n ZegoCloudRTCCore.getInstance = function (token) {\n var config = (0,_tools_util__WEBPACK_IMPORTED_MODULE_0__.getConfig)(token);\n if (!ZegoCloudRTCCore._instance && config) {\n ZegoCloudRTCCore._instance = new ZegoCloudRTCCore();\n ZegoCloudRTCCore._instance._expressConfig = config;\n // ZegoCloudRTCCore._soundMeter = new SoundMeter();\n ZegoCloudRTCCore._zg = new zego_express_engine_webrtc__WEBPACK_IMPORTED_MODULE_1__.ZegoExpressEngine(ZegoCloudRTCCore._instance._expressConfig.appID, \"wss://webliveroom\" +\n ZegoCloudRTCCore._instance._expressConfig.appID +\n \"-api.zegocloud.com/ws\");\n ZegoCloudRTCCore._instance.zum = new _tools_UserListManager__WEBPACK_IMPORTED_MODULE_3__.ZegoCloudUserListManager(ZegoCloudRTCCore._zg);\n }\n return ZegoCloudRTCCore._instance;\n };\n ZegoCloudRTCCore.prototype.checkWebRTC = function () {\n return __awaiter(this, void 0, void 0, function () {\n var result;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, ZegoCloudRTCCore._zg.checkSystemRequirements(\"webRTC\")];\n case 1:\n result = _a.sent();\n return [2 /*return*/, !!result.result];\n }\n });\n });\n };\n ZegoCloudRTCCore.prototype.setConfig = function (config) {\n var _a, _b, _c, _d;\n if (config.scenario &&\n config.scenario.mode === _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.LiveStreaming) {\n if (config.showNonVideoUser === true) {\n console.error(\"【ZEGOCLOUD】 showNonVideoUser have be false scenario.mode is LiveStreaming!!\");\n return false;\n }\n config.showNonVideoUser = false;\n config.showOnlyAudioUser = true;\n if (config.scenario.config &&\n config.scenario.config.role === _model__WEBPACK_IMPORTED_MODULE_2__.LiveRole.Host) {\n if (config.turnOnMicrophoneWhenJoining === false &&\n config.turnOnCameraWhenJoining === false &&\n config.showMyCameraToggleButton === false &&\n config.showAudioVideoSettingsButton === false) {\n console.error(\"【ZEGOCLOUD】 Host could turn on at least one of the camera and the microphone!!\");\n return false;\n }\n }\n else if (config.scenario.config &&\n config.scenario.config.role === _model__WEBPACK_IMPORTED_MODULE_2__.LiveRole.Audience) {\n if (config.turnOnMicrophoneWhenJoining === true ||\n config.turnOnCameraWhenJoining === true ||\n config.showMyCameraToggleButton === true ||\n config.showMyMicrophoneToggleButton === true ||\n config.showAudioVideoSettingsButton === true ||\n config.showScreenSharingButton === true ||\n config.useFrontFacingCamera === true ||\n (!!config.layout && config.layout !== \"Grid\")) {\n console.error(\"【ZEGOCLOUD】 Audience cannot configure camera and microphone related params\");\n return false;\n }\n }\n if (!config.maxUsers) {\n config.maxUsers = 5000;\n }\n if (config.scenario.config &&\n config.scenario.config.role === _model__WEBPACK_IMPORTED_MODULE_2__.LiveRole.Audience) {\n config.turnOnMicrophoneWhenJoining = false;\n config.turnOnCameraWhenJoining = false;\n config.showMyCameraToggleButton = false;\n config.showMyMicrophoneToggleButton = false;\n config.showAudioVideoSettingsButton = false;\n config.showScreenSharingButton = false;\n config.useFrontFacingCamera = false;\n config.useFrontFacingCamera = false;\n config.showUserList = false;\n config.showPinButton = false;\n config.showLayoutButton = false;\n config.layout = \"Grid\";\n config.lowerLeftNotification = {\n showTextChat: false,\n showUserJoinAndLeave: false,\n };\n }\n }\n if (config.scenario &&\n config.scenario.mode === _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.OneONoneCall) {\n if (!config.maxUsers) {\n config.maxUsers = 2;\n }\n config.showLayoutButton = false;\n config.showPinButton = false;\n }\n if (config.scenario && config.scenario.mode === _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.GroupCall) {\n if (!config.maxUsers) {\n config.maxUsers = 50;\n }\n }\n config.facingMode &&\n (config.useFrontFacingCamera = config.facingMode === \"user\");\n config.joinRoomCallback && (config.onJoinRoom = config.joinRoomCallback);\n config.leaveRoomCallback && (config.onLeaveRoom = config.leaveRoomCallback);\n if (config.userUpdateCallback) {\n config.onJoinRoom = function (users) {\n config.userUpdateCallback && config.userUpdateCallback(\"ADD\", users);\n };\n config.onLeaveRoom = function (users) {\n config.userUpdateCallback && config.userUpdateCallback(\"DELETE\", users);\n };\n }\n if (config.preJoinViewConfig && config.preJoinViewConfig.invitationLink) {\n config.sharedLinks = [\n {\n name: \"Share the link\",\n url: config.preJoinViewConfig.invitationLink,\n },\n ];\n }\n config.preJoinViewConfig &&\n (config.preJoinViewConfig = __assign(__assign({}, this._config.preJoinViewConfig), config.preJoinViewConfig));\n config.scenario &&\n config.scenario.config &&\n (config.scenario.config = __assign(__assign({}, (_a = this._config.scenario) === null || _a === void 0 ? void 0 : _a.config), config.scenario.config));\n this._config = __assign(__assign({}, this._config), config);\n this.zum.scenario =\n ((_b = this._config.scenario) === null || _b === void 0 ? void 0 : _b.mode) || _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.OneONoneCall;\n this.zum.role = ((_d = (_c = this._config.scenario) === null || _c === void 0 ? void 0 : _c.config) === null || _d === void 0 ? void 0 : _d.role) || _model__WEBPACK_IMPORTED_MODULE_2__.LiveRole.Host;\n this.zum.showOnlyAudioUser = !!this._config.showOnlyAudioUser;\n this.zum.setShowNonVideo(!!this._config.showNonVideoUser);\n return true;\n };\n ZegoCloudRTCCore.prototype.setPin = function (userID, pined) {\n this.zum.setPin(userID, pined);\n this.subscribeUserListCallBack &&\n this.subscribeUserListCallBack(__spreadArray([], this.zum.remoteUserList, true));\n };\n ZegoCloudRTCCore.prototype.setMaxScreenNum = function (num) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.zum.setMaxScreenNum(num)];\n case 1:\n _a.sent();\n this.subscribeUserListCallBack &&\n this.subscribeUserListCallBack(__spreadArray([], this.zum.remoteUserList, true));\n return [2 /*return*/];\n }\n });\n });\n };\n ZegoCloudRTCCore.prototype.setSidebarLayOut = function (enable) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.zum.setSidebarLayOut(enable)];\n case 1:\n _a.sent();\n this.subscribeUserListCallBack &&\n this.subscribeUserListCallBack(__spreadArray([], this.zum.remoteUserList, true));\n return [2 /*return*/];\n }\n });\n });\n };\n ZegoCloudRTCCore.prototype.setShowNonVideo = function (enable) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.zum.setShowNonVideo(enable)];\n case 1:\n _a.sent();\n this.subscribeUserListCallBack &&\n this.subscribeUserListCallBack(__spreadArray([], this.zum.remoteUserList, true));\n return [2 /*return*/];\n }\n });\n });\n };\n ZegoCloudRTCCore.prototype.getCameras = function () {\n return ZegoCloudRTCCore._zg.getCameras();\n };\n ZegoCloudRTCCore.prototype.useVideoDevice = function (localStream, deviceID) {\n return ZegoCloudRTCCore._zg.useVideoDevice(localStream, deviceID);\n };\n ZegoCloudRTCCore.prototype.getMicrophones = function () {\n return ZegoCloudRTCCore._zg.getMicrophones();\n };\n ZegoCloudRTCCore.prototype.getSpeakers = function () {\n return ZegoCloudRTCCore._zg.getSpeakers();\n };\n ZegoCloudRTCCore.prototype.setVolume = function (media, volume) {\n media.volume = volume;\n };\n ZegoCloudRTCCore.prototype.createStream = function (source) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, ZegoCloudRTCCore._zg.createStream(source)];\n });\n });\n };\n ZegoCloudRTCCore.prototype.setVideoConfig = function (media, constraints) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, ZegoCloudRTCCore._zg.setVideoConfig(media, constraints)];\n });\n });\n };\n ZegoCloudRTCCore.prototype.stopPublishingStream = function (streamID) {\n return ZegoCloudRTCCore._zg.stopPublishingStream(streamID);\n };\n ZegoCloudRTCCore.prototype.destroyStream = function (stream) {\n ZegoCloudRTCCore._zg.destroyStream(stream);\n };\n ZegoCloudRTCCore.prototype.useCameraDevice = function (media, deviceID) {\n return ZegoCloudRTCCore._zg.useVideoDevice(media, deviceID);\n };\n ZegoCloudRTCCore.prototype.useMicrophoneDevice = function (media, deviceID) {\n return ZegoCloudRTCCore._zg.useAudioDevice(media, deviceID);\n };\n ZegoCloudRTCCore.prototype.useSpeakerDevice = function (media, deviceID) {\n return __awaiter(this, void 0, void 0, function () {\n var res, error_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!media.srcObject) {\n return [2 /*return*/, Promise.resolve({ errorCode: -1 })];\n }\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, ZegoCloudRTCCore._zg.useAudioOutputDevice(media, deviceID)];\n case 2:\n res = _a.sent();\n return [2 /*return*/, { errorCode: res ? 0 : -1 }];\n case 3:\n error_1 = _a.sent();\n return [2 /*return*/, { errorCode: -1 }];\n case 4: return [2 /*return*/];\n }\n });\n });\n };\n ZegoCloudRTCCore.prototype.enableVideoCaptureDevice = function (localStream, enable) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, ZegoCloudRTCCore._zg.enableVideoCaptureDevice(localStream, enable)];\n });\n });\n };\n ZegoCloudRTCCore.prototype.mutePublishStreamVideo = function (localStream, enable) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, ZegoCloudRTCCore._zg.mutePublishStreamVideo(localStream, enable)];\n });\n });\n };\n ZegoCloudRTCCore.prototype.mutePublishStreamAudio = function (localStream, enable) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, ZegoCloudRTCCore._zg.mutePublishStreamAudio(localStream, enable)];\n });\n });\n };\n ZegoCloudRTCCore.prototype.muteMicrophone = function (enable) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, ZegoCloudRTCCore._zg.muteMicrophone(enable)];\n });\n });\n };\n Object.defineProperty(ZegoCloudRTCCore.prototype, \"roomExtraInfo\", {\n get: function () {\n return this._roomExtraInfo;\n },\n set: function (value) {\n this._roomExtraInfo = value;\n this.zum.setLiveStates(this._roomExtraInfo.live_status.v);\n this.onRoomLiveStateUpdateCallBack &&\n this.onRoomLiveStateUpdateCallBack(this._roomExtraInfo.live_status.v);\n },\n enumerable: false,\n configurable: true\n });\n ZegoCloudRTCCore.prototype.setLive = function (status) {\n var _a, _b, _c, _d;\n return __awaiter(this, void 0, void 0, function () {\n var setRoomExtraInfo, res;\n return __generator(this, function (_e) {\n switch (_e.label) {\n case 0:\n setRoomExtraInfo = __assign(__assign({}, this._roomExtraInfo), {\n live_status: {\n v: status === \"live\" ? 1 : 0,\n u: ZegoCloudRTCCore._instance._expressConfig.userID,\n r: ((_b = (_a = ZegoCloudRTCCore._instance._config.scenario) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.role) ===\n _model__WEBPACK_IMPORTED_MODULE_2__.LiveRole.Host\n ? 1\n : ((_d = (_c = ZegoCloudRTCCore._instance._config.scenario) === null || _c === void 0 ? void 0 : _c.config) === null || _d === void 0 ? void 0 : _d.role) ===\n _model__WEBPACK_IMPORTED_MODULE_2__.LiveRole.Audience\n ? 2\n : 3,\n },\n });\n return [4 /*yield*/, ZegoCloudRTCCore._zg.setRoomExtraInfo(ZegoCloudRTCCore._instance._expressConfig.roomID, \"extra_info\", JSON.stringify(setRoomExtraInfo))];\n case 1:\n res = _e.sent();\n res.errorCode === 0 && (this.roomExtraInfo = setRoomExtraInfo);\n return [2 /*return*/, res.errorCode === 0];\n }\n });\n });\n };\n ZegoCloudRTCCore.prototype.enterRoom = function () {\n return __awaiter(this, void 0, void 0, function () {\n var resp;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n // 已经登陆过不再登录\n if (this.status.loginRsp)\n return [2 /*return*/, Promise.resolve(0)];\n ZegoCloudRTCCore._zg.off(\"roomExtraInfoUpdate\");\n ZegoCloudRTCCore._zg.off(\"roomStreamUpdate\");\n ZegoCloudRTCCore._zg.off(\"remoteCameraStatusUpdate\");\n ZegoCloudRTCCore._zg.off(\"remoteMicStatusUpdate\");\n ZegoCloudRTCCore._zg.off(\"playerStateUpdate\");\n ZegoCloudRTCCore._zg.off(\"roomUserUpdate\");\n ZegoCloudRTCCore._zg.off(\"IMRecvBroadcastMessage\");\n ZegoCloudRTCCore._zg.off(\"roomStateUpdate\");\n ZegoCloudRTCCore._zg.off(\"publisherStateUpdate\");\n ZegoCloudRTCCore._zg.off(\"publishQualityUpdate\");\n ZegoCloudRTCCore._zg.off(\"soundLevelUpdate\");\n ZegoCloudRTCCore._zg.on(\"roomStreamUpdate\", function (roomID, updateType, streamList, extendedData) { return __awaiter(_this, void 0, void 0, function () {\n var _streamList, i, streamInfo, stream, error_2, _streamList, i, streamInfo;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!(updateType === \"ADD\")) return [3 /*break*/, 7];\n _streamList = [];\n i = 0;\n _a.label = 1;\n case 1:\n if (!(i < streamList.length)) return [3 /*break*/, 6];\n streamInfo = streamList[i];\n _a.label = 2;\n case 2:\n _a.trys.push([2, 4, , 5]);\n return [4 /*yield*/, this.zum.startPullStream(streamInfo.user.userID, streamInfo.streamID)];\n case 3:\n stream = _a.sent();\n this.remoteStreamMap[streamInfo.streamID] = {\n fromUser: streamInfo.user,\n media: stream,\n micStatus: stream && stream.getAudioTracks().length > 0\n ? \"OPEN\"\n : \"MUTE\",\n cameraStatus: stream && stream.getVideoTracks().length > 0\n ? \"OPEN\"\n : \"MUTE\",\n state: \"PLAYING\",\n streamID: streamInfo.streamID,\n };\n _streamList.push(this.remoteStreamMap[streamInfo.streamID]);\n return [3 /*break*/, 5];\n case 4:\n error_2 = _a.sent();\n console.warn(\"【ZEGOCLOUD】:startPlayingStream error\", error_2);\n return [3 /*break*/, 5];\n case 5:\n i++;\n return [3 /*break*/, 1];\n case 6:\n this.onRemoteMediaUpdateCallBack &&\n this.onRemoteMediaUpdateCallBack(\"ADD\", _streamList);\n return [3 /*break*/, 11];\n case 7:\n _streamList = [];\n i = 0;\n _a.label = 8;\n case 8:\n if (!(i < streamList.length)) return [3 /*break*/, 11];\n streamInfo = streamList[i];\n _streamList.push(this.remoteStreamMap[streamInfo.streamID]);\n return [4 /*yield*/, this.zum.stopPullStream(streamInfo.user.userID, streamInfo.streamID)];\n case 9:\n _a.sent();\n delete this.remoteStreamMap[streamInfo.streamID];\n this.onRemoteMediaUpdateCallBack &&\n this.onRemoteMediaUpdateCallBack(\"DELETE\", _streamList);\n _a.label = 10;\n case 10:\n i++;\n return [3 /*break*/, 8];\n case 11: return [2 /*return*/];\n }\n });\n }); });\n ZegoCloudRTCCore._zg.on(\"roomExtraInfoUpdate\", function (roomID, roomExtraInfoList) {\n roomExtraInfoList.forEach(function (info) {\n if (info.key === _this.extraInfoKey) {\n _this.roomExtraInfo = JSON.parse(info.value);\n }\n });\n });\n ZegoCloudRTCCore._zg.on(\"remoteCameraStatusUpdate\", function (streamID, status) {\n if (_this.remoteStreamMap[streamID]) {\n _this.remoteStreamMap[streamID].cameraStatus = status;\n _this.onRemoteMediaUpdateCallBack &&\n _this.onRemoteMediaUpdateCallBack(\"UPDATE\", [\n _this.remoteStreamMap[streamID],\n ]);\n }\n });\n ZegoCloudRTCCore._zg.on(\"remoteMicStatusUpdate\", function (streamID, status) {\n if (_this.remoteStreamMap[streamID]) {\n _this.remoteStreamMap[streamID].micStatus = status;\n _this.onRemoteMediaUpdateCallBack &&\n _this.onRemoteMediaUpdateCallBack(\"UPDATE\", [\n _this.remoteStreamMap[streamID],\n ]);\n }\n });\n ZegoCloudRTCCore._zg.on(\"playerStateUpdate\", function (streamInfo) {\n console.warn(\"【ZEGOCLOUD】\", streamInfo);\n if (_this.remoteStreamMap[streamInfo.streamID]) {\n _this.remoteStreamMap[streamInfo.streamID].state = streamInfo.state;\n _this.onRemoteMediaUpdateCallBack &&\n _this.onRemoteMediaUpdateCallBack(\"UPDATE\", [\n _this.remoteStreamMap[streamInfo.streamID],\n ]);\n }\n });\n ZegoCloudRTCCore._zg.on(\"roomUserUpdate\", function (roomID, updateType, userList) {\n _this.onRemoteUserUpdateCallBack &&\n _this.onRemoteUserUpdateCallBack(roomID, updateType, userList);\n setTimeout(function () {\n _this._config.userUpdateCallback &&\n _this._config.userUpdateCallback(updateType, userList);\n }, 0);\n });\n ZegoCloudRTCCore._zg.on(\"IMRecvBroadcastMessage\", function (roomID, chatData) {\n _this.onRoomMessageUpdateCallBack &&\n _this.onRoomMessageUpdateCallBack(roomID, chatData);\n });\n ZegoCloudRTCCore._zg.on(\"publisherStateUpdate\", function (streamInfo) {\n var state = \"DISCONNECTED\";\n if (streamInfo.state === \"PUBLISHING\") {\n state = \"CONNECTED\";\n }\n else if (streamInfo.state === \"NO_PUBLISH\") {\n state = \"DISCONNECTED\";\n }\n else if (streamInfo.state === \"PUBLISH_REQUESTING\") {\n state = \"CONNECTING\";\n }\n _this.onNetworkStatusCallBack &&\n _this.onNetworkStatusCallBack(ZegoCloudRTCCore._instance._expressConfig.roomID, \"STREAM\", state);\n });\n ZegoCloudRTCCore._zg.on(\"playQualityUpdate\", function (streamID, stats) {\n _this.onNetworkStatusQualityCallBack &&\n _this.onNetworkStatusQualityCallBack(streamID, Math.max(stats.video.videoQuality, stats.audio.audioQuality));\n });\n ZegoCloudRTCCore._zg.on(\"publishQualityUpdate\", function (streamID, stats) {\n _this.onNetworkStatusQualityCallBack &&\n _this.onNetworkStatusQualityCallBack(streamID, Math.max(stats.video.videoQuality, stats.audio.audioQuality));\n });\n ZegoCloudRTCCore._zg.on(\"soundLevelUpdate\", function (soundLevelList) {\n _this.onSoundLevelUpdateCallBack &&\n _this.onSoundLevelUpdateCallBack(soundLevelList);\n });\n ZegoCloudRTCCore._zg.on(\"screenSharingEnded\", function (stream) {\n _this.onScreenSharingEndedCallBack &&\n _this.onScreenSharingEndedCallBack(stream);\n });\n return [4 /*yield*/, new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n ZegoCloudRTCCore._zg.on(\"roomStateUpdate\", function (roomID, state, errorCode, extendedData) {\n _this.onNetworkStatusCallBack &&\n _this.onNetworkStatusCallBack(roomID, \"ROOM\", state);\n if (state === \"CONNECTED\" || state === \"DISCONNECTED\") {\n _this.status.loginRsp = errorCode === 0;\n res(errorCode);\n }\n });\n return [4 /*yield*/, ZegoCloudRTCCore._zg.loginRoom(ZegoCloudRTCCore._instance._expressConfig.roomID, ZegoCloudRTCCore._instance._expressConfig.token, {\n userID: ZegoCloudRTCCore._instance._expressConfig.userID,\n userName: ZegoCloudRTCCore._instance._expressConfig.userName,\n }, {\n userUpdate: true,\n maxMemberCount: ZegoCloudRTCCore._instance._config.maxUsers,\n })];\n case 1:\n _a.sent();\n return [2 /*return*/];\n }\n });\n }); })];\n case 1:\n resp = _a.sent();\n ZegoCloudRTCCore._zg.setSoundLevelDelegate(true, 300);\n return [2 /*return*/, resp];\n }\n });\n });\n };\n ZegoCloudRTCCore.prototype.publishLocalStream = function (media, streamType) {\n if (!media)\n return false;\n var streamID = (0,_tools_util__WEBPACK_IMPORTED_MODULE_0__.generateStreamID)(this._expressConfig.userID, this._expressConfig.roomID, streamType);\n var res = ZegoCloudRTCCore._zg.startPublishingStream(streamID, media);\n return res && streamID;\n };\n ZegoCloudRTCCore.prototype.replaceTrack = function (media, mediaStreamTrack) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, ZegoCloudRTCCore._zg.replaceTrack(media, mediaStreamTrack)];\n });\n });\n };\n ZegoCloudRTCCore.prototype.subscribeUserList = function (callback) {\n this.subscribeUserListCallBack = callback;\n };\n ZegoCloudRTCCore.prototype.subscribeScreenStream = function (callback) {\n this.subscribeScreenStreamCallBack = callback;\n };\n ZegoCloudRTCCore.prototype.onRemoteMediaUpdate = function (func) {\n var _this = this;\n this.onRemoteMediaUpdateCallBack = function (updateType, streamList) {\n func(updateType, streamList);\n _this.zum.mainStreamUpdate(updateType, streamList);\n _this.zum.screenStreamUpdate(updateType, streamList);\n _this.subscribeUserListCallBack &&\n _this.subscribeUserListCallBack(__spreadArray([], _this.zum.remoteUserList, true));\n _this.subscribeScreenStreamCallBack &&\n _this.subscribeScreenStreamCallBack(__spreadArray([], _this.zum.remoteScreenStreamList, true));\n };\n };\n ZegoCloudRTCCore.prototype.onNetworkStatusQuality = function (func) {\n this.onNetworkStatusQualityCallBack = func;\n };\n ZegoCloudRTCCore.prototype.onRemoteUserUpdate = function (func) {\n var _this = this;\n this.onRemoteUserUpdateCallBack = function (roomID, updateType, user) { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n func(roomID, updateType, user);\n return [4 /*yield*/, this.zum.userUpdate(roomID, updateType, user)];\n case 1:\n _a.sent();\n this.subscribeUserListCallBack &&\n this.subscribeUserListCallBack(__spreadArray([], this.zum.remoteUserList, true));\n return [2 /*return*/];\n }\n });\n }); };\n };\n ZegoCloudRTCCore.prototype.onSoundLevelUpdate = function (func) {\n this.onSoundLevelUpdateCallBack = func;\n };\n ZegoCloudRTCCore.prototype.onRoomLiveStateUpdate = function (func) {\n this.onRoomLiveStateUpdateCallBack = func;\n };\n ZegoCloudRTCCore.prototype.sendRoomMessage = function (message) {\n return ZegoCloudRTCCore._zg.sendBroadcastMessage(ZegoCloudRTCCore._instance._expressConfig.roomID, message);\n };\n ZegoCloudRTCCore.prototype.onRoomMessageUpdate = function (func) {\n this.onRoomMessageUpdateCallBack = func;\n };\n ZegoCloudRTCCore.prototype.onScreenSharingEnded = function (func) {\n this.onScreenSharingEndedCallBack = func;\n };\n ZegoCloudRTCCore.prototype.onNetworkStatus = function (func) {\n var _this = this;\n this.onNetworkStatusCallBack = function (roomID, type, status) {\n if (status === \"CONNECTING\") {\n !_this.NetworkStatusTimer &&\n (_this.NetworkStatusTimer = setTimeout(function () {\n func(roomID, type, \"DISCONNECTED\");\n }, 60000));\n }\n else {\n if (_this.NetworkStatusTimer) {\n clearTimeout(_this.NetworkStatusTimer);\n _this.NetworkStatusTimer = null;\n }\n }\n func(roomID, type, status);\n };\n };\n ZegoCloudRTCCore.prototype.leaveRoom = function () {\n var _this = this;\n if (!this.status.loginRsp)\n return;\n ZegoCloudRTCCore._zg.off(\"roomExtraInfoUpdate\");\n ZegoCloudRTCCore._zg.off(\"roomStreamUpdate\");\n ZegoCloudRTCCore._zg.off(\"remoteCameraStatusUpdate\");\n ZegoCloudRTCCore._zg.off(\"remoteMicStatusUpdate\");\n ZegoCloudRTCCore._zg.off(\"playerStateUpdate\");\n ZegoCloudRTCCore._zg.off(\"roomUserUpdate\");\n ZegoCloudRTCCore._zg.off(\"IMRecvBroadcastMessage\");\n ZegoCloudRTCCore._zg.off(\"roomStateUpdate\");\n ZegoCloudRTCCore._zg.off(\"publisherStateUpdate\");\n ZegoCloudRTCCore._zg.off(\"publishQualityUpdate\");\n ZegoCloudRTCCore._zg.off(\"soundLevelUpdate\");\n ZegoCloudRTCCore._zg.off(\"screenSharingEnded\");\n ZegoCloudRTCCore._zg.setSoundLevelDelegate(false);\n this.onNetworkStatusCallBack = function () { };\n this.onRemoteMediaUpdateCallBack = function (updateType, streamList) {\n _this.zum.mainStreamUpdate(updateType, streamList);\n _this.zum.screenStreamUpdate(updateType, streamList);\n _this.subscribeUserListCallBack &&\n _this.subscribeUserListCallBack(__spreadArray([], _this.zum.remoteUserList, true));\n _this.subscribeScreenStreamCallBack &&\n _this.subscribeScreenStreamCallBack(__spreadArray([], _this.zum.remoteScreenStreamList, true));\n };\n this.onRemoteUserUpdateCallBack = function () { };\n this.onRoomMessageUpdateCallBack = function () { };\n this.onRoomLiveStateUpdateCallBack = function () { };\n this.subscribeUserListCallBack = function () { };\n this.zum.reset();\n for (var key in this.remoteStreamMap) {\n ZegoCloudRTCCore._zg.stopPlayingStream(key);\n }\n this.remoteStreamMap = {};\n ZegoCloudRTCCore._zg.logoutRoom();\n this.status.loginRsp = false;\n };\n return ZegoCloudRTCCore;\n}());\n\n\n\n//# sourceURL=webpack://zegocloud_client_sdk_web/./src/sdk/modules/index.ts?");
|
|
1449
1449
|
|
|
1450
1450
|
/***/ }),
|
|
1451
1451
|
|
|
@@ -1753,7 +1753,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var reac
|
|
|
1753
1753
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1754
1754
|
|
|
1755
1755
|
"use strict";
|
|
1756
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ZegoRoom\": function() { return /* binding */ ZegoRoom; }\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/ZegoRoom/index.module.scss\");\n/* harmony import */ var _components_zegoTimer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./components/zegoTimer */ \"./src/sdk/view/pages/ZegoRoom/components/zegoTimer.tsx\");\n/* harmony import */ var _components_zegoOne2One__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./components/zegoOne2One */ \"./src/sdk/view/pages/ZegoRoom/components/zegoOne2One.tsx\");\n/* harmony import */ var _components_zegoMessage__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./components/zegoMessage */ \"./src/sdk/view/pages/ZegoRoom/components/zegoMessage.tsx\");\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../util */ \"./src/sdk/util.ts\");\n/* harmony import */ var _components_zegoSetting__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../components/zegoSetting */ \"./src/sdk/view/components/zegoSetting/index.tsx\");\n/* harmony import */ var _components_zegoModel__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../components/zegoModel */ \"./src/sdk/view/components/zegoModel/index.tsx\");\n/* harmony import */ var _components_zegoToast__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../components/zegoToast */ \"./src/sdk/view/components/zegoToast/index.tsx\");\n/* harmony import */ var _components_zegoGridLayout__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./components/zegoGridLayout */ \"./src/sdk/view/pages/ZegoRoom/components/zegoGridLayout.tsx\");\n/* harmony import */ var _components_zegoSidebarLayout__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./components/zegoSidebarLayout */ \"./src/sdk/view/pages/ZegoRoom/components/zegoSidebarLayout.tsx\");\n/* harmony import */ var _components_zegoRoomInvite__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./components/zegoRoomInvite */ \"./src/sdk/view/pages/ZegoRoom/components/zegoRoomInvite.tsx\");\n/* harmony import */ var _components_zegoUserList__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./components/zegoUserList */ \"./src/sdk/view/pages/ZegoRoom/components/zegoUserList.tsx\");\n/* harmony import */ var _components_ZegoScreenSharingLayout__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./components/ZegoScreenSharingLayout */ \"./src/sdk/view/pages/ZegoRoom/components/ZegoScreenSharingLayout.tsx\");\n/* harmony import */ var _context_showManage__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./context/showManage */ \"./src/sdk/view/pages/ZegoRoom/context/showManage.ts\");\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\nvar ZegoRoom = /** @class */ (function (_super) {\n __extends(ZegoRoom, _super);\n function ZegoRoom() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.state = {\n localStream: undefined,\n layOutStatus: \"ONE_VIDEO\",\n zegoCloudUserList: [],\n messageList: [],\n notificationList: [],\n micOpen: !!_this.props.core._config.turnOnMicrophoneWhenJoining,\n cameraOpen: !!_this.props.core._config.turnOnCameraWhenJoining,\n showSettings: false,\n isNetworkPoor: false,\n connecting: false,\n firstLoading: true,\n selectMic: _this.props.core.status.micDeviceID,\n selectSpeaker: _this.props.core.status.speakerDeviceID,\n selectCamera: _this.props.core.status.cameraDeviceID,\n selectVideoResolution: _this.props.core.status.videoResolution || \"360\",\n videoShowNumber: 9,\n gridRowNumber: 3,\n layout: _this.props.core._config.layout || \"Auto\",\n showLayoutSettingsModel: false,\n isLayoutChanging: false,\n soundLevel: {},\n showNonVideoUser: _this.props.core._config.showNonVideoUser,\n liveCountdown: -1,\n liveStatus: 0,\n isScreenSharingBySelf: false,\n screenSharingStream: undefined,\n screenSharingUserList: [],\n };\n _this.settingsRef = react__WEBPACK_IMPORTED_MODULE_1___default().createRef();\n _this.moreRef = react__WEBPACK_IMPORTED_MODULE_1___default().createRef();\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.msgDelayed = true; // 5s不显示\n _this.localUserPin = false;\n _this.localStreamID = \"\";\n _this.screenSharingStreamID = \"\";\n _this.isCreatingScreenSharing = false;\n _this.fullScreen = false;\n _this.userUpdateCallBack = function () { };\n _this.onOpenSettings = function (event) {\n var _a, _b;\n if (_this.settingsRef.current === event.target ||\n ((_a = _this.settingsRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target)) ||\n _this.moreRef.current === event.target ||\n ((_b = _this.moreRef.current) === null || _b === void 0 ? void 0 : _b.contains(event.target))) {\n }\n else {\n _this.setState({\n showSettings: false,\n });\n }\n };\n _this.onWindowResize = (0,_util__WEBPACK_IMPORTED_MODULE_7__.throttle)(_this.computeByResize.bind(_this), 500);\n return _this;\n }\n ZegoRoom.prototype.componentDidMount = function () {\n var _this = this;\n var _a, _b, _c;\n this.computeByResize();\n setTimeout(function () {\n _this.msgDelayed = false;\n }, 5000);\n this.initSDK();\n // 点击其他区域时, 隐藏更多弹窗)\n document.addEventListener(\"click\", this.onOpenSettings);\n window.addEventListener(\"resize\", this.onWindowResize.bind(this));\n ((_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.toggleLayOut(\"MESSAGE\");\n };\n ZegoRoom.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 this.notifyTimer && clearTimeout(this.notifyTimer);\n this.notifyTimer = setTimeout(function () {\n _this.setState({\n notificationList: [],\n });\n }, 3000);\n }\n if (preState.layout !== this.state.layout ||\n preState.isScreenSharingBySelf !== this.state.isScreenSharingBySelf) {\n this.computeByResize();\n }\n if (preState.videoShowNumber !== this.state.videoShowNumber) {\n if (preState.zegoCloudUserList === this.state.zegoCloudUserList) {\n this.userUpdateCallBack();\n }\n }\n };\n ZegoRoom.prototype.componentWillUnmount = function () {\n document.removeEventListener(\"click\", this.onOpenSettings);\n window.removeEventListener(\"resize\", this.onWindowResize.bind(this));\n };\n ZegoRoom.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\" && type === \"ROOM\") {\n _this.props.core.leaveRoom();\n _this.props.leaveRoom && _this.props.leaveRoom();\n }\n else if (status === \"CONNECTING\" && type !== \"STREAM\") {\n _this.setState({\n connecting: true,\n });\n }\n else {\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.forEach(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_7__.randomNumber)(5),\n });\n });\n }\n _this.setState(function (state) {\n return {\n notificationList: __spreadArray(__spreadArray([], state.notificationList, true), notificationList, true),\n };\n });\n _this.computeByResize();\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 _this.setState({\n zegoCloudUserList: userList,\n });\n });\n this.props.core.onRoomLiveStateUpdate(function (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 });\n });\n this.props.core.subscribeScreenStream(function (userList) {\n _this.setState({ screenSharingUserList: userList }, function () {\n _this.computeByResize();\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.onScreenSharingEnded(function (stream) {\n if (stream === _this.state.screenSharingStream) {\n _this.closeScreenSharing();\n }\n });\n return [4 /*yield*/, this.props.core.enterRoom()];\n case 1:\n logInRsp = _a.sent();\n logInRsp === 0 && this.createStream();\n return [2 /*return*/];\n }\n });\n });\n };\n ZegoRoom.prototype.createStream = function () {\n return __awaiter(this, void 0, void 0, function () {\n var solution, localStream, res, error_1;\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*/, 5];\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n solution = (0,_util__WEBPACK_IMPORTED_MODULE_7__.getVideoResolution)(this.state.selectVideoResolution);\n return [4 /*yield*/, this.props.core.createStream({\n camera: __assign({ video: !this.props.core.status.videoRefuse, audio: !this.props.core.status.audioRefuse, videoInput: this.state.selectCamera, audioInput: this.state.selectMic, videoQuality: 4 }, solution),\n })];\n case 2:\n localStream = _a.sent();\n this.props.core.enableVideoCaptureDevice(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 3:\n error_1 = _a.sent();\n console.error(\"【ZEGOCLOUD】createStream or publishLocalStream failed,Reason: \", JSON.stringify(error_1));\n return [2 /*return*/, false];\n case 4: return [3 /*break*/, 6];\n case 5: return [2 /*return*/, false];\n case 6: return [2 /*return*/];\n }\n });\n });\n };\n ZegoRoom.prototype.toggleMic = function () {\n return __awaiter(this, void 0, void 0, function () {\n var result;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (this.props.core.status.audioRefuse) {\n (0,_components_zegoModel__WEBPACK_IMPORTED_MODULE_9__.ZegoModelShow)({\n header: \"Equipment authorization\",\n contentText: \"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 okText: \"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_zegoToast__WEBPACK_IMPORTED_MODULE_10__.ZegoToast)({\n content: \"The microphone is \" + (this.micStatus ? \"on\" : \"off\"),\n });\n result &&\n this.setState({\n micOpen: !!this.micStatus,\n });\n }\n return [2 /*return*/];\n }\n });\n });\n };\n ZegoRoom.prototype.toggleCamera = function () {\n return __awaiter(this, void 0, void 0, function () {\n var result;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (this.props.core.status.videoRefuse) {\n (0,_components_zegoModel__WEBPACK_IMPORTED_MODULE_9__.ZegoModelShow)({\n header: \"Equipment authorization\",\n contentText: \"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 okText: \"Okay\",\n });\n return [2 /*return*/, Promise.resolve(false)];\n }\n if (this.cameraStatus === -1)\n return [2 /*return*/, Promise.resolve(false)];\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.enableVideoCaptureDevice(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_zegoToast__WEBPACK_IMPORTED_MODULE_10__.ZegoToast)({\n content: \"The camera is \" + (this.cameraStatus ? \"on\" : \"off\"),\n });\n result &&\n this.setState({\n cameraOpen: !!this.cameraStatus,\n });\n }\n return [2 /*return*/, !!result];\n }\n });\n });\n };\n ZegoRoom.prototype.toggleScreenSharing = function () {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n if (this.state.isScreenSharingBySelf) {\n this.closeScreenSharing();\n }\n else {\n this.createScreenSharing();\n }\n return [2 /*return*/];\n });\n });\n };\n ZegoRoom.prototype.createScreenSharing = function () {\n return __awaiter(this, void 0, void 0, function () {\n var screenSharingStream, streamID, error_2;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (this.state.screenSharingUserList.length > 0) {\n (0,_components_zegoToast__WEBPACK_IMPORTED_MODULE_10__.ZegoToast)({\n content: \"\".concat(this.state.screenSharingUserList[0].userName, \" is presenting now. You cannot share your screen.\"),\n });\n return [2 /*return*/];\n }\n if (this.isCreatingScreenSharing)\n return [2 /*return*/];\n this.isCreatingScreenSharing = true;\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, this.props.core.createStream({\n screen: { videoQuality: 2, bitRate: 1500, frameRate: 15, audio: true },\n })];\n case 2:\n screenSharingStream = _a.sent();\n streamID = this.props.core.publishLocalStream(screenSharingStream, \"screensharing\");\n streamID && (this.screenSharingStreamID = streamID);\n this.setState({\n isScreenSharingBySelf: true,\n screenSharingStream: screenSharingStream,\n });\n return [3 /*break*/, 4];\n case 3:\n error_2 = _a.sent();\n if ((error_2 === null || error_2 === void 0 ? void 0 : error_2.code) === 1103043) {\n (0,_components_zegoModel__WEBPACK_IMPORTED_MODULE_9__.ZegoModelShow)({\n header: \"Notice\",\n contentText: \"Your browser does not support screen sharing.\",\n okText: \"Okay\",\n });\n }\n else if ((error_2 === null || error_2 === void 0 ? void 0 : error_2.code) === 1103010 && (error_2 === null || error_2 === void 0 ? void 0 : error_2.msg.includes(\"Permission\"))) {\n (0,_components_zegoModel__WEBPACK_IMPORTED_MODULE_9__.ZegoModelShow)({\n header: \"Grant access to share your screen\",\n contentText: \"Your system does not have access to share a screen from the browser. Please grant access to share your screen on your system settings.\",\n okText: \"Okay\",\n });\n }\n else if ((error_2 === null || error_2 === void 0 ? void 0 : error_2.code) !== 1103042) {\n (0,_components_zegoToast__WEBPACK_IMPORTED_MODULE_10__.ZegoToast)({\n content: \"Failed to present your screen. error code: \".concat((error_2 === null || error_2 === void 0 ? void 0 : error_2.code) || -1),\n });\n }\n return [3 /*break*/, 4];\n case 4:\n this.isCreatingScreenSharing = false;\n return [2 /*return*/];\n }\n });\n });\n };\n ZegoRoom.prototype.closeScreenSharing = function () {\n try {\n this.screenSharingStreamID &&\n this.props.core.stopPublishingStream(this.screenSharingStreamID);\n this.state.screenSharingStream &&\n this.props.core.destroyStream(this.state.screenSharingStream);\n this.setState({\n isScreenSharingBySelf: false,\n });\n }\n catch (error) {\n console.error(error);\n }\n };\n ZegoRoom.prototype.toggleLayOut = function (layOutStatus) {\n var _this = this;\n this.setState(function (state) {\n return {\n layOutStatus: state.layOutStatus === layOutStatus ? \"ONE_VIDEO\" : layOutStatus,\n };\n }, function () {\n _this.computeByResize();\n });\n };\n ZegoRoom.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_7__.randomNumber)(5);\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 === null || resp === void 0 ? void 0 : 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 ZegoRoom.prototype.openSettings = function () {\n this.setState({\n showSettings: !this.state.showSettings,\n });\n };\n ZegoRoom.prototype.handleSetting = function () {\n var _this = this;\n (0,_components_zegoSetting__WEBPACK_IMPORTED_MODULE_8__.ZegoSettingsAlert)({\n core: this.props.core,\n theme: \"black\",\n initDevices: {\n mic: this.state.selectMic,\n cam: this.state.selectCamera,\n speaker: this.state.selectSpeaker,\n videoResolve: this.state.selectVideoResolution,\n showNonVideoUser: this.state.showNonVideoUser,\n },\n closeCallBack: function () { },\n onMicChange: function (deviceID) {\n _this.setState({\n selectMic: deviceID,\n }, function () {\n if (_this.state.localStream) {\n _this.props.core.useMicrophoneDevice(_this.state.localStream, deviceID);\n }\n });\n },\n onCameraChange: function (deviceID) {\n _this.setState({\n selectCamera: deviceID,\n }, function () { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!this.state.localStream) return [3 /*break*/, 2];\n return [4 /*yield*/, this.props.core.useCameraDevice(this.state.localStream, deviceID)];\n case 1:\n _a.sent();\n this.setState({\n cameraOpen: true,\n });\n _a.label = 2;\n case 2: return [2 /*return*/];\n }\n });\n }); });\n },\n onSpeakerChange: function (deviceID) {\n _this.setState({\n selectSpeaker: deviceID,\n }, function () {\n document\n .querySelectorAll(\"video\")\n .forEach(function (el) { return el.setSinkId(deviceID); });\n });\n },\n onVideoResolutionChange: function (level) {\n _this.setState({\n selectVideoResolution: level,\n }, function () {\n if (_this.state.localStream) {\n var _a = (0,_util__WEBPACK_IMPORTED_MODULE_7__.getVideoResolution)(level), width = _a.width, height = _a.height, bitrate = _a.bitrate, frameRate = _a.frameRate;\n _this.props.core.setVideoConfig(_this.state.localStream, {\n width: width,\n height: height,\n maxBitrate: bitrate,\n frameRate: frameRate,\n });\n }\n });\n },\n onShowNonVideoChange: function (selected) {\n _this.props.core._config.showNonVideoUser = selected;\n _this.props.core.setShowNonVideo(selected);\n _this.setState({\n showNonVideoUser: selected,\n });\n },\n });\n };\n ZegoRoom.prototype.handleLeave = function () {\n var _this = this;\n (0,_components_zegoModel__WEBPACK_IMPORTED_MODULE_9__.ZegoModelShow)({\n header: \"Leave the room\",\n contentText: \"Are you sure to leave the room?\",\n okText: \"Confirm\",\n cancelText: \"Cancel\",\n onOk: function () {\n _this.props.core._config.turnOnCameraWhenJoining = _this.state.cameraOpen;\n _this.props.core._config.turnOnMicrophoneWhenJoining =\n _this.state.micOpen;\n _this.props.core.status.micDeviceID = _this.state.selectMic;\n _this.props.core.status.cameraDeviceID = _this.state.selectCamera;\n _this.props.core.status.speakerDeviceID = _this.state.selectSpeaker;\n _this.props.core.status.videoResolution =\n _this.state.selectVideoResolution;\n _this.leaveRoom();\n },\n });\n };\n ZegoRoom.prototype.leaveRoom = function () {\n this.state.isScreenSharingBySelf && this.closeScreenSharing();\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 ZegoRoom.prototype.computeByResize = function () {\n var _a, _b, _c, _d;\n return __awaiter(this, void 0, void 0, function () {\n var width, height, videoShowNumber, gridRowNumber, showSelf, videWrapHight, n, videWrapHight, n, videoWrapWidth, n, videoWrapWidth, n;\n return __generator(this, function (_e) {\n switch (_e.label) {\n case 0:\n width = Math.max(document.body.clientWidth, 826);\n height = Math.max(document.body.clientHeight, 280);\n videoShowNumber = 0, gridRowNumber = 0;\n showSelf = this.props.core._config.showNonVideoUser || this.state.localStream;\n if (!(this.getScreenSharingUser.length > 0)) return [3 /*break*/, 6];\n videWrapHight = height - (((_a = this.props.core._config.branding) === null || _a === void 0 ? void 0 : _a.logoURL) ? 64 : 0) - 84 - 38;\n n = parseInt(String(videWrapHight / 124)) || 1;\n videoShowNumber = Math.min(n * 124 + (n - 1) * 10 <= videWrapHight ? n : n - 1 || 1, 5);\n this.setState({\n videoShowNumber: videoShowNumber,\n });\n return [4 /*yield*/, this.props.core.setSidebarLayOut(false)];\n case 1:\n _e.sent();\n if (!this.fullScreen) return [3 /*break*/, 3];\n return [4 /*yield*/, this.props.core.setMaxScreenNum(0)];\n case 2:\n _e.sent();\n return [3 /*break*/, 5];\n case 3: return [4 /*yield*/, this.props.core.setMaxScreenNum(showSelf ? videoShowNumber - 1 : videoShowNumber)];\n case 4:\n _e.sent();\n _e.label = 5;\n case 5: return [2 /*return*/];\n case 6:\n if (!(this.state.layout === \"Sidebar\")) return [3 /*break*/, 9];\n videWrapHight = height - (((_b = this.props.core._config.branding) === null || _b === void 0 ? void 0 : _b.logoURL) ? 64 : 0) - 84;\n n = parseInt(String(videWrapHight / 124)) || 1;\n videoShowNumber = Math.min(n * 124 + (n - 1) * 10 <= videWrapHight ? n : n - 1 || 1, 5);\n return [4 /*yield*/, this.props.core.setSidebarLayOut(!this.localUserPin)];\n case 7:\n _e.sent();\n this.setState({\n videoShowNumber: videoShowNumber,\n });\n return [4 /*yield*/, this.props.core.setMaxScreenNum(showSelf ? videoShowNumber : videoShowNumber + 1)];\n case 8:\n _e.sent();\n return [2 /*return*/];\n case 9:\n if (!(this.state.layout === \"Grid\" || this.state.layout === \"Auto\")) return [3 /*break*/, 12];\n if (height < 406 - (((_c = this.props.core._config.branding) === null || _c === void 0 ? void 0 : _c.logoURL) ? 0 : 64)) {\n videoWrapWidth = width - 32 - (this.state.layOutStatus === \"ONE_VIDEO\" ? 0 : 350);\n n = parseInt(String(videoWrapWidth / 160));\n videoShowNumber = Math.min(n * 160 + (n - 1) * 10 <= videoWrapWidth ? n : n - 1, 10);\n gridRowNumber = 1;\n }\n else if (height <\n 540 - (((_d = this.props.core._config.branding) === null || _d === void 0 ? void 0 : _d.logoURL) ? 0 : 64)) {\n videoWrapWidth = width - 32 - (this.state.layOutStatus === \"ONE_VIDEO\" ? 0 : 350);\n n = parseInt(String(videoWrapWidth / 124));\n videoShowNumber = Math.min(n * 124 + (n - 1) * 10 <= videoWrapWidth ? 2 * n : 2 * (n - 1), 10);\n gridRowNumber = 2;\n }\n else {\n videoShowNumber = 9;\n gridRowNumber = 3;\n }\n return [4 /*yield*/, this.props.core.setSidebarLayOut(false)];\n case 10:\n _e.sent();\n this.setState({\n videoShowNumber: videoShowNumber,\n gridRowNumber: gridRowNumber,\n });\n return [4 /*yield*/, this.props.core.setMaxScreenNum(showSelf ? videoShowNumber - 1 : videoShowNumber)];\n case 11:\n _e.sent();\n return [2 /*return*/];\n case 12: return [2 /*return*/];\n }\n });\n });\n };\n ZegoRoom.prototype.showLayoutSettings = function (show) {\n this.setState({\n showLayoutSettingsModel: show,\n });\n };\n ZegoRoom.prototype.changeLayout = function (type) {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n if (this.state.isLayoutChanging)\n return [2 /*return*/];\n return [2 /*return*/, new Promise(function (resolve, reject) {\n _this.userUpdateCallBack = function () {\n _this.setState({\n isLayoutChanging: false,\n });\n resolve(true);\n };\n if (type === \"Grid\" || type === \"Auto\") {\n _this.props.core.setPin();\n _this.localUserPin = false;\n }\n _this.setState({\n isLayoutChanging: true,\n layout: type,\n });\n _this.props.core.setSidebarLayOut(type === \"Sidebar\");\n setTimeout(function () {\n _this.setState({\n isLayoutChanging: false,\n });\n resolve(false);\n }, 5000);\n })];\n });\n });\n };\n ZegoRoom.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 ZegoRoom.prototype.getShownUser = function (forceShowNonVideoUser) {\n var _this = this;\n if (forceShowNonVideoUser === void 0) { forceShowNonVideoUser = false; }\n var shownUser = this.getAllUser().filter(function (item) {\n if (!_this.props.core._config.showNonVideoUser && !forceShowNonVideoUser) {\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 Object.defineProperty(ZegoRoom.prototype, \"getScreenSharingUser\", {\n get: function () {\n if (this.state.isScreenSharingBySelf) {\n return [\n {\n userID: this.props.core._expressConfig.userID,\n userName: this.props.core._expressConfig.userName,\n pin: false,\n streamList: [\n {\n media: this.state.screenSharingStream,\n fromUser: {\n userID: this.props.core._expressConfig.userID,\n userName: this.props.core._expressConfig.userName,\n },\n micStatus: \"OPEN\",\n cameraStatus: \"OPEN\",\n state: \"PLAYING\",\n streamID: this.screenSharingStreamID,\n },\n ],\n },\n ];\n }\n else {\n return this.state.screenSharingUserList;\n }\n },\n enumerable: false,\n configurable: true\n });\n ZegoRoom.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, 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 ZegoRoom.prototype.getLayoutScreen = function () {\n var _this = this;\n var _a, _b, _c;\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: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].liveNotStart }, { 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.getScreenSharingUser, 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: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].noOneStreaming }, { 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.getScreenSharingUser.length > 0) {\n return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, { children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_ZegoScreenSharingLayout__WEBPACK_IMPORTED_MODULE_15__.ZegoScreenSharingLayout, { handleSetPin: function (userID) {\n _this.handleSetPin(userID);\n }, userList: this.getShownUser(), videoShowNumber: this.state.videoShowNumber, selfInfo: {\n userID: this.props.core._expressConfig.userID,\n }, screenSharingUser: this.getScreenSharingUser[0], soundLevel: this.state.soundLevel, handleFullScreen: this.handleFullScreen.bind(this), roomID: this.props.core._expressConfig.roomID }) }));\n }\n if ((this.state.layout === \"Auto\" && 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_5__.ZegoOne2One, { onLocalStreamPaused: function () { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.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 }); }, selfInfo: {\n userID: this.props.core._expressConfig.userID,\n }, handleSetPin: function (userID) {\n _this.handleSetPin(userID);\n }, userList: this.getShownUser(), soundLevel: this.state.soundLevel }));\n }\n if ((this.state.layout === \"Grid\" && this.getShownUser().length > 1) ||\n (this.state.layout === \"Auto\" && this.getShownUser().length > 2)) {\n return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_zegoGridLayout__WEBPACK_IMPORTED_MODULE_11__.ZegoGridLayout, { userList: this.getShownUser(), videoShowNumber: this.state.videoShowNumber, gridRowNumber: this.state.gridRowNumber, selfInfo: {\n userID: this.props.core._expressConfig.userID,\n }, handleSetPin: function (userID) {\n _this.handleSetPin(userID);\n }, soundLevel: this.state.soundLevel }));\n }\n if (this.state.layout === \"Sidebar\" && this.getShownUser().length > 1) {\n return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_zegoSidebarLayout__WEBPACK_IMPORTED_MODULE_12__.ZegoSidebarLayout, { handleSetPin: function (userID) {\n _this.handleSetPin(userID);\n }, userList: this.getShownUser(), videoShowNumber: this.state.videoShowNumber, selfInfo: {\n userID: this.props.core._expressConfig.userID,\n }, soundLevel: this.state.soundLevel }));\n }\n };\n ZegoRoom.prototype.handleSetPin = function (userID) {\n if (userID === this.props.core._expressConfig.userID) {\n this.localUserPin = !this.localUserPin;\n this.props.core.setPin();\n }\n else {\n this.localUserPin = false;\n this.props.core.setPin(userID);\n }\n this.props.core.setSidebarLayOut(this.getScreenSharingUser.length > 0 ? false : this.localUserPin === false);\n this.setState({ layout: \"Sidebar\" });\n };\n ZegoRoom.prototype.handleFullScreen = function (fullScreen) {\n this.fullScreen = fullScreen;\n this.computeByResize();\n };\n ZegoRoom.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_9__.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 ZegoRoom.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 ZegoRoom.prototype.render = function () {\n var _this = this;\n var _a, _b, _c, _d, _e, _f, _g, _h, _j;\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 showPinButton: !!this.props.core._config.showPinButton,\n } }, { children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].ZegoRoom }, { children: [(((_a = this.props.core._config.branding) === null || _a === void 0 ? void 0 : _a.logoURL) ||\n this.props.core._config.roomTimerDisplayed) && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].header }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].headerLeft }, { children: [((_b = this.props.core._config.branding) === null || _b === void 0 ? void 0 : _b.logoURL) && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"img\", { className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].logo, src: (_c = this.props.core._config.branding) === null || _c === void 0 ? void 0 : _c.logoURL, alt: \"logo\" })), ((_d = this.props.core._config.scenario) === null || _d === void 0 ? void 0 : _d.mode) ===\n _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.LiveStreaming &&\n (this.state.liveCountdown === 0 ||\n this.state.liveStatus == 1) && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].liveState }, { children: \"Live\" })))] })), ((_e = this.props.core._config.scenario) === null || _e === void 0 ? void 0 : _e.mode) ===\n _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.LiveStreaming &&\n ((_g = (_f = this.props.core._config.scenario) === null || _f === void 0 ? void 0 : _f.config) === null || _g === void 0 ? void 0 : _g.role) ===\n _model__WEBPACK_IMPORTED_MODULE_2__.LiveRole.Host && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"button\", __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 broadcast\"\n : \"start stream\" }))), this.props.core._config.roomTimerDisplayed && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_zegoTimer__WEBPACK_IMPORTED_MODULE_4__.ZegoTimer, {}))] }))), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].content }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].contentLeft }, { children: [this.getLayoutScreen(), 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\n .slice(startIndex)\n .map(function (notify, index) {\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 })] }), index));\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\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].nowrap }, { children: notify.content })) }), index));\n }\n }) })), this.state.isNetworkPoor && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", { className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].network }))] })), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].contentRight, style: {\n display: this.state.layOutStatus !== \"ONE_VIDEO\" ? \"flex\" : \"none\",\n } }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].listHeader }, { children: [this.state.layOutStatus === \"INVITE\" && \"Room details\", this.state.layOutStatus === \"USER_LIST\" && \"Room members\", this.state.layOutStatus === \"MESSAGE\" && \"Room messages\", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", { className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].listHeaderClose, onClick: function () {\n _this.setState({\n layOutStatus: \"ONE_VIDEO\",\n });\n } })] })), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].listContent }, { children: [this.state.layOutStatus === \"INVITE\" && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_zegoRoomInvite__WEBPACK_IMPORTED_MODULE_13__.ZegoRoomInvite, { core: this.props.core })), this.state.layOutStatus === \"USER_LIST\" && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_zegoUserList__WEBPACK_IMPORTED_MODULE_14__.ZegoUserList, { core: this.props.core, userList: this.getShownUser(true), selfUserID: this.props.core._expressConfig.userID, handleSetPin: this.handleSetPin.bind(this), soundLevel: this.state.soundLevel })), this.state.layOutStatus === \"MESSAGE\" && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_zegoMessage__WEBPACK_IMPORTED_MODULE_6__.ZegoMessage, { messageList: this.state.messageList, sendMessage: function (msg) {\n _this.sendMessage(msg);\n }, selfUserID: this.props.core._expressConfig.userID }))] }))] }))] })), this.getScreenSharingUser.length > 0 && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].screenBottomBar }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].screenBottomBarLeft }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", {}), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"p\", { children: this.state.isScreenSharingBySelf\n ? \"You’re presenting to everyone\"\n : \"\".concat(this.state.screenSharingUserList[0].userName, \" is presenting the screen\") })] })), this.state.isScreenSharingBySelf && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].screenBottomBarRight, onClick: function () {\n _this.toggleScreenSharing();\n } }, { children: \"Stop Presenting\" })))] }))), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].footer }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].handlerMiddle }, { children: [this.props.core._config.showMyMicrophoneToggleButton && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", { className: \"\".concat(_index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].micButton, \" \").concat(!this.state.micOpen && _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].close), onClick: function () {\n _this.toggleMic();\n } })), this.props.core._config.showMyCameraToggleButton && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", { className: \"\".concat(_index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].cameraButton, \" \").concat(!this.state.cameraOpen && _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].close), onClick: function () {\n _this.toggleCamera();\n } })), this.props.core._config.showScreenSharingButton && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", { className: \"\".concat(_index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].screenButton, \" \").concat(this.state.isScreenSharingBySelf && _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].sharing), onClick: function () {\n _this.toggleScreenSharing();\n } })), (this.props.core._config.showAudioVideoSettingsButton ||\n this.props.core._config.showLayoutButton) && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", __assign({ ref: this.moreRef, className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].moreButton, onClick: function () {\n _this.openSettings();\n } }, { children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].settingsButtonModel, style: {\n display: this.state.showSettings ? \"block\" : \"none\",\n }, ref: this.settingsRef }, { children: [this.props.core._config.showLayoutButton && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", __assign({ onClick: function () { return _this.showLayoutSettings(true); } }, { children: \"Change layout\" }))), this.props.core._config.showAudioVideoSettingsButton &&\n this.props.core._config.showLayoutButton && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", {}), this.props.core._config.showAudioVideoSettingsButton && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", __assign({ onClick: function () { return _this.handleSetting(); } }, { children: \"Settings\" })))] })) }))), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", { className: ((_h = this.props.core._config.scenario) === null || _h === void 0 ? void 0 : _h.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\"].leaveButton, onClick: function () {\n _this.handleLeave();\n } })] })), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].handlerRight }, { children: [((_j = this.props.core._config.preJoinViewConfig) === null || _j === void 0 ? void 0 : _j.invitationLink) && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", { className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].inviteButton, onClick: function () {\n _this.toggleLayOut(\"INVITE\");\n } })), this.props.core._config.showUserList && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].memberButton, onClick: function () {\n _this.toggleLayOut(\"USER_LIST\");\n } }, { children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].memberNum }, { children: this.state.zegoCloudUserList.length > 99\n ? \"99+\"\n : this.state.zegoCloudUserList.length + 1 })) }))), this.props.core._config.showTextChat && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", { className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].msgButton, onClick: function () {\n _this.toggleLayOut(\"MESSAGE\");\n } }))] }))] })), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].reconnect, style: {\n display: this.state.connecting ? \"flex\" : \"none\",\n backgroundColor: this.state.firstLoading ? \"#1C1F2E\" : \"\",\n } }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", {}), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"p\", { children: this.state.firstLoading\n ? \"Joining Room\"\n : \"There's something wrong with your network. Trying to reconnect...\" })] })), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].countDown, style: {\n display: this.state.liveCountdown > 0 ? \"flex\" : \"none\",\n backgroundColor: \"#1C1F2E\",\n } }, { children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", { children: this.state.liveCountdown }) })), this.state.showLayoutSettingsModel && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layoutSettingsMask }, { children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layoutSettingsWrapper }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layoutSettingsHeader }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"p\", { children: \"Change layout\" }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", { className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layoutSettingsCloseIcon, onClick: function () { return _this.showLayoutSettings(false); } })] })), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layoutSettingsContent }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layoutSettingsItemRow, onClick: function () { return _this.changeLayout(\"Auto\"); } }, { children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"p\", { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", { className: \"\".concat(_index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layoutSettingsItemIcon, \" \").concat(this.state.layout === \"Auto\"\n ? _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layoutSettingsItemChecked\n : \"\", \" \").concat(this.state.isLayoutChanging &&\n this.state.layout === \"Auto\"\n ? _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layoutSettingsItemLoading\n : \"\") }), \"Auto\"] }) })), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layoutSettingsItemRow, onClick: function () { return _this.changeLayout(\"Grid\"); } }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"p\", { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", { className: \"\".concat(_index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layoutSettingsItemIcon, \" \").concat(this.state.layout === \"Grid\"\n ? _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layoutSettingsItemChecked\n : \"\", \" \").concat(this.state.isLayoutChanging &&\n this.state.layout === \"Grid\"\n ? _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layoutSettingsItemLoading\n : \"\") }), \"Grid\"] }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"img\", { src: __webpack_require__(/*! ../../../sdkAssets/img_layout_grid@2x.png */ \"./src/sdk/sdkAssets/img_layout_grid@2x.png\"), alt: \"grid layout\" })] })), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layoutSettingsItemRow, onClick: function () { return _this.changeLayout(\"Sidebar\"); } }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"p\", { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", { className: \"\".concat(_index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layoutSettingsItemIcon, \" \").concat(this.state.layout === \"Sidebar\"\n ? _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layoutSettingsItemChecked\n : \"\", \" \").concat(this.state.isLayoutChanging &&\n this.state.layout === \"Sidebar\"\n ? _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layoutSettingsItemLoading\n : \"\") }), \"Sidebar\"] }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"img\", { src: __webpack_require__(/*! ../../../sdkAssets/img_layout_sidebar@2x.png */ \"./src/sdk/sdkAssets/img_layout_sidebar@2x.png\"), alt: \"Sidebar layout\" })] }))] }))] })) })))] })) })));\n };\n return ZegoRoom;\n}((react__WEBPACK_IMPORTED_MODULE_1___default().Component)));\n\n\n\n//# sourceURL=webpack://zegocloud_client_sdk_web/./src/sdk/view/pages/ZegoRoom/index.tsx?");
|
|
1756
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ZegoRoom\": function() { return /* binding */ ZegoRoom; }\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/ZegoRoom/index.module.scss\");\n/* harmony import */ var _components_zegoTimer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./components/zegoTimer */ \"./src/sdk/view/pages/ZegoRoom/components/zegoTimer.tsx\");\n/* harmony import */ var _components_zegoOne2One__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./components/zegoOne2One */ \"./src/sdk/view/pages/ZegoRoom/components/zegoOne2One.tsx\");\n/* harmony import */ var _components_zegoMessage__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./components/zegoMessage */ \"./src/sdk/view/pages/ZegoRoom/components/zegoMessage.tsx\");\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../util */ \"./src/sdk/util.ts\");\n/* harmony import */ var _components_zegoSetting__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../components/zegoSetting */ \"./src/sdk/view/components/zegoSetting/index.tsx\");\n/* harmony import */ var _components_zegoModel__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../components/zegoModel */ \"./src/sdk/view/components/zegoModel/index.tsx\");\n/* harmony import */ var _components_zegoToast__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../components/zegoToast */ \"./src/sdk/view/components/zegoToast/index.tsx\");\n/* harmony import */ var _components_zegoGridLayout__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./components/zegoGridLayout */ \"./src/sdk/view/pages/ZegoRoom/components/zegoGridLayout.tsx\");\n/* harmony import */ var _components_zegoSidebarLayout__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./components/zegoSidebarLayout */ \"./src/sdk/view/pages/ZegoRoom/components/zegoSidebarLayout.tsx\");\n/* harmony import */ var _components_zegoRoomInvite__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./components/zegoRoomInvite */ \"./src/sdk/view/pages/ZegoRoom/components/zegoRoomInvite.tsx\");\n/* harmony import */ var _components_zegoUserList__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./components/zegoUserList */ \"./src/sdk/view/pages/ZegoRoom/components/zegoUserList.tsx\");\n/* harmony import */ var _components_ZegoScreenSharingLayout__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./components/ZegoScreenSharingLayout */ \"./src/sdk/view/pages/ZegoRoom/components/ZegoScreenSharingLayout.tsx\");\n/* harmony import */ var _context_showManage__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./context/showManage */ \"./src/sdk/view/pages/ZegoRoom/context/showManage.ts\");\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\nvar ZegoRoom = /** @class */ (function (_super) {\n __extends(ZegoRoom, _super);\n function ZegoRoom() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.state = {\n localStream: undefined,\n layOutStatus: \"ONE_VIDEO\",\n zegoCloudUserList: [],\n messageList: [],\n notificationList: [],\n micOpen: !!_this.props.core._config.turnOnMicrophoneWhenJoining,\n cameraOpen: !!_this.props.core._config.turnOnCameraWhenJoining,\n showSettings: false,\n isNetworkPoor: false,\n connecting: false,\n firstLoading: true,\n selectMic: _this.props.core.status.micDeviceID,\n selectSpeaker: _this.props.core.status.speakerDeviceID,\n selectCamera: _this.props.core.status.cameraDeviceID,\n selectVideoResolution: _this.props.core.status.videoResolution || \"360\",\n videoShowNumber: 9,\n gridRowNumber: 3,\n layout: _this.props.core._config.layout || \"Auto\",\n showLayoutSettingsModel: false,\n isLayoutChanging: false,\n soundLevel: {},\n showNonVideoUser: _this.props.core._config.showNonVideoUser,\n liveCountdown: -1,\n liveStatus: 0,\n isScreenSharingBySelf: false,\n screenSharingStream: undefined,\n screenSharingUserList: [],\n };\n _this.settingsRef = react__WEBPACK_IMPORTED_MODULE_1___default().createRef();\n _this.moreRef = react__WEBPACK_IMPORTED_MODULE_1___default().createRef();\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.msgDelayed = true; // 5s不显示\n _this.localUserPin = false;\n _this.localStreamID = \"\";\n _this.screenSharingStreamID = \"\";\n _this.isCreatingScreenSharing = false;\n _this.fullScreen = false;\n _this.userUpdateCallBack = function () { };\n _this.onOpenSettings = function (event) {\n var _a, _b;\n if (_this.settingsRef.current === event.target ||\n ((_a = _this.settingsRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target)) ||\n _this.moreRef.current === event.target ||\n ((_b = _this.moreRef.current) === null || _b === void 0 ? void 0 : _b.contains(event.target))) {\n }\n else {\n _this.setState({\n showSettings: false,\n });\n }\n };\n _this.onWindowResize = (0,_util__WEBPACK_IMPORTED_MODULE_7__.throttle)(_this.computeByResize.bind(_this), 500);\n return _this;\n }\n ZegoRoom.prototype.componentDidMount = function () {\n var _this = this;\n var _a, _b, _c;\n this.computeByResize();\n setTimeout(function () {\n _this.msgDelayed = false;\n }, 5000);\n this.initSDK();\n // 点击其他区域时, 隐藏更多弹窗)\n document.addEventListener(\"click\", this.onOpenSettings);\n window.addEventListener(\"resize\", this.onWindowResize.bind(this));\n ((_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.toggleLayOut(\"MESSAGE\");\n };\n ZegoRoom.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 this.notifyTimer && clearTimeout(this.notifyTimer);\n this.notifyTimer = setTimeout(function () {\n _this.setState({\n notificationList: [],\n });\n }, 3000);\n }\n if (preState.layout !== this.state.layout ||\n preState.isScreenSharingBySelf !== this.state.isScreenSharingBySelf) {\n this.computeByResize();\n }\n if (preState.videoShowNumber !== this.state.videoShowNumber) {\n if (preState.zegoCloudUserList === this.state.zegoCloudUserList) {\n this.userUpdateCallBack();\n }\n }\n };\n ZegoRoom.prototype.componentWillUnmount = function () {\n document.removeEventListener(\"click\", this.onOpenSettings);\n window.removeEventListener(\"resize\", this.onWindowResize.bind(this));\n };\n ZegoRoom.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\" && type === \"ROOM\") {\n _this.props.core.leaveRoom();\n _this.props.leaveRoom && _this.props.leaveRoom();\n }\n else if (status === \"CONNECTING\" && type !== \"STREAM\") {\n _this.setState({\n connecting: true,\n });\n }\n else {\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.forEach(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_7__.randomNumber)(5),\n });\n });\n }\n _this.setState(function (state) {\n return {\n notificationList: __spreadArray(__spreadArray([], state.notificationList, true), notificationList, true),\n };\n });\n _this.computeByResize();\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 _this.setState({\n zegoCloudUserList: userList,\n });\n });\n this.props.core.onRoomLiveStateUpdate(function (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 });\n });\n this.props.core.subscribeScreenStream(function (userList) {\n _this.setState({ screenSharingUserList: userList }, function () {\n _this.computeByResize();\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.onScreenSharingEnded(function (stream) {\n if (stream === _this.state.screenSharingStream) {\n _this.closeScreenSharing();\n }\n });\n return [4 /*yield*/, this.props.core.enterRoom()];\n case 1:\n logInRsp = _a.sent();\n logInRsp === 0 && this.createStream();\n return [2 /*return*/];\n }\n });\n });\n };\n ZegoRoom.prototype.createStream = function () {\n return __awaiter(this, void 0, void 0, function () {\n var solution, localStream, res, error_1;\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*/, 5];\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n solution = (0,_util__WEBPACK_IMPORTED_MODULE_7__.getVideoResolution)(this.state.selectVideoResolution);\n return [4 /*yield*/, this.props.core.createStream({\n camera: __assign({ video: !this.props.core.status.videoRefuse, audio: !this.props.core.status.audioRefuse, videoInput: this.state.selectCamera, audioInput: this.state.selectMic, videoQuality: 4 }, solution),\n })];\n case 2:\n localStream = _a.sent();\n this.props.core.enableVideoCaptureDevice(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 3:\n error_1 = _a.sent();\n console.error(\"【ZEGOCLOUD】createStream or publishLocalStream failed,Reason: \", JSON.stringify(error_1));\n return [2 /*return*/, false];\n case 4: return [3 /*break*/, 6];\n case 5: return [2 /*return*/, false];\n case 6: return [2 /*return*/];\n }\n });\n });\n };\n ZegoRoom.prototype.toggleMic = function () {\n return __awaiter(this, void 0, void 0, function () {\n var result;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (this.props.core.status.audioRefuse) {\n (0,_components_zegoModel__WEBPACK_IMPORTED_MODULE_9__.ZegoModelShow)({\n header: \"Equipment authorization\",\n contentText: \"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 okText: \"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_zegoToast__WEBPACK_IMPORTED_MODULE_10__.ZegoToast)({\n content: \"The microphone is \" + (this.micStatus ? \"on\" : \"off\"),\n });\n result &&\n this.setState({\n micOpen: !!this.micStatus,\n });\n }\n return [2 /*return*/];\n }\n });\n });\n };\n ZegoRoom.prototype.toggleCamera = function () {\n return __awaiter(this, void 0, void 0, function () {\n var result;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (this.props.core.status.videoRefuse) {\n (0,_components_zegoModel__WEBPACK_IMPORTED_MODULE_9__.ZegoModelShow)({\n header: \"Equipment authorization\",\n contentText: \"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 okText: \"Okay\",\n });\n return [2 /*return*/, Promise.resolve(false)];\n }\n if (this.cameraStatus === -1)\n return [2 /*return*/, Promise.resolve(false)];\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.enableVideoCaptureDevice(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_zegoToast__WEBPACK_IMPORTED_MODULE_10__.ZegoToast)({\n content: \"The camera is \" + (this.cameraStatus ? \"on\" : \"off\"),\n });\n result &&\n this.setState({\n cameraOpen: !!this.cameraStatus,\n });\n }\n return [2 /*return*/, !!result];\n }\n });\n });\n };\n ZegoRoom.prototype.toggleScreenSharing = function () {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n if (this.state.isScreenSharingBySelf) {\n this.closeScreenSharing();\n }\n else {\n this.createScreenSharing();\n }\n return [2 /*return*/];\n });\n });\n };\n ZegoRoom.prototype.createScreenSharing = function () {\n return __awaiter(this, void 0, void 0, function () {\n var screenSharingStream, streamID, error_2;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (this.state.screenSharingUserList.length > 0) {\n (0,_components_zegoToast__WEBPACK_IMPORTED_MODULE_10__.ZegoToast)({\n content: \"\".concat(this.state.screenSharingUserList[0].userName, \" is presenting now. You cannot share your screen.\"),\n });\n return [2 /*return*/];\n }\n if (this.isCreatingScreenSharing)\n return [2 /*return*/];\n this.isCreatingScreenSharing = true;\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, this.props.core.createStream({\n screen: { videoQuality: 2, bitRate: 1500, frameRate: 15, audio: true },\n })];\n case 2:\n screenSharingStream = _a.sent();\n streamID = this.props.core.publishLocalStream(screenSharingStream, \"screensharing\");\n streamID && (this.screenSharingStreamID = streamID);\n this.setState({\n isScreenSharingBySelf: true,\n screenSharingStream: screenSharingStream,\n });\n return [3 /*break*/, 4];\n case 3:\n error_2 = _a.sent();\n if ((error_2 === null || error_2 === void 0 ? void 0 : error_2.code) === 1103043) {\n (0,_components_zegoModel__WEBPACK_IMPORTED_MODULE_9__.ZegoModelShow)({\n header: \"Notice\",\n contentText: \"Your browser does not support screen sharing.\",\n okText: \"Okay\",\n });\n }\n else if ((error_2 === null || error_2 === void 0 ? void 0 : error_2.code) === 1103010 && (error_2 === null || error_2 === void 0 ? void 0 : error_2.msg.includes(\"Permission\"))) {\n (0,_components_zegoModel__WEBPACK_IMPORTED_MODULE_9__.ZegoModelShow)({\n header: \"Grant access to share your screen\",\n contentText: \"Your system does not have access to share a screen from the browser. Please grant access to share your screen on your system settings.\",\n okText: \"Okay\",\n });\n }\n else if ((error_2 === null || error_2 === void 0 ? void 0 : error_2.code) !== 1103042) {\n (0,_components_zegoToast__WEBPACK_IMPORTED_MODULE_10__.ZegoToast)({\n content: \"Failed to present your screen. error code: \".concat((error_2 === null || error_2 === void 0 ? void 0 : error_2.code) || -1),\n });\n }\n return [3 /*break*/, 4];\n case 4:\n this.isCreatingScreenSharing = false;\n return [2 /*return*/];\n }\n });\n });\n };\n ZegoRoom.prototype.closeScreenSharing = function () {\n try {\n this.screenSharingStreamID &&\n this.props.core.stopPublishingStream(this.screenSharingStreamID);\n this.state.screenSharingStream &&\n this.props.core.destroyStream(this.state.screenSharingStream);\n this.setState({\n isScreenSharingBySelf: false,\n });\n }\n catch (error) {\n console.error(error);\n }\n };\n ZegoRoom.prototype.toggleLayOut = function (layOutStatus) {\n var _this = this;\n this.setState(function (state) {\n return {\n layOutStatus: state.layOutStatus === layOutStatus ? \"ONE_VIDEO\" : layOutStatus,\n };\n }, function () {\n _this.computeByResize();\n });\n };\n ZegoRoom.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_7__.randomNumber)(5);\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 === null || resp === void 0 ? void 0 : 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 ZegoRoom.prototype.openSettings = function () {\n this.setState({\n showSettings: !this.state.showSettings,\n });\n };\n ZegoRoom.prototype.handleSetting = function () {\n var _this = this;\n (0,_components_zegoSetting__WEBPACK_IMPORTED_MODULE_8__.ZegoSettingsAlert)({\n core: this.props.core,\n theme: \"black\",\n initDevices: {\n mic: this.state.selectMic,\n cam: this.state.selectCamera,\n speaker: this.state.selectSpeaker,\n videoResolve: this.state.selectVideoResolution,\n showNonVideoUser: this.state.showNonVideoUser,\n },\n closeCallBack: function () { },\n onMicChange: function (deviceID) {\n _this.setState({\n selectMic: deviceID,\n }, function () {\n if (_this.state.localStream) {\n _this.props.core.useMicrophoneDevice(_this.state.localStream, deviceID);\n }\n });\n },\n onCameraChange: function (deviceID) {\n _this.setState({\n selectCamera: deviceID,\n }, function () { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!this.state.localStream) return [3 /*break*/, 2];\n return [4 /*yield*/, this.props.core.useCameraDevice(this.state.localStream, deviceID)];\n case 1:\n _a.sent();\n this.setState({\n cameraOpen: true,\n });\n _a.label = 2;\n case 2: return [2 /*return*/];\n }\n });\n }); });\n },\n onSpeakerChange: function (deviceID) {\n _this.setState({\n selectSpeaker: deviceID,\n }, function () {\n document\n .querySelectorAll(\"video\")\n .forEach(function (el) { return el.setSinkId(deviceID); });\n });\n },\n onVideoResolutionChange: function (level) {\n _this.setState({\n selectVideoResolution: level,\n }, function () {\n if (_this.state.localStream) {\n var _a = (0,_util__WEBPACK_IMPORTED_MODULE_7__.getVideoResolution)(level), width = _a.width, height = _a.height, bitrate = _a.bitrate, frameRate = _a.frameRate;\n _this.props.core.setVideoConfig(_this.state.localStream, {\n width: width,\n height: height,\n maxBitrate: bitrate,\n frameRate: frameRate,\n });\n }\n });\n },\n onShowNonVideoChange: function (selected) {\n _this.props.core._config.showNonVideoUser = selected;\n _this.props.core.setShowNonVideo(selected);\n _this.setState({\n showNonVideoUser: selected,\n });\n },\n });\n };\n ZegoRoom.prototype.handleLeave = function () {\n var _this = this;\n (0,_components_zegoModel__WEBPACK_IMPORTED_MODULE_9__.ZegoModelShow)({\n header: \"Leave the room\",\n contentText: \"Are you sure to leave the room?\",\n okText: \"Confirm\",\n cancelText: \"Cancel\",\n onOk: function () {\n _this.props.core._config.turnOnCameraWhenJoining = _this.state.cameraOpen;\n _this.props.core._config.turnOnMicrophoneWhenJoining =\n _this.state.micOpen;\n _this.props.core.status.micDeviceID = _this.state.selectMic;\n _this.props.core.status.cameraDeviceID = _this.state.selectCamera;\n _this.props.core.status.speakerDeviceID = _this.state.selectSpeaker;\n _this.props.core.status.videoResolution =\n _this.state.selectVideoResolution;\n _this.leaveRoom();\n },\n });\n };\n ZegoRoom.prototype.leaveRoom = function () {\n this.state.isScreenSharingBySelf && this.closeScreenSharing();\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 ZegoRoom.prototype.computeByResize = function () {\n var _a, _b, _c, _d;\n return __awaiter(this, void 0, void 0, function () {\n var width, height, videoShowNumber, gridRowNumber, showSelf, videWrapHight, n, videWrapHight, n, videoWrapWidth, n, videoWrapWidth, n;\n return __generator(this, function (_e) {\n switch (_e.label) {\n case 0:\n width = Math.max(document.body.clientWidth, 826);\n height = Math.max(document.body.clientHeight, 280);\n videoShowNumber = 0, gridRowNumber = 0;\n showSelf = this.props.core._config.showNonVideoUser || this.state.localStream;\n if (!(this.getScreenSharingUser.length > 0)) return [3 /*break*/, 6];\n videWrapHight = height - (((_a = this.props.core._config.branding) === null || _a === void 0 ? void 0 : _a.logoURL) ? 64 : 0) - 84 - 38;\n n = parseInt(String(videWrapHight / 124)) || 1;\n videoShowNumber = Math.min(n * 124 + (n - 1) * 10 <= videWrapHight ? n : n - 1 || 1, 5);\n this.setState({\n videoShowNumber: videoShowNumber,\n });\n return [4 /*yield*/, this.props.core.setSidebarLayOut(false)];\n case 1:\n _e.sent();\n if (!this.fullScreen) return [3 /*break*/, 3];\n return [4 /*yield*/, this.props.core.setMaxScreenNum(0)];\n case 2:\n _e.sent();\n return [3 /*break*/, 5];\n case 3: return [4 /*yield*/, this.props.core.setMaxScreenNum(showSelf ? videoShowNumber - 1 : videoShowNumber)];\n case 4:\n _e.sent();\n _e.label = 5;\n case 5: return [2 /*return*/];\n case 6:\n if (!(this.state.layout === \"Sidebar\")) return [3 /*break*/, 9];\n videWrapHight = height - (((_b = this.props.core._config.branding) === null || _b === void 0 ? void 0 : _b.logoURL) ? 64 : 0) - 84;\n n = parseInt(String(videWrapHight / 124)) || 1;\n videoShowNumber = Math.min(n * 124 + (n - 1) * 10 <= videWrapHight ? n : n - 1 || 1, 5);\n return [4 /*yield*/, this.props.core.setSidebarLayOut(!this.localUserPin)];\n case 7:\n _e.sent();\n this.setState({\n videoShowNumber: videoShowNumber,\n });\n return [4 /*yield*/, this.props.core.setMaxScreenNum(showSelf ? videoShowNumber : videoShowNumber + 1)];\n case 8:\n _e.sent();\n return [2 /*return*/];\n case 9:\n if (!(this.state.layout === \"Grid\" || this.state.layout === \"Auto\")) return [3 /*break*/, 12];\n if (height < 406 - (((_c = this.props.core._config.branding) === null || _c === void 0 ? void 0 : _c.logoURL) ? 0 : 64)) {\n videoWrapWidth = width - 32 - (this.state.layOutStatus === \"ONE_VIDEO\" ? 0 : 350);\n n = parseInt(String(videoWrapWidth / 160));\n videoShowNumber = Math.min(n * 160 + (n - 1) * 10 <= videoWrapWidth ? n : n - 1, 10);\n gridRowNumber = 1;\n }\n else if (height <\n 540 - (((_d = this.props.core._config.branding) === null || _d === void 0 ? void 0 : _d.logoURL) ? 0 : 64)) {\n videoWrapWidth = width - 32 - (this.state.layOutStatus === \"ONE_VIDEO\" ? 0 : 350);\n n = parseInt(String(videoWrapWidth / 124));\n videoShowNumber = Math.min(n * 124 + (n - 1) * 10 <= videoWrapWidth ? 2 * n : 2 * (n - 1), 10);\n gridRowNumber = 2;\n }\n else {\n videoShowNumber = 9;\n gridRowNumber = 3;\n }\n return [4 /*yield*/, this.props.core.setSidebarLayOut(false)];\n case 10:\n _e.sent();\n this.setState({\n videoShowNumber: videoShowNumber,\n gridRowNumber: gridRowNumber,\n });\n return [4 /*yield*/, this.props.core.setMaxScreenNum(showSelf ? videoShowNumber - 1 : videoShowNumber)];\n case 11:\n _e.sent();\n return [2 /*return*/];\n case 12: return [2 /*return*/];\n }\n });\n });\n };\n ZegoRoom.prototype.showLayoutSettings = function (show) {\n this.setState({\n showLayoutSettingsModel: show,\n });\n };\n ZegoRoom.prototype.changeLayout = function (type) {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n if (this.state.isLayoutChanging)\n return [2 /*return*/];\n return [2 /*return*/, new Promise(function (resolve, reject) {\n _this.userUpdateCallBack = function () {\n _this.setState({\n isLayoutChanging: false,\n });\n resolve(true);\n };\n if (type === \"Grid\" || type === \"Auto\") {\n _this.props.core.setPin();\n _this.localUserPin = false;\n }\n _this.setState({\n isLayoutChanging: true,\n layout: type,\n });\n _this.props.core.setSidebarLayOut(type === \"Sidebar\");\n setTimeout(function () {\n _this.setState({\n isLayoutChanging: false,\n });\n resolve(false);\n }, 5000);\n })];\n });\n });\n };\n ZegoRoom.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 ZegoRoom.prototype.getShownUser = function (forceShowNonVideoUser) {\n var _this = this;\n if (forceShowNonVideoUser === void 0) { forceShowNonVideoUser = false; }\n var shownUser = this.getAllUser().filter(function (item) {\n if (!_this.props.core._config.showNonVideoUser && !forceShowNonVideoUser) {\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 Object.defineProperty(ZegoRoom.prototype, \"getScreenSharingUser\", {\n get: function () {\n if (this.state.isScreenSharingBySelf) {\n return [\n {\n userID: this.props.core._expressConfig.userID,\n userName: this.props.core._expressConfig.userName,\n pin: false,\n streamList: [\n {\n media: this.state.screenSharingStream,\n fromUser: {\n userID: this.props.core._expressConfig.userID,\n userName: this.props.core._expressConfig.userName,\n },\n micStatus: \"OPEN\",\n cameraStatus: \"OPEN\",\n state: \"PLAYING\",\n streamID: this.screenSharingStreamID,\n },\n ],\n },\n ];\n }\n else {\n return this.state.screenSharingUserList;\n }\n },\n enumerable: false,\n configurable: true\n });\n ZegoRoom.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, 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 ZegoRoom.prototype.getLayoutScreen = function () {\n var _this = this;\n var _a, _b, _c;\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: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].liveNotStart }, { 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.getScreenSharingUser, 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: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].noOneStreaming }, { 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.getScreenSharingUser.length > 0) {\n return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, { children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_ZegoScreenSharingLayout__WEBPACK_IMPORTED_MODULE_15__.ZegoScreenSharingLayout, { handleSetPin: function (userID) {\n _this.handleSetPin(userID);\n }, userList: this.getShownUser(), videoShowNumber: this.state.videoShowNumber, selfInfo: {\n userID: this.props.core._expressConfig.userID,\n }, screenSharingUser: this.getScreenSharingUser[0], soundLevel: this.state.soundLevel, handleFullScreen: this.handleFullScreen.bind(this), roomID: this.props.core._expressConfig.roomID }) }));\n }\n if ((this.state.layout === \"Auto\" && 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_5__.ZegoOne2One, { onLocalStreamPaused: function () { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.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 }); }, selfInfo: {\n userID: this.props.core._expressConfig.userID,\n }, handleSetPin: function (userID) {\n _this.handleSetPin(userID);\n }, userList: this.getShownUser(), soundLevel: this.state.soundLevel }));\n }\n if ((this.state.layout === \"Grid\" && this.getShownUser().length > 1) ||\n (this.state.layout === \"Auto\" && this.getShownUser().length > 2)) {\n return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_zegoGridLayout__WEBPACK_IMPORTED_MODULE_11__.ZegoGridLayout, { userList: this.getShownUser(), videoShowNumber: this.state.videoShowNumber, gridRowNumber: this.state.gridRowNumber, selfInfo: {\n userID: this.props.core._expressConfig.userID,\n }, handleSetPin: function (userID) {\n _this.handleSetPin(userID);\n }, soundLevel: this.state.soundLevel }));\n }\n if (this.state.layout === \"Sidebar\" && this.getShownUser().length > 1) {\n return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_zegoSidebarLayout__WEBPACK_IMPORTED_MODULE_12__.ZegoSidebarLayout, { handleSetPin: function (userID) {\n _this.handleSetPin(userID);\n }, userList: this.getShownUser(), videoShowNumber: this.state.videoShowNumber, selfInfo: {\n userID: this.props.core._expressConfig.userID,\n }, soundLevel: this.state.soundLevel }));\n }\n };\n ZegoRoom.prototype.handleSetPin = function (userID) {\n if (userID === this.props.core._expressConfig.userID) {\n this.localUserPin = !this.localUserPin;\n this.props.core.setPin();\n }\n else {\n this.localUserPin = false;\n this.props.core.setPin(userID);\n }\n this.props.core.setSidebarLayOut(this.getScreenSharingUser.length > 0 ? false : this.localUserPin === false);\n this.setState({ layout: \"Sidebar\" });\n };\n ZegoRoom.prototype.handleFullScreen = function (fullScreen) {\n this.fullScreen = fullScreen;\n this.computeByResize();\n };\n ZegoRoom.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_9__.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 ZegoRoom.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 ZegoRoom.prototype.render = function () {\n var _this = this;\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;\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 showPinButton: !!this.props.core._config.showPinButton,\n } }, { children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].ZegoRoom }, { children: [(((_a = this.props.core._config.branding) === null || _a === void 0 ? void 0 : _a.logoURL) ||\n this.props.core._config.roomTimerDisplayed ||\n ((_b = this.props.core._config.scenario) === null || _b === void 0 ? void 0 : _b.mode) ===\n _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.LiveStreaming) && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].header }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].headerLeft }, { children: [((_c = this.props.core._config.branding) === null || _c === void 0 ? void 0 : _c.logoURL) && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"img\", { className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].logo, src: (_d = this.props.core._config.branding) === null || _d === void 0 ? void 0 : _d.logoURL, alt: \"logo\" })), ((_e = this.props.core._config.scenario) === null || _e === void 0 ? void 0 : _e.mode) ===\n _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.LiveStreaming &&\n (this.state.liveCountdown === 0 ||\n this.state.liveStatus == 1) && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].liveState }, { children: \"Live\" })))] })), ((_f = this.props.core._config.scenario) === null || _f === void 0 ? void 0 : _f.mode) ===\n _model__WEBPACK_IMPORTED_MODULE_2__.ScenarioModel.LiveStreaming &&\n ((_h = (_g = this.props.core._config.scenario) === null || _g === void 0 ? void 0 : _g.config) === null || _h === void 0 ? void 0 : _h.role) ===\n _model__WEBPACK_IMPORTED_MODULE_2__.LiveRole.Host && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"button\", __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 broadcast\"\n : \"start stream\" }))), this.props.core._config.roomTimerDisplayed && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_zegoTimer__WEBPACK_IMPORTED_MODULE_4__.ZegoTimer, {}))] }))), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].content }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].contentLeft }, { children: [this.getLayoutScreen(), 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\n .slice(startIndex)\n .map(function (notify, index) {\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 })] }), index));\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\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].nowrap }, { children: notify.content })) }), index));\n }\n }) })), this.state.isNetworkPoor && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", { className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].network }))] })), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].contentRight, style: {\n display: this.state.layOutStatus !== \"ONE_VIDEO\" ? \"flex\" : \"none\",\n } }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].listHeader }, { children: [this.state.layOutStatus === \"INVITE\" && \"Room details\", this.state.layOutStatus === \"USER_LIST\" && \"Room members\", this.state.layOutStatus === \"MESSAGE\" && \"Room messages\", (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", { className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].listHeaderClose, onClick: function () {\n _this.setState({\n layOutStatus: \"ONE_VIDEO\",\n });\n } })] })), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].listContent }, { children: [this.state.layOutStatus === \"INVITE\" && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_zegoRoomInvite__WEBPACK_IMPORTED_MODULE_13__.ZegoRoomInvite, { core: this.props.core })), this.state.layOutStatus === \"USER_LIST\" && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_zegoUserList__WEBPACK_IMPORTED_MODULE_14__.ZegoUserList, { core: this.props.core, userList: this.getShownUser(true), selfUserID: this.props.core._expressConfig.userID, handleSetPin: this.handleSetPin.bind(this), soundLevel: this.state.soundLevel })), this.state.layOutStatus === \"MESSAGE\" && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_zegoMessage__WEBPACK_IMPORTED_MODULE_6__.ZegoMessage, { messageList: this.state.messageList, sendMessage: function (msg) {\n _this.sendMessage(msg);\n }, selfUserID: this.props.core._expressConfig.userID }))] }))] }))] })), this.getScreenSharingUser.length > 0 && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].screenBottomBar }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].screenBottomBarLeft }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", {}), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"p\", { children: this.state.isScreenSharingBySelf\n ? \"You’re presenting to everyone\"\n : \"\".concat(this.state.screenSharingUserList[0].userName, \" is presenting the screen\") })] })), this.state.isScreenSharingBySelf && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].screenBottomBarRight, onClick: function () {\n _this.toggleScreenSharing();\n } }, { children: \"Stop Presenting\" })))] }))), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].footer }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].handlerMiddle }, { children: [this.props.core._config.showMyMicrophoneToggleButton && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", { className: \"\".concat(_index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].micButton, \" \").concat(!this.state.micOpen && _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].close), onClick: function () {\n _this.toggleMic();\n } })), this.props.core._config.showMyCameraToggleButton && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", { className: \"\".concat(_index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].cameraButton, \" \").concat(!this.state.cameraOpen && _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].close), onClick: function () {\n _this.toggleCamera();\n } })), this.props.core._config.showScreenSharingButton && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", { className: \"\".concat(_index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].screenButton, \" \").concat(this.state.isScreenSharingBySelf && _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].sharing), onClick: function () {\n _this.toggleScreenSharing();\n } })), (this.props.core._config.showAudioVideoSettingsButton ||\n this.props.core._config.showLayoutButton) && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", __assign({ ref: this.moreRef, className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].moreButton, onClick: function () {\n _this.openSettings();\n } }, { children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].settingsButtonModel, style: {\n display: this.state.showSettings ? \"block\" : \"none\",\n }, ref: this.settingsRef }, { children: [this.props.core._config.showLayoutButton && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", __assign({ onClick: function () { return _this.showLayoutSettings(true); } }, { children: \"Change layout\" }))), this.props.core._config.showAudioVideoSettingsButton &&\n this.props.core._config.showLayoutButton && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", {}), this.props.core._config.showAudioVideoSettingsButton && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", __assign({ onClick: function () { return _this.handleSetting(); } }, { children: \"Settings\" })))] })) }))), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", { className: ((_j = this.props.core._config.scenario) === null || _j === void 0 ? void 0 : _j.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\"].leaveButton, onClick: function () {\n _this.handleLeave();\n } })] })), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].handlerRight }, { children: [((_k = this.props.core._config.preJoinViewConfig) === null || _k === void 0 ? void 0 : _k.invitationLink) && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", { className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].inviteButton, onClick: function () {\n _this.toggleLayOut(\"INVITE\");\n } })), this.props.core._config.showUserList && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].memberButton, onClick: function () {\n _this.toggleLayOut(\"USER_LIST\");\n } }, { children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].memberNum }, { children: this.state.zegoCloudUserList.length > 99\n ? \"99+\"\n : this.state.zegoCloudUserList.length + 1 })) }))), this.props.core._config.showTextChat && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", { className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].msgButton, onClick: function () {\n _this.toggleLayOut(\"MESSAGE\");\n } }))] }))] })), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].reconnect, style: {\n display: this.state.connecting ? \"flex\" : \"none\",\n backgroundColor: this.state.firstLoading ? \"#1C1F2E\" : \"\",\n } }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", {}), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"p\", { children: this.state.firstLoading\n ? \"Joining Room\"\n : \"There's something wrong with your network. Trying to reconnect...\" })] })), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].countDown, style: {\n display: this.state.liveCountdown > 0 ? \"flex\" : \"none\",\n backgroundColor: \"#1C1F2E\",\n } }, { children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", { children: this.state.liveCountdown }) })), this.state.showLayoutSettingsModel && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layoutSettingsMask }, { children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layoutSettingsWrapper }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layoutSettingsHeader }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"p\", { children: \"Change layout\" }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", { className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layoutSettingsCloseIcon, onClick: function () { return _this.showLayoutSettings(false); } })] })), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layoutSettingsContent }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layoutSettingsItemRow, onClick: function () { return _this.changeLayout(\"Auto\"); } }, { children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"p\", { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", { className: \"\".concat(_index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layoutSettingsItemIcon, \" \").concat(this.state.layout === \"Auto\"\n ? _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layoutSettingsItemChecked\n : \"\", \" \").concat(this.state.isLayoutChanging &&\n this.state.layout === \"Auto\"\n ? _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layoutSettingsItemLoading\n : \"\") }), \"Auto\"] }) })), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layoutSettingsItemRow, onClick: function () { return _this.changeLayout(\"Grid\"); } }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"p\", { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", { className: \"\".concat(_index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layoutSettingsItemIcon, \" \").concat(this.state.layout === \"Grid\"\n ? _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layoutSettingsItemChecked\n : \"\", \" \").concat(this.state.isLayoutChanging &&\n this.state.layout === \"Grid\"\n ? _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layoutSettingsItemLoading\n : \"\") }), \"Grid\"] }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"img\", { src: __webpack_require__(/*! ../../../sdkAssets/img_layout_grid@2x.png */ \"./src/sdk/sdkAssets/img_layout_grid@2x.png\"), alt: \"grid layout\" })] })), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", __assign({ className: _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layoutSettingsItemRow, onClick: function () { return _this.changeLayout(\"Sidebar\"); } }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"p\", { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"span\", { className: \"\".concat(_index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layoutSettingsItemIcon, \" \").concat(this.state.layout === \"Sidebar\"\n ? _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layoutSettingsItemChecked\n : \"\", \" \").concat(this.state.isLayoutChanging &&\n this.state.layout === \"Sidebar\"\n ? _index_module_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"].layoutSettingsItemLoading\n : \"\") }), \"Sidebar\"] }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"img\", { src: __webpack_require__(/*! ../../../sdkAssets/img_layout_sidebar@2x.png */ \"./src/sdk/sdkAssets/img_layout_sidebar@2x.png\"), alt: \"Sidebar layout\" })] }))] }))] })) })))] })) })));\n };\n return ZegoRoom;\n}((react__WEBPACK_IMPORTED_MODULE_1___default().Component)));\n\n\n\n//# sourceURL=webpack://zegocloud_client_sdk_web/./src/sdk/view/pages/ZegoRoom/index.tsx?");
|
|
1757
1757
|
|
|
1758
1758
|
/***/ }),
|
|
1759
1759
|
|