kucservice 1.4.1 → 1.4.3-beta
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/dist/kucservice.common.js +1887 -567
- package/dist/kucservice.common.js.gz +0 -0
- package/dist/kucservice.common.js.map +1 -1
- package/dist/kucservice.umd.js +1887 -567
- package/dist/kucservice.umd.js.gz +0 -0
- package/dist/kucservice.umd.js.map +1 -1
- package/dist/kucservice.umd.min.js +1 -1
- package/dist/kucservice.umd.min.js.gz +0 -0
- package/dist/kucservice.umd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/kucservice.umd.js
CHANGED
|
@@ -1259,6 +1259,121 @@ $({ target: 'Array', stat: true }, {
|
|
|
1259
1259
|
});
|
|
1260
1260
|
|
|
1261
1261
|
|
|
1262
|
+
/***/ }),
|
|
1263
|
+
|
|
1264
|
+
/***/ "2909":
|
|
1265
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1266
|
+
|
|
1267
|
+
"use strict";
|
|
1268
|
+
|
|
1269
|
+
// EXPORTS
|
|
1270
|
+
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _toConsumableArray; });
|
|
1271
|
+
|
|
1272
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.is-array.js
|
|
1273
|
+
var es_array_is_array = __webpack_require__("277d");
|
|
1274
|
+
|
|
1275
|
+
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
|
|
1276
|
+
function _arrayLikeToArray(arr, len) {
|
|
1277
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
1278
|
+
|
|
1279
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
1280
|
+
arr2[i] = arr[i];
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
return arr2;
|
|
1284
|
+
}
|
|
1285
|
+
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
|
|
1286
|
+
|
|
1287
|
+
|
|
1288
|
+
function _arrayWithoutHoles(arr) {
|
|
1289
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
1290
|
+
}
|
|
1291
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.symbol.js
|
|
1292
|
+
var es_symbol = __webpack_require__("a4d3");
|
|
1293
|
+
|
|
1294
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.symbol.description.js
|
|
1295
|
+
var es_symbol_description = __webpack_require__("e01a");
|
|
1296
|
+
|
|
1297
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.to-string.js
|
|
1298
|
+
var es_object_to_string = __webpack_require__("d3b7");
|
|
1299
|
+
|
|
1300
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.symbol.iterator.js
|
|
1301
|
+
var es_symbol_iterator = __webpack_require__("d28b");
|
|
1302
|
+
|
|
1303
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.iterator.js
|
|
1304
|
+
var es_array_iterator = __webpack_require__("e260");
|
|
1305
|
+
|
|
1306
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.iterator.js
|
|
1307
|
+
var es_string_iterator = __webpack_require__("3ca3");
|
|
1308
|
+
|
|
1309
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/web.dom-collections.iterator.js
|
|
1310
|
+
var web_dom_collections_iterator = __webpack_require__("ddb0");
|
|
1311
|
+
|
|
1312
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.from.js
|
|
1313
|
+
var es_array_from = __webpack_require__("a630");
|
|
1314
|
+
|
|
1315
|
+
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
|
|
1316
|
+
|
|
1317
|
+
|
|
1318
|
+
|
|
1319
|
+
|
|
1320
|
+
|
|
1321
|
+
|
|
1322
|
+
|
|
1323
|
+
|
|
1324
|
+
function _iterableToArray(iter) {
|
|
1325
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
1326
|
+
}
|
|
1327
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.slice.js
|
|
1328
|
+
var es_array_slice = __webpack_require__("fb6a");
|
|
1329
|
+
|
|
1330
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.function.name.js
|
|
1331
|
+
var es_function_name = __webpack_require__("b0c0");
|
|
1332
|
+
|
|
1333
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.regexp.exec.js
|
|
1334
|
+
var es_regexp_exec = __webpack_require__("ac1f");
|
|
1335
|
+
|
|
1336
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.regexp.test.js
|
|
1337
|
+
var es_regexp_test = __webpack_require__("00b4");
|
|
1338
|
+
|
|
1339
|
+
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
|
|
1340
|
+
|
|
1341
|
+
|
|
1342
|
+
|
|
1343
|
+
|
|
1344
|
+
|
|
1345
|
+
|
|
1346
|
+
|
|
1347
|
+
|
|
1348
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
1349
|
+
if (!o) return;
|
|
1350
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
1351
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
1352
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
1353
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
1354
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
1355
|
+
}
|
|
1356
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.error.cause.js
|
|
1357
|
+
var es_error_cause = __webpack_require__("d9e2");
|
|
1358
|
+
|
|
1359
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.error.to-string.js
|
|
1360
|
+
var es_error_to_string = __webpack_require__("d401");
|
|
1361
|
+
|
|
1362
|
+
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
|
|
1363
|
+
|
|
1364
|
+
|
|
1365
|
+
function _nonIterableSpread() {
|
|
1366
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1367
|
+
}
|
|
1368
|
+
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
|
|
1369
|
+
|
|
1370
|
+
|
|
1371
|
+
|
|
1372
|
+
|
|
1373
|
+
function _toConsumableArray(arr) {
|
|
1374
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1262
1377
|
/***/ }),
|
|
1263
1378
|
|
|
1264
1379
|
/***/ "2a62":
|
|
@@ -2120,13 +2235,17 @@ var websocket_Socket = /*#__PURE__*/function (_WebSocket) {
|
|
|
2120
2235
|
}
|
|
2121
2236
|
|
|
2122
2237
|
((_this$self = this.self) === null || _this$self === void 0 ? void 0 : _this$self.socketTimer) && clearTimeout(this.self.socketTimer);
|
|
2123
|
-
this.self.socketTimer = setTimeout(function () {
|
|
2124
|
-
var _socket = new Socket(optionsClone, _this2._dep, _this2._reconnectCount, _this2.self);
|
|
2125
2238
|
|
|
2126
|
-
|
|
2127
|
-
|
|
2239
|
+
if (this.self) {
|
|
2240
|
+
this.self.socketTimer = setTimeout(function () {
|
|
2241
|
+
var _socket = new Socket(optionsClone, _this2._dep, _this2._reconnectCount, _this2.self);
|
|
2242
|
+
|
|
2243
|
+
_this2._dep.notify('reconnect', _socket);
|
|
2244
|
+
}, TIMEOUT);
|
|
2245
|
+
} // } else {
|
|
2128
2246
|
// return console.error('WebSocket重连失败, 请联系技术客服!')
|
|
2129
2247
|
// }
|
|
2248
|
+
|
|
2130
2249
|
}
|
|
2131
2250
|
};
|
|
2132
2251
|
|
|
@@ -2189,6 +2308,7 @@ var websocket_Socket = /*#__PURE__*/function (_WebSocket) {
|
|
|
2189
2308
|
key: "closeSocket",
|
|
2190
2309
|
value: function closeSocket(code, reason) {
|
|
2191
2310
|
this.clearHeartCheck();
|
|
2311
|
+
console.log('=====close code===', code, reason);
|
|
2192
2312
|
this.close(code, reason);
|
|
2193
2313
|
} // 开始心跳检测
|
|
2194
2314
|
|
|
@@ -2339,6 +2459,28 @@ module.exports = function (it) {
|
|
|
2339
2459
|
};
|
|
2340
2460
|
|
|
2341
2461
|
|
|
2462
|
+
/***/ }),
|
|
2463
|
+
|
|
2464
|
+
/***/ "45fc":
|
|
2465
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2466
|
+
|
|
2467
|
+
"use strict";
|
|
2468
|
+
|
|
2469
|
+
var $ = __webpack_require__("23e7");
|
|
2470
|
+
var $some = __webpack_require__("b727").some;
|
|
2471
|
+
var arrayMethodIsStrict = __webpack_require__("a640");
|
|
2472
|
+
|
|
2473
|
+
var STRICT_METHOD = arrayMethodIsStrict('some');
|
|
2474
|
+
|
|
2475
|
+
// `Array.prototype.some` method
|
|
2476
|
+
// https://tc39.es/ecma262/#sec-array.prototype.some
|
|
2477
|
+
$({ target: 'Array', proto: true, forced: !STRICT_METHOD }, {
|
|
2478
|
+
some: function some(callbackfn /* , thisArg */) {
|
|
2479
|
+
return $some(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
|
2480
|
+
}
|
|
2481
|
+
});
|
|
2482
|
+
|
|
2483
|
+
|
|
2342
2484
|
/***/ }),
|
|
2343
2485
|
|
|
2344
2486
|
/***/ "4795":
|
|
@@ -3825,6 +3967,35 @@ module.exports = Object.create || function create(O, Properties) {
|
|
|
3825
3967
|
};
|
|
3826
3968
|
|
|
3827
3969
|
|
|
3970
|
+
/***/ }),
|
|
3971
|
+
|
|
3972
|
+
/***/ "7db0":
|
|
3973
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3974
|
+
|
|
3975
|
+
"use strict";
|
|
3976
|
+
|
|
3977
|
+
var $ = __webpack_require__("23e7");
|
|
3978
|
+
var $find = __webpack_require__("b727").find;
|
|
3979
|
+
var addToUnscopables = __webpack_require__("44d2");
|
|
3980
|
+
|
|
3981
|
+
var FIND = 'find';
|
|
3982
|
+
var SKIPS_HOLES = true;
|
|
3983
|
+
|
|
3984
|
+
// Shouldn't skip holes
|
|
3985
|
+
if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
|
|
3986
|
+
|
|
3987
|
+
// `Array.prototype.find` method
|
|
3988
|
+
// https://tc39.es/ecma262/#sec-array.prototype.find
|
|
3989
|
+
$({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
|
|
3990
|
+
find: function find(callbackfn /* , that = undefined */) {
|
|
3991
|
+
return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
|
3992
|
+
}
|
|
3993
|
+
});
|
|
3994
|
+
|
|
3995
|
+
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
3996
|
+
addToUnscopables(FIND);
|
|
3997
|
+
|
|
3998
|
+
|
|
3828
3999
|
/***/ }),
|
|
3829
4000
|
|
|
3830
4001
|
/***/ "7dd0":
|
|
@@ -3961,116 +4132,21 @@ __webpack_require__.d(__webpack_exports__, "useHttp", function() { return /* bin
|
|
|
3961
4132
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
|
|
3962
4133
|
var asyncToGenerator = __webpack_require__("1da1");
|
|
3963
4134
|
|
|
3964
|
-
// EXTERNAL MODULE: ./node_modules/
|
|
3965
|
-
var
|
|
3966
|
-
|
|
3967
|
-
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
|
|
3968
|
-
function _arrayLikeToArray(arr, len) {
|
|
3969
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
3970
|
-
|
|
3971
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
3972
|
-
arr2[i] = arr[i];
|
|
3973
|
-
}
|
|
3974
|
-
|
|
3975
|
-
return arr2;
|
|
3976
|
-
}
|
|
3977
|
-
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
|
|
4135
|
+
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 5 modules
|
|
4136
|
+
var toConsumableArray = __webpack_require__("2909");
|
|
3978
4137
|
|
|
4138
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.keys.js
|
|
4139
|
+
var es_object_keys = __webpack_require__("b64b");
|
|
3979
4140
|
|
|
3980
|
-
function _arrayWithoutHoles(arr) {
|
|
3981
|
-
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
3982
|
-
}
|
|
3983
4141
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.symbol.js
|
|
3984
4142
|
var es_symbol = __webpack_require__("a4d3");
|
|
3985
4143
|
|
|
3986
|
-
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.
|
|
3987
|
-
var
|
|
4144
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.filter.js
|
|
4145
|
+
var es_array_filter = __webpack_require__("4de4");
|
|
3988
4146
|
|
|
3989
4147
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.to-string.js
|
|
3990
4148
|
var es_object_to_string = __webpack_require__("d3b7");
|
|
3991
4149
|
|
|
3992
|
-
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.symbol.iterator.js
|
|
3993
|
-
var es_symbol_iterator = __webpack_require__("d28b");
|
|
3994
|
-
|
|
3995
|
-
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.iterator.js
|
|
3996
|
-
var es_array_iterator = __webpack_require__("e260");
|
|
3997
|
-
|
|
3998
|
-
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.iterator.js
|
|
3999
|
-
var es_string_iterator = __webpack_require__("3ca3");
|
|
4000
|
-
|
|
4001
|
-
// EXTERNAL MODULE: ./node_modules/core-js/modules/web.dom-collections.iterator.js
|
|
4002
|
-
var web_dom_collections_iterator = __webpack_require__("ddb0");
|
|
4003
|
-
|
|
4004
|
-
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.from.js
|
|
4005
|
-
var es_array_from = __webpack_require__("a630");
|
|
4006
|
-
|
|
4007
|
-
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
function _iterableToArray(iter) {
|
|
4017
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
4018
|
-
}
|
|
4019
|
-
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.slice.js
|
|
4020
|
-
var es_array_slice = __webpack_require__("fb6a");
|
|
4021
|
-
|
|
4022
|
-
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.function.name.js
|
|
4023
|
-
var es_function_name = __webpack_require__("b0c0");
|
|
4024
|
-
|
|
4025
|
-
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.regexp.exec.js
|
|
4026
|
-
var es_regexp_exec = __webpack_require__("ac1f");
|
|
4027
|
-
|
|
4028
|
-
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.regexp.test.js
|
|
4029
|
-
var es_regexp_test = __webpack_require__("00b4");
|
|
4030
|
-
|
|
4031
|
-
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
4041
|
-
if (!o) return;
|
|
4042
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
4043
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
4044
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
4045
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
4046
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
4047
|
-
}
|
|
4048
|
-
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.error.cause.js
|
|
4049
|
-
var es_error_cause = __webpack_require__("d9e2");
|
|
4050
|
-
|
|
4051
|
-
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.error.to-string.js
|
|
4052
|
-
var es_error_to_string = __webpack_require__("d401");
|
|
4053
|
-
|
|
4054
|
-
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
function _nonIterableSpread() {
|
|
4058
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
4059
|
-
}
|
|
4060
|
-
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
function _toConsumableArray(arr) {
|
|
4066
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
4067
|
-
}
|
|
4068
|
-
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.keys.js
|
|
4069
|
-
var es_object_keys = __webpack_require__("b64b");
|
|
4070
|
-
|
|
4071
|
-
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.filter.js
|
|
4072
|
-
var es_array_filter = __webpack_require__("4de4");
|
|
4073
|
-
|
|
4074
4150
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.get-own-property-descriptor.js
|
|
4075
4151
|
var es_object_get_own_property_descriptor = __webpack_require__("e439");
|
|
4076
4152
|
|
|
@@ -4151,10 +4227,25 @@ var es_array_concat = __webpack_require__("99af");
|
|
|
4151
4227
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.promise.js
|
|
4152
4228
|
var es_promise = __webpack_require__("e6cf");
|
|
4153
4229
|
|
|
4154
|
-
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.
|
|
4155
|
-
var
|
|
4230
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.error.cause.js
|
|
4231
|
+
var es_error_cause = __webpack_require__("d9e2");
|
|
4156
4232
|
|
|
4157
|
-
//
|
|
4233
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.error.to-string.js
|
|
4234
|
+
var es_error_to_string = __webpack_require__("d401");
|
|
4235
|
+
|
|
4236
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.iterator.js
|
|
4237
|
+
var es_array_iterator = __webpack_require__("e260");
|
|
4238
|
+
|
|
4239
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.iterator.js
|
|
4240
|
+
var es_string_iterator = __webpack_require__("3ca3");
|
|
4241
|
+
|
|
4242
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.weak-map.js
|
|
4243
|
+
var es_weak_map = __webpack_require__("10d1");
|
|
4244
|
+
|
|
4245
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/web.dom-collections.iterator.js
|
|
4246
|
+
var web_dom_collections_iterator = __webpack_require__("ddb0");
|
|
4247
|
+
|
|
4248
|
+
// CONCATENATED MODULE: ./src/lib/webApi/http.js
|
|
4158
4249
|
|
|
4159
4250
|
|
|
4160
4251
|
|
|
@@ -4222,7 +4313,7 @@ var http_httpWay = /*#__PURE__*/function () {
|
|
|
4222
4313
|
}
|
|
4223
4314
|
|
|
4224
4315
|
if (async) {
|
|
4225
|
-
fetch.apply(void 0,
|
|
4316
|
+
fetch.apply(void 0, Object(toConsumableArray["a" /* default */])(params)).then(function (res) {
|
|
4226
4317
|
if (res.status == 200) {
|
|
4227
4318
|
success && success(res.json());
|
|
4228
4319
|
} else {
|
|
@@ -4246,7 +4337,7 @@ var http_httpWay = /*#__PURE__*/function () {
|
|
|
4246
4337
|
switch (_context.prev = _context.next) {
|
|
4247
4338
|
case 0:
|
|
4248
4339
|
_context.next = 2;
|
|
4249
|
-
return fetch.apply(void 0,
|
|
4340
|
+
return fetch.apply(void 0, Object(toConsumableArray["a" /* default */])(params));
|
|
4250
4341
|
|
|
4251
4342
|
case 2:
|
|
4252
4343
|
response = _context.sent;
|
|
@@ -4305,6 +4396,31 @@ var useHttp = function useHttp(url, method, data, options) {
|
|
|
4305
4396
|
return new http_httpWay(url, method, data, options, async = true, success, fail);
|
|
4306
4397
|
};
|
|
4307
4398
|
|
|
4399
|
+
/***/ }),
|
|
4400
|
+
|
|
4401
|
+
/***/ "81d5":
|
|
4402
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
4403
|
+
|
|
4404
|
+
"use strict";
|
|
4405
|
+
|
|
4406
|
+
var toObject = __webpack_require__("7b0b");
|
|
4407
|
+
var toAbsoluteIndex = __webpack_require__("23cb");
|
|
4408
|
+
var lengthOfArrayLike = __webpack_require__("07fa");
|
|
4409
|
+
|
|
4410
|
+
// `Array.prototype.fill` method implementation
|
|
4411
|
+
// https://tc39.es/ecma262/#sec-array.prototype.fill
|
|
4412
|
+
module.exports = function fill(value /* , start = 0, end = @length */) {
|
|
4413
|
+
var O = toObject(this);
|
|
4414
|
+
var length = lengthOfArrayLike(O);
|
|
4415
|
+
var argumentsLength = arguments.length;
|
|
4416
|
+
var index = toAbsoluteIndex(argumentsLength > 1 ? arguments[1] : undefined, length);
|
|
4417
|
+
var end = argumentsLength > 2 ? arguments[2] : undefined;
|
|
4418
|
+
var endPos = end === undefined ? length : toAbsoluteIndex(end, length);
|
|
4419
|
+
while (endPos > index) O[index++] = value;
|
|
4420
|
+
return O;
|
|
4421
|
+
};
|
|
4422
|
+
|
|
4423
|
+
|
|
4308
4424
|
/***/ }),
|
|
4309
4425
|
|
|
4310
4426
|
/***/ "825a":
|
|
@@ -7063,6 +7179,25 @@ $({ target: 'Array', proto: true }, {
|
|
|
7063
7179
|
addToUnscopables('includes');
|
|
7064
7180
|
|
|
7065
7181
|
|
|
7182
|
+
/***/ }),
|
|
7183
|
+
|
|
7184
|
+
/***/ "cb29":
|
|
7185
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
7186
|
+
|
|
7187
|
+
var $ = __webpack_require__("23e7");
|
|
7188
|
+
var fill = __webpack_require__("81d5");
|
|
7189
|
+
var addToUnscopables = __webpack_require__("44d2");
|
|
7190
|
+
|
|
7191
|
+
// `Array.prototype.fill` method
|
|
7192
|
+
// https://tc39.es/ecma262/#sec-array.prototype.fill
|
|
7193
|
+
$({ target: 'Array', proto: true }, {
|
|
7194
|
+
fill: fill
|
|
7195
|
+
});
|
|
7196
|
+
|
|
7197
|
+
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
7198
|
+
addToUnscopables('fill');
|
|
7199
|
+
|
|
7200
|
+
|
|
7066
7201
|
/***/ }),
|
|
7067
7202
|
|
|
7068
7203
|
/***/ "cc12":
|
|
@@ -8956,6 +9091,9 @@ var modulesFiles = mf.keys().reduce(function (pre, cur) {
|
|
|
8956
9091
|
console.log("=====modulesFiles========");
|
|
8957
9092
|
console.log(modulesFiles);
|
|
8958
9093
|
/* harmony default export */ var webApi = (modulesFiles);
|
|
9094
|
+
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 5 modules
|
|
9095
|
+
var toConsumableArray = __webpack_require__("2909");
|
|
9096
|
+
|
|
8959
9097
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
|
|
8960
9098
|
var asyncToGenerator = __webpack_require__("1da1");
|
|
8961
9099
|
|
|
@@ -8974,9 +9112,30 @@ var es_number_constructor = __webpack_require__("a9e3");
|
|
|
8974
9112
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/web.timers.js
|
|
8975
9113
|
var web_timers = __webpack_require__("4795");
|
|
8976
9114
|
|
|
9115
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.date.to-string.js
|
|
9116
|
+
var es_date_to_string = __webpack_require__("0d03");
|
|
9117
|
+
|
|
9118
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.some.js
|
|
9119
|
+
var es_array_some = __webpack_require__("45fc");
|
|
9120
|
+
|
|
9121
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.find.js
|
|
9122
|
+
var es_array_find = __webpack_require__("7db0");
|
|
9123
|
+
|
|
9124
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.regexp.to-string.js
|
|
9125
|
+
var es_regexp_to_string = __webpack_require__("25f0");
|
|
9126
|
+
|
|
9127
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.concat.js
|
|
9128
|
+
var es_array_concat = __webpack_require__("99af");
|
|
9129
|
+
|
|
9130
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.fill.js
|
|
9131
|
+
var es_array_fill = __webpack_require__("cb29");
|
|
9132
|
+
|
|
8977
9133
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.regexp.test.js
|
|
8978
9134
|
var es_regexp_test = __webpack_require__("00b4");
|
|
8979
9135
|
|
|
9136
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.filter.js
|
|
9137
|
+
var es_array_filter = __webpack_require__("4de4");
|
|
9138
|
+
|
|
8980
9139
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.is-array.js
|
|
8981
9140
|
var es_array_is_array = __webpack_require__("277d");
|
|
8982
9141
|
|
|
@@ -9001,36 +9160,45 @@ var es_array_is_array = __webpack_require__("277d");
|
|
|
9001
9160
|
|
|
9002
9161
|
|
|
9003
9162
|
|
|
9004
|
-
var T = Object.defineProperty;
|
|
9005
9163
|
|
|
9006
|
-
|
|
9007
|
-
|
|
9164
|
+
|
|
9165
|
+
|
|
9166
|
+
|
|
9167
|
+
|
|
9168
|
+
|
|
9169
|
+
|
|
9170
|
+
|
|
9171
|
+
console.log('Library wexWebSip Build time: 2026_3_24 13:58:15');
|
|
9172
|
+
var A = Object.defineProperty;
|
|
9173
|
+
|
|
9174
|
+
var b = function b(y, e, t) {
|
|
9175
|
+
return e in y ? A(y, e, {
|
|
9008
9176
|
enumerable: !0,
|
|
9009
9177
|
configurable: !0,
|
|
9010
9178
|
writable: !0,
|
|
9011
9179
|
value: t
|
|
9012
|
-
}) :
|
|
9180
|
+
}) : y[e] = t;
|
|
9013
9181
|
};
|
|
9014
9182
|
|
|
9015
|
-
var
|
|
9016
|
-
return
|
|
9183
|
+
var phoneClient_S = function S(y, e, t) {
|
|
9184
|
+
return b(y, Object(esm_typeof["a" /* default */])(e) != "symbol" ? e + "" : e, t), t;
|
|
9017
9185
|
};
|
|
9018
9186
|
|
|
9019
|
-
|
|
9020
|
-
function j(e) {
|
|
9021
|
-
var _this = this;
|
|
9187
|
+
console.log("webphone version 1.0.2 2026-03-02 支持视频呼叫无摄像和麦克风能正常接听");
|
|
9022
9188
|
|
|
9023
|
-
|
|
9189
|
+
var phoneClient_O = /*#__PURE__*/function () {
|
|
9190
|
+
function O(e) {
|
|
9191
|
+
Object(classCallCheck["a" /* default */])(this, O);
|
|
9024
9192
|
|
|
9025
|
-
|
|
9026
|
-
|
|
9027
|
-
|
|
9028
|
-
var t = document.
|
|
9029
|
-
t.srcObject = e, t.onloadedmetadata = function () {
|
|
9193
|
+
phoneClient_S(this, "socket", null);
|
|
9194
|
+
phoneClient_S(this, "RTC", null);
|
|
9195
|
+
phoneClient_S(this, "bindLocalPicture", function (e) {
|
|
9196
|
+
var t = document.getElementById("local_video");
|
|
9197
|
+
e && (t.srcObject = e, t.onloadedmetadata = function () {
|
|
9030
9198
|
t.play();
|
|
9031
|
-
};
|
|
9199
|
+
});
|
|
9032
9200
|
});
|
|
9033
|
-
this.wsUrl = e, this.Offer = null, this.localId = "", this.remoteId = "", this.remoteAudioId = "", this.videoStream = null, this.timeOutKL = null, this.reloadObj = {
|
|
9201
|
+
this.wsUrl = e, this.Offer = null, this.localId = "local_video", this.remoteId = "", this.remoteAudioId = "", this.videoStream = null, this.audioStream = null, this.timeOutKL = null, this.reloadObj = {
|
|
9034
9202
|
num: 0,
|
|
9035
9203
|
maxNum: 10,
|
|
9036
9204
|
timeOut: null,
|
|
@@ -9039,23 +9207,36 @@ var phoneClient_j = /*#__PURE__*/function () {
|
|
|
9039
9207
|
}, this.mediaSet = {
|
|
9040
9208
|
video: !0,
|
|
9041
9209
|
audio: !0
|
|
9042
|
-
}, this.callData = {}, this.socketCode = -1, this.compatible(), this.createRTC(), this.
|
|
9210
|
+
}, this.shareGetAudio = !1, this.requestAnimationFrameTimer = null, this.presentStream = "user", this.displayMedia = null, this.callData = {}, this.callInType = 2, this.socketCode = -1, this.compatible(), this.createRTC(), this.localCameraStaus = !0;
|
|
9043
9211
|
}
|
|
9044
9212
|
|
|
9045
|
-
Object(createClass["a" /* default */])(
|
|
9213
|
+
Object(createClass["a" /* default */])(O, [{
|
|
9046
9214
|
key: "compatible",
|
|
9047
9215
|
value: function compatible() {
|
|
9048
|
-
|
|
9049
|
-
|
|
9050
|
-
|
|
9051
|
-
|
|
9216
|
+
var e = this;
|
|
9217
|
+
window.RTCPeerConnection = window.RTCPeerConnection || window.webkitRTCPeerConnection || window.mozRTCPeerConnection || window.msRTCPeerConnection, navigator.mediaDevices.getUserMedia === void 0 && (navigator.mediaDevices.getUserMedia = function (t) {
|
|
9218
|
+
var a = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia || navigator.oGetUserMedia;
|
|
9219
|
+
return a ? new Promise(function (i, o) {
|
|
9220
|
+
a.call(navigator, t, i, o);
|
|
9052
9221
|
}) : Promise.reject(new Error("getUserMedia is not implemented in this browser"));
|
|
9053
|
-
}())
|
|
9222
|
+
}()), window.addEventListener("online", function () {
|
|
9223
|
+
console.log("网络连接恢复!"), e.messageBack && e.messageBack.call(null, {
|
|
9224
|
+
type: "online",
|
|
9225
|
+
code: -8,
|
|
9226
|
+
message: "网络已恢复!"
|
|
9227
|
+
});
|
|
9228
|
+
}), window.addEventListener("offline", function () {
|
|
9229
|
+
console.log("网络连接断开!"), e.messageBack && e.messageBack.call(null, {
|
|
9230
|
+
type: "offline",
|
|
9231
|
+
code: -8,
|
|
9232
|
+
message: "网络已断开!"
|
|
9233
|
+
});
|
|
9234
|
+
});
|
|
9054
9235
|
}
|
|
9055
9236
|
}, {
|
|
9056
9237
|
key: "newSocket",
|
|
9057
9238
|
value: function newSocket() {
|
|
9058
|
-
if (this.socket && (console.log(this.socket), this.socket = null), !this.online()) {
|
|
9239
|
+
if (this.socket && (console.log(this.socket), this.onclose(), this.socket = null), !this.online()) {
|
|
9059
9240
|
console.log("当前网络差,无法连接");
|
|
9060
9241
|
return;
|
|
9061
9242
|
}
|
|
@@ -9091,44 +9272,61 @@ var phoneClient_j = /*#__PURE__*/function () {
|
|
|
9091
9272
|
}, {
|
|
9092
9273
|
key: "open",
|
|
9093
9274
|
value: function open() {
|
|
9094
|
-
var
|
|
9275
|
+
var _this = this;
|
|
9095
9276
|
|
|
9096
9277
|
var e = this;
|
|
9097
9278
|
|
|
9098
|
-
this.socket.onopen = function (
|
|
9099
|
-
|
|
9100
|
-
|
|
9101
|
-
|
|
9102
|
-
|
|
9103
|
-
|
|
9104
|
-
|
|
9105
|
-
|
|
9106
|
-
|
|
9107
|
-
|
|
9108
|
-
|
|
9109
|
-
|
|
9110
|
-
|
|
9111
|
-
case 2:
|
|
9112
|
-
console.log("连接正在关闭"), i = "socket连接正在关闭_" + t.type;
|
|
9113
|
-
break;
|
|
9114
|
-
|
|
9115
|
-
case 3:
|
|
9116
|
-
console.log("连接已经关闭,或失败"), i = "socket连接失败_" + t.type, e.reloadObj.num = e.reloadObj.num + 1, e.reloadObj.num >= e.reloadObj.maxNum ? (i = "大于最大连接次数,停止连接,返回首页", console.log("大于最大连接次数,停止连接,返回首页"), e.reloadObj.href && (window.location.href = e.reloadObj.href), e.reloadObj.timeOut && clearTimeout(e.reloadObj.timeOut), e.reloadObj.timeOut = setTimeout(function () {
|
|
9117
|
-
e.close();
|
|
9118
|
-
}, e.reloadObj.reloadTime)) : console.log("继续连接");
|
|
9119
|
-
break;
|
|
9120
|
-
}
|
|
9279
|
+
this.socket.onopen = /*#__PURE__*/function () {
|
|
9280
|
+
var _ref = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee(t) {
|
|
9281
|
+
var a, i;
|
|
9282
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
9283
|
+
while (1) {
|
|
9284
|
+
switch (_context.prev = _context.next) {
|
|
9285
|
+
case 0:
|
|
9286
|
+
a = _this.checkReadyState();
|
|
9287
|
+
e.socketCode = a;
|
|
9288
|
+
i = "";
|
|
9289
|
+
_context.t0 = Number(a);
|
|
9290
|
+
_context.next = _context.t0 === 1 ? 6 : _context.t0 === 2 ? 8 : _context.t0 === 3 ? 10 : 12;
|
|
9291
|
+
break;
|
|
9121
9292
|
|
|
9122
|
-
|
|
9123
|
-
|
|
9124
|
-
|
|
9125
|
-
|
|
9126
|
-
|
|
9127
|
-
|
|
9128
|
-
|
|
9129
|
-
|
|
9293
|
+
case 6:
|
|
9294
|
+
console.log("连接成功"), i = "socket连接成功_" + t.type, e.num = 0, e.keepLive();
|
|
9295
|
+
return _context.abrupt("break", 12);
|
|
9296
|
+
|
|
9297
|
+
case 8:
|
|
9298
|
+
console.log("连接正在关闭"), i = "socket连接正在关闭_" + t.type;
|
|
9299
|
+
return _context.abrupt("break", 12);
|
|
9300
|
+
|
|
9301
|
+
case 10:
|
|
9302
|
+
console.log("连接已经关闭,或失败"), i = "socket连接失败_" + t.type, e.reloadObj.num = e.reloadObj.num + 1, e.reloadObj.num >= e.reloadObj.maxNum ? (i = "大于最大连接次数,停止连接,返回首页", console.log("大于最大连接次数,停止连接,返回首页"), e.reloadObj.href && (window.location.href = e.reloadObj.href), e.reloadObj.timeOut && clearTimeout(e.reloadObj.timeOut), e.reloadObj.timeOut = setTimeout(function () {
|
|
9303
|
+
e.close();
|
|
9304
|
+
}, e.reloadObj.reloadTime)) : console.log("继续连接");
|
|
9305
|
+
return _context.abrupt("break", 12);
|
|
9306
|
+
|
|
9307
|
+
case 12:
|
|
9308
|
+
console.log("open--->", e.messageBack), e.messageBack && (a == 1 ? e.messageBack.call(null, {
|
|
9309
|
+
type: t.type,
|
|
9310
|
+
code: 200,
|
|
9311
|
+
message: i
|
|
9312
|
+
}) : e.messageBack.call(null, {
|
|
9313
|
+
type: t.type,
|
|
9314
|
+
code: -1,
|
|
9315
|
+
err: i
|
|
9316
|
+
}));
|
|
9317
|
+
|
|
9318
|
+
case 13:
|
|
9319
|
+
case "end":
|
|
9320
|
+
return _context.stop();
|
|
9321
|
+
}
|
|
9322
|
+
}
|
|
9323
|
+
}, _callee);
|
|
9130
9324
|
}));
|
|
9131
|
-
|
|
9325
|
+
|
|
9326
|
+
return function (_x) {
|
|
9327
|
+
return _ref.apply(this, arguments);
|
|
9328
|
+
};
|
|
9329
|
+
}();
|
|
9132
9330
|
}
|
|
9133
9331
|
}, {
|
|
9134
9332
|
key: "keepLive",
|
|
@@ -9143,61 +9341,66 @@ var phoneClient_j = /*#__PURE__*/function () {
|
|
|
9143
9341
|
}, {
|
|
9144
9342
|
key: "message",
|
|
9145
9343
|
value: function message() {
|
|
9146
|
-
var
|
|
9344
|
+
var _this2 = this;
|
|
9147
9345
|
|
|
9148
9346
|
var e = this;
|
|
9149
|
-
|
|
9150
|
-
|
|
9151
|
-
var o = t.data,
|
|
9347
|
+
console.log("message-->"), this.socket.onmessage = function (t) {
|
|
9348
|
+
var a = t.data,
|
|
9152
9349
|
i = {};
|
|
9153
9350
|
|
|
9154
|
-
if (
|
|
9155
|
-
var
|
|
9156
|
-
|
|
9351
|
+
if (a) {
|
|
9352
|
+
var o = JSON.parse(a),
|
|
9353
|
+
s = "";
|
|
9157
9354
|
|
|
9158
|
-
switch (
|
|
9355
|
+
switch (o.type) {
|
|
9159
9356
|
case "login":
|
|
9160
|
-
|
|
9357
|
+
s = "登录成功";
|
|
9161
9358
|
break;
|
|
9162
9359
|
|
|
9163
9360
|
case "on_answer":
|
|
9164
|
-
|
|
9361
|
+
s = "已接听", e.setRemote(o.sdp);
|
|
9165
9362
|
break;
|
|
9166
9363
|
|
|
9167
9364
|
case "on_new_call":
|
|
9168
|
-
|
|
9169
|
-
isvideo:
|
|
9170
|
-
fromtel:
|
|
9365
|
+
e.callInType = o.isvideo ? "2" : "1", s = "有来电呼叫", i = {
|
|
9366
|
+
isvideo: o.isvideo,
|
|
9367
|
+
fromtel: o.from || ""
|
|
9171
9368
|
};
|
|
9172
9369
|
break;
|
|
9173
9370
|
|
|
9174
9371
|
case "on_ack":
|
|
9175
|
-
|
|
9372
|
+
s = "来电接听成功", e.setRemote(o.sdp);
|
|
9176
9373
|
break;
|
|
9177
9374
|
|
|
9178
9375
|
case "on_hangup":
|
|
9179
|
-
|
|
9180
|
-
|
|
9181
|
-
|
|
9376
|
+
console.log("被动动挂断电话"), s = "已挂断", _this2.RTC && e.RTC.getSenders().forEach(function (n) {
|
|
9377
|
+
n && n.track && n.track.stop();
|
|
9378
|
+
}), _this2.stopStack(), _this2.RTC = null;
|
|
9379
|
+
var r = document.getElementById(_this2.remoteId);
|
|
9380
|
+
r.srcObject = null, e.requestAnimationFrameTimer && cancelAnimationFrame(e.requestAnimationFrameTimer), _this2.createRTC();
|
|
9381
|
+
break;
|
|
9382
|
+
|
|
9383
|
+
case "hangup":
|
|
9384
|
+
s = "您已挂断", console.log("主动挂断电话"), _this2.stopStack();
|
|
9182
9385
|
break;
|
|
9183
9386
|
|
|
9184
9387
|
case "keepAlive":
|
|
9185
|
-
|
|
9388
|
+
_this2.keepLive();
|
|
9186
9389
|
|
|
9187
9390
|
break;
|
|
9188
9391
|
}
|
|
9189
9392
|
|
|
9190
|
-
|
|
9393
|
+
o.result ? o.type !== "keepAlive" && e.messageBack.call(null, {
|
|
9191
9394
|
code: 200,
|
|
9192
|
-
type:
|
|
9193
|
-
message:
|
|
9395
|
+
type: o.type,
|
|
9396
|
+
message: s,
|
|
9194
9397
|
data: i
|
|
9195
|
-
})
|
|
9398
|
+
}) : (e.stopStack(), e.messageBack.call(null, {
|
|
9196
9399
|
code: -1,
|
|
9197
|
-
type:
|
|
9198
|
-
err: "失败_" +
|
|
9199
|
-
});
|
|
9200
|
-
} else console.log("服务器无返回数据--");
|
|
9400
|
+
type: o.type,
|
|
9401
|
+
err: "失败_" + o.reason || false
|
|
9402
|
+
}));
|
|
9403
|
+
} else e.stopStack(), console.log("服务器无返回数据--");
|
|
9201
9404
|
};
|
|
9202
9405
|
} // 用于指定报错时的回调函数。
|
|
9203
9406
|
|
|
@@ -9213,19 +9416,37 @@ var phoneClient_j = /*#__PURE__*/function () {
|
|
|
9213
9416
|
e.newSocket();
|
|
9214
9417
|
}, e.reloadObj.reloadTime);
|
|
9215
9418
|
}
|
|
9419
|
+
}, {
|
|
9420
|
+
key: "errorReloadCont",
|
|
9421
|
+
value: function errorReloadCont(e) {
|
|
9422
|
+
var t = this;
|
|
9423
|
+
this.errorTime = setTimeout(function () {
|
|
9424
|
+
t.newSocket();
|
|
9425
|
+
}, (e || 10) * 1e3);
|
|
9426
|
+
}
|
|
9427
|
+
}, {
|
|
9428
|
+
key: "clearErrorTime",
|
|
9429
|
+
value: function clearErrorTime() {
|
|
9430
|
+
clearTimeout(this.errorTime);
|
|
9431
|
+
}
|
|
9216
9432
|
}, {
|
|
9217
9433
|
key: "error",
|
|
9218
9434
|
value: function error() {
|
|
9435
|
+
var _this3 = this;
|
|
9436
|
+
|
|
9219
9437
|
var e = this;
|
|
9220
9438
|
|
|
9221
9439
|
this.socket.onerror = function (t) {
|
|
9222
|
-
var
|
|
9440
|
+
var a = {
|
|
9223
9441
|
type: t.type,
|
|
9224
9442
|
code: -4,
|
|
9225
9443
|
err: "socket连接错误_" + t.type // message:'连接_'+event.type,
|
|
9226
9444
|
|
|
9227
9445
|
};
|
|
9228
|
-
|
|
9446
|
+
var i = /* @__PURE__ */new Date(),
|
|
9447
|
+
o = i.getMinutes(),
|
|
9448
|
+
s = i.getSeconds();
|
|
9449
|
+
console.log("err----minute-->", o, s), clearTimeout(_this3.reloadObj.timeOut), e.messageBack.call(null, a);
|
|
9229
9450
|
};
|
|
9230
9451
|
}
|
|
9231
9452
|
}, {
|
|
@@ -9237,13 +9458,13 @@ var phoneClient_j = /*#__PURE__*/function () {
|
|
|
9237
9458
|
|
|
9238
9459
|
this.socket.onclose = function (t) {
|
|
9239
9460
|
console.log("close--->", t);
|
|
9240
|
-
var
|
|
9461
|
+
var a = {
|
|
9241
9462
|
type: t.type,
|
|
9242
9463
|
code: -1,
|
|
9243
9464
|
err: "socket连接已关闭_" + t.type // message:'连接已关闭',
|
|
9244
9465
|
|
|
9245
9466
|
};
|
|
9246
|
-
clearTimeout(_this4.reloadObj.timeOut), e.messageBack.call(null,
|
|
9467
|
+
_this4.reloadObj.timeOut && clearTimeout(_this4.reloadObj.timeOut), _this4.timeOutKL && clearInterval(_this4.timeOutKL), e.messageBack.call(null, a);
|
|
9247
9468
|
};
|
|
9248
9469
|
}
|
|
9249
9470
|
}, {
|
|
@@ -9259,18 +9480,31 @@ var phoneClient_j = /*#__PURE__*/function () {
|
|
|
9259
9480
|
|
|
9260
9481
|
this.socket.disconnect = function (t) {
|
|
9261
9482
|
console.log("disconnect", t), e.socketCode = 5;
|
|
9262
|
-
var
|
|
9483
|
+
var a = {
|
|
9263
9484
|
type: t.type,
|
|
9264
9485
|
code: -1,
|
|
9265
9486
|
err: "连接已断开_" + t.type
|
|
9266
9487
|
};
|
|
9267
|
-
e.messageBack.call(null,
|
|
9488
|
+
e.messageBack.call(null, a);
|
|
9268
9489
|
};
|
|
9269
9490
|
}
|
|
9270
9491
|
}, {
|
|
9271
9492
|
key: "onclose",
|
|
9272
9493
|
value: function onclose() {
|
|
9273
|
-
this.
|
|
9494
|
+
var e = this.checkReadyState();
|
|
9495
|
+
console.log("code-->", e);
|
|
9496
|
+
var t = /* @__PURE__ */new Date(),
|
|
9497
|
+
a = t.getMinutes(),
|
|
9498
|
+
i = t.getSeconds();
|
|
9499
|
+
if (console.log("minute-->", a, i), e == 1) this.socket.close();else if (e != 2) {
|
|
9500
|
+
var o = {
|
|
9501
|
+
type: "close",
|
|
9502
|
+
code: -1,
|
|
9503
|
+
err: "socket连接已关闭_" + e // message:'连接已关闭',
|
|
9504
|
+
|
|
9505
|
+
};
|
|
9506
|
+
clearTimeout(this.reloadObj.timeOut), this.messageBack.call(null, o);
|
|
9507
|
+
}
|
|
9274
9508
|
} //发送消息
|
|
9275
9509
|
|
|
9276
9510
|
}, {
|
|
@@ -9287,19 +9521,24 @@ var phoneClient_j = /*#__PURE__*/function () {
|
|
|
9287
9521
|
return;
|
|
9288
9522
|
}
|
|
9289
9523
|
|
|
9290
|
-
|
|
9291
|
-
|
|
9292
|
-
|
|
9293
|
-
|
|
9294
|
-
|
|
9295
|
-
err
|
|
9296
|
-
|
|
9524
|
+
var a = this.checkReadyState();
|
|
9525
|
+
if (a == 1) this.socket.send(JSON.stringify(t));else {
|
|
9526
|
+
var i = /* @__PURE__ */new Date(),
|
|
9527
|
+
o = i.getMinutes(),
|
|
9528
|
+
s = i.getSeconds();
|
|
9529
|
+
console.log("err----minute-->", o, s), this.messageBack.call(null, {
|
|
9530
|
+
code: -3,
|
|
9531
|
+
type: "error",
|
|
9532
|
+
err: "连接异常_" + a
|
|
9533
|
+
});
|
|
9534
|
+
}
|
|
9297
9535
|
}
|
|
9298
9536
|
}, {
|
|
9299
9537
|
key: "createRTC",
|
|
9300
9538
|
value: function createRTC(e) {
|
|
9301
|
-
var
|
|
9302
|
-
|
|
9539
|
+
var _this5 = this;
|
|
9540
|
+
|
|
9541
|
+
var t = {// iceServers: [
|
|
9303
9542
|
// {
|
|
9304
9543
|
// urls: ['turn:115.28.186.199:3478'],
|
|
9305
9544
|
// username: "user1",
|
|
@@ -9312,68 +9551,72 @@ var phoneClient_j = /*#__PURE__*/function () {
|
|
|
9312
9551
|
// }
|
|
9313
9552
|
// ],
|
|
9314
9553
|
};
|
|
9315
|
-
this.RTC && (this.RTC = null), this.RTC = new RTCPeerConnection(e ||
|
|
9316
|
-
|
|
9317
|
-
|
|
9318
|
-
|
|
9319
|
-
|
|
9320
|
-
|
|
9321
|
-
|
|
9322
|
-
|
|
9323
|
-
|
|
9324
|
-
|
|
9325
|
-
|
|
9326
|
-
}
|
|
9327
|
-
} else {
|
|
9328
|
-
var
|
|
9554
|
+
this.RTC && (this.RTC = null), this.RTC = new RTCPeerConnection(e || t), this.RTC.onicecandidate = function (a) {}, this.RTC.ontrack = function (a) {
|
|
9555
|
+
var i = document.getElementById(_this5.remoteId),
|
|
9556
|
+
o = document.getElementById(_this5.remoteAudioId),
|
|
9557
|
+
s = a.track;
|
|
9558
|
+
|
|
9559
|
+
if (console.log("--ontrack-streams-", a.streams), s.kind == "video") {
|
|
9560
|
+
if (s.contentHint = "detail", !i.srcObject) {
|
|
9561
|
+
var r = new MediaStream();
|
|
9562
|
+
r.addTrack(s), i.srcObject = r, i.onloadedmetadata = function () {
|
|
9563
|
+
i.play();
|
|
9564
|
+
};
|
|
9565
|
+
}
|
|
9566
|
+
} else if (s.kind == "audio") {
|
|
9567
|
+
var _r = new MediaStream();
|
|
9329
9568
|
|
|
9330
|
-
|
|
9331
|
-
|
|
9569
|
+
_r.addTrack(a.track), o.srcObject = _r, o.onloadedmetadata = function () {
|
|
9570
|
+
o.play();
|
|
9332
9571
|
};
|
|
9333
|
-
}
|
|
9334
|
-
}, this.RTC.onnegotiationneeded = function (
|
|
9335
|
-
console.log("onnegotiationneeded--->", i);
|
|
9336
|
-
}, this.RTC.iceconnectionstatechange = function (i) {};
|
|
9572
|
+
} else console.log("remoteOntrack-err->", a, a.track);
|
|
9573
|
+
}, this.RTC.onnegotiationneeded = function (a) {}, this.RTC.iceconnectionstatechange = function (a) {}, this.RTC.icegatheringstatechange = function (a) {};
|
|
9337
9574
|
}
|
|
9338
9575
|
}, {
|
|
9339
9576
|
key: "addTracks",
|
|
9340
9577
|
value: function addTracks(e) {
|
|
9341
|
-
var t = this
|
|
9342
|
-
o = e.getTracks();
|
|
9578
|
+
var t = this;
|
|
9343
9579
|
|
|
9344
|
-
if (!
|
|
9580
|
+
if (!e) {
|
|
9581
|
+
console.log("无法打开设备获取到流", e);
|
|
9582
|
+
return;
|
|
9583
|
+
}
|
|
9584
|
+
|
|
9585
|
+
var a = e.getTracks();
|
|
9586
|
+
|
|
9587
|
+
if (!a || a.length < 1) {
|
|
9345
9588
|
console.log("无法获取视频或麦克风任一轨道数据,请查看是否开启成功");
|
|
9346
9589
|
return;
|
|
9347
9590
|
}
|
|
9348
9591
|
|
|
9349
|
-
|
|
9350
|
-
|
|
9592
|
+
a.forEach(function (i) {
|
|
9593
|
+
i && (t.RTC ? t.RTC.addTrack(i, e) : console.log("that.RTC-->", t.RTC));
|
|
9351
9594
|
});
|
|
9352
9595
|
}
|
|
9353
9596
|
}, {
|
|
9354
9597
|
key: "createOffer",
|
|
9355
9598
|
value: function () {
|
|
9356
|
-
var _createOffer = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9599
|
+
var _createOffer = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
9357
9600
|
var e;
|
|
9358
|
-
return regeneratorRuntime.wrap(function
|
|
9601
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
9359
9602
|
while (1) {
|
|
9360
|
-
switch (
|
|
9603
|
+
switch (_context2.prev = _context2.next) {
|
|
9361
9604
|
case 0:
|
|
9362
|
-
|
|
9605
|
+
_context2.next = 2;
|
|
9363
9606
|
return this.RTC.createOffer();
|
|
9364
9607
|
|
|
9365
9608
|
case 2:
|
|
9366
|
-
e =
|
|
9609
|
+
e = _context2.sent;
|
|
9367
9610
|
this.Offer = e;
|
|
9368
|
-
|
|
9611
|
+
_context2.next = 6;
|
|
9369
9612
|
return this.RTC.setLocalDescription(e);
|
|
9370
9613
|
|
|
9371
9614
|
case 6:
|
|
9372
9615
|
case "end":
|
|
9373
|
-
return
|
|
9616
|
+
return _context2.stop();
|
|
9374
9617
|
}
|
|
9375
9618
|
}
|
|
9376
|
-
},
|
|
9619
|
+
}, _callee2, this);
|
|
9377
9620
|
}));
|
|
9378
9621
|
|
|
9379
9622
|
function createOffer() {
|
|
@@ -9385,10 +9628,10 @@ var phoneClient_j = /*#__PURE__*/function () {
|
|
|
9385
9628
|
}, {
|
|
9386
9629
|
key: "setRemote",
|
|
9387
9630
|
value: function () {
|
|
9388
|
-
var _setRemote = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9389
|
-
return regeneratorRuntime.wrap(function
|
|
9631
|
+
var _setRemote = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(e) {
|
|
9632
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
9390
9633
|
while (1) {
|
|
9391
|
-
switch (
|
|
9634
|
+
switch (_context3.prev = _context3.next) {
|
|
9392
9635
|
case 0:
|
|
9393
9636
|
this.RTC.setRemoteDescription(new RTCSessionDescription({
|
|
9394
9637
|
type: "answer",
|
|
@@ -9401,13 +9644,13 @@ var phoneClient_j = /*#__PURE__*/function () {
|
|
|
9401
9644
|
|
|
9402
9645
|
case 1:
|
|
9403
9646
|
case "end":
|
|
9404
|
-
return
|
|
9647
|
+
return _context3.stop();
|
|
9405
9648
|
}
|
|
9406
9649
|
}
|
|
9407
|
-
},
|
|
9650
|
+
}, _callee3, this);
|
|
9408
9651
|
}));
|
|
9409
9652
|
|
|
9410
|
-
function setRemote(
|
|
9653
|
+
function setRemote(_x2) {
|
|
9411
9654
|
return _setRemote.apply(this, arguments);
|
|
9412
9655
|
}
|
|
9413
9656
|
|
|
@@ -9416,215 +9659,837 @@ var phoneClient_j = /*#__PURE__*/function () {
|
|
|
9416
9659
|
}, {
|
|
9417
9660
|
key: "getDeviceList",
|
|
9418
9661
|
value: function () {
|
|
9419
|
-
var _getDeviceList = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9420
|
-
|
|
9421
|
-
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
9662
|
+
var _getDeviceList = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
|
|
9663
|
+
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
9422
9664
|
while (1) {
|
|
9423
|
-
switch (
|
|
9665
|
+
switch (_context4.prev = _context4.next) {
|
|
9424
9666
|
case 0:
|
|
9425
|
-
|
|
9667
|
+
_context4.next = 2;
|
|
9426
9668
|
return navigator.mediaDevices.enumerateDevices();
|
|
9427
9669
|
|
|
9428
9670
|
case 2:
|
|
9429
|
-
|
|
9671
|
+
return _context4.abrupt("return", _context4.sent);
|
|
9430
9672
|
|
|
9431
|
-
|
|
9432
|
-
_context3.next = 5;
|
|
9433
|
-
break;
|
|
9434
|
-
}
|
|
9435
|
-
|
|
9436
|
-
return _context3.abrupt("return", t);
|
|
9437
|
-
|
|
9438
|
-
case 5:
|
|
9439
|
-
o = [];
|
|
9440
|
-
return _context3.abrupt("return", (t && t.length > 0 && t.forEach(function (i) {
|
|
9441
|
-
i.kind.indexOf(e) > -1 && o.push(i);
|
|
9442
|
-
}), o));
|
|
9443
|
-
|
|
9444
|
-
case 7:
|
|
9673
|
+
case 3:
|
|
9445
9674
|
case "end":
|
|
9446
|
-
return
|
|
9675
|
+
return _context4.stop();
|
|
9447
9676
|
}
|
|
9448
9677
|
}
|
|
9449
|
-
},
|
|
9678
|
+
}, _callee4);
|
|
9450
9679
|
}));
|
|
9451
9680
|
|
|
9452
|
-
function getDeviceList(
|
|
9681
|
+
function getDeviceList() {
|
|
9453
9682
|
return _getDeviceList.apply(this, arguments);
|
|
9454
9683
|
}
|
|
9455
9684
|
|
|
9456
9685
|
return getDeviceList;
|
|
9457
9686
|
}()
|
|
9458
9687
|
}, {
|
|
9459
|
-
key: "
|
|
9688
|
+
key: "bindStream",
|
|
9460
9689
|
value: function () {
|
|
9461
|
-
var
|
|
9462
|
-
var
|
|
9463
|
-
return regeneratorRuntime.wrap(function
|
|
9690
|
+
var _bindStream = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(e, t) {
|
|
9691
|
+
var a, i, o, s, r;
|
|
9692
|
+
return regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
9464
9693
|
while (1) {
|
|
9465
|
-
switch (
|
|
9694
|
+
switch (_context5.prev = _context5.next) {
|
|
9466
9695
|
case 0:
|
|
9467
|
-
|
|
9468
|
-
|
|
9469
|
-
|
|
9696
|
+
if (e) {
|
|
9697
|
+
_context5.next = 2;
|
|
9698
|
+
break;
|
|
9699
|
+
}
|
|
9700
|
+
|
|
9701
|
+
return _context5.abrupt("return");
|
|
9702
|
+
|
|
9703
|
+
case 2:
|
|
9704
|
+
a = document.querySelector("#" + e);
|
|
9705
|
+
|
|
9706
|
+
if (!(console.log("videoId-->", e, a), !a)) {
|
|
9707
|
+
_context5.next = 6;
|
|
9708
|
+
break;
|
|
9709
|
+
}
|
|
9710
|
+
|
|
9711
|
+
console.log("无法找到对应的dom");
|
|
9712
|
+
return _context5.abrupt("return");
|
|
9713
|
+
|
|
9714
|
+
case 6:
|
|
9715
|
+
i = {
|
|
9716
|
+
video: {
|
|
9717
|
+
deviceId: t.camerId
|
|
9718
|
+
},
|
|
9470
9719
|
audio: {
|
|
9471
|
-
|
|
9472
|
-
echoCancellation: !0
|
|
9720
|
+
deviceId: t.voiceId
|
|
9473
9721
|
}
|
|
9474
9722
|
};
|
|
9475
|
-
|
|
9476
|
-
return navigator.mediaDevices.getUserMedia(
|
|
9477
|
-
|
|
9478
|
-
case 3:
|
|
9479
|
-
o = _context4.sent;
|
|
9480
|
-
this.videoStream = o;
|
|
9481
|
-
_context4.next = 7;
|
|
9482
|
-
return this.addTracks(o);
|
|
9723
|
+
_context5.next = 9;
|
|
9724
|
+
return navigator.mediaDevices.getUserMedia(i);
|
|
9483
9725
|
|
|
9484
|
-
case
|
|
9485
|
-
|
|
9726
|
+
case 9:
|
|
9727
|
+
o = _context5.sent;
|
|
9728
|
+
s = document.getElementById("viewVideo");
|
|
9729
|
+
console.log("container-->", a), console.log("contains--->", a.contains(s)), a.contains(s) && (a.innerHTML = "");
|
|
9730
|
+
r = document.createElement("video");
|
|
9731
|
+
r.id = "viewVideo", r.autoplay = !0, r.playsInline = "playsInline", r.muted = !1, r.style.width = "100%", r.style.height = "100%", r.className = "viewVideo_class", a.appendChild(r), o && (r.srcObject = o, r.onloadedmetadata = function () {
|
|
9732
|
+
r.play();
|
|
9733
|
+
});
|
|
9486
9734
|
|
|
9487
|
-
case
|
|
9735
|
+
case 14:
|
|
9488
9736
|
case "end":
|
|
9489
|
-
return
|
|
9737
|
+
return _context5.stop();
|
|
9490
9738
|
}
|
|
9491
9739
|
}
|
|
9492
|
-
},
|
|
9740
|
+
}, _callee5);
|
|
9493
9741
|
}));
|
|
9494
9742
|
|
|
9495
|
-
function
|
|
9496
|
-
return
|
|
9743
|
+
function bindStream(_x3, _x4) {
|
|
9744
|
+
return _bindStream.apply(this, arguments);
|
|
9497
9745
|
}
|
|
9498
9746
|
|
|
9499
|
-
return
|
|
9747
|
+
return bindStream;
|
|
9500
9748
|
}()
|
|
9501
9749
|
}, {
|
|
9502
|
-
key: "
|
|
9750
|
+
key: "stopLocalViewStream",
|
|
9503
9751
|
value: function () {
|
|
9504
|
-
var
|
|
9505
|
-
var
|
|
9506
|
-
return regeneratorRuntime.wrap(function
|
|
9752
|
+
var _stopLocalViewStream = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(e, t) {
|
|
9753
|
+
var a, i;
|
|
9754
|
+
return regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
9507
9755
|
while (1) {
|
|
9508
|
-
switch (
|
|
9756
|
+
switch (_context6.prev = _context6.next) {
|
|
9509
9757
|
case 0:
|
|
9510
|
-
|
|
9511
|
-
|
|
9512
|
-
|
|
9513
|
-
|
|
9514
|
-
|
|
9515
|
-
|
|
9758
|
+
a = document.querySelector("#" + e + " #viewVideo");
|
|
9759
|
+
|
|
9760
|
+
if (a) {
|
|
9761
|
+
i = a.srcObject.getTracks();
|
|
9762
|
+
console.log("viewVideoDom--tracks-->", i), i && i.forEach(function (o) {
|
|
9763
|
+
t ? o.kind == t && o.stop() : o.stop();
|
|
9764
|
+
}), a.srcObject = null;
|
|
9516
9765
|
}
|
|
9517
9766
|
|
|
9518
|
-
case
|
|
9767
|
+
case 2:
|
|
9519
9768
|
case "end":
|
|
9520
|
-
return
|
|
9769
|
+
return _context6.stop();
|
|
9521
9770
|
}
|
|
9522
9771
|
}
|
|
9523
|
-
},
|
|
9772
|
+
}, _callee6);
|
|
9524
9773
|
}));
|
|
9525
9774
|
|
|
9526
|
-
function
|
|
9527
|
-
return
|
|
9775
|
+
function stopLocalViewStream(_x5, _x6) {
|
|
9776
|
+
return _stopLocalViewStream.apply(this, arguments);
|
|
9528
9777
|
}
|
|
9529
9778
|
|
|
9530
|
-
return
|
|
9779
|
+
return stopLocalViewStream;
|
|
9531
9780
|
}()
|
|
9532
|
-
/**
|
|
9533
|
-
* 初始化 dome 配置和方法
|
|
9534
|
-
* video 开启视频
|
|
9535
|
-
* audio 开启音频
|
|
9536
|
-
* callback 贯穿整个线的消息回调
|
|
9537
|
-
* @param {*} data
|
|
9538
|
-
*/
|
|
9539
|
-
|
|
9540
9781
|
}, {
|
|
9541
|
-
key: "
|
|
9782
|
+
key: "getDeviceType",
|
|
9542
9783
|
value: function () {
|
|
9543
|
-
var
|
|
9544
|
-
var e,
|
|
9545
|
-
|
|
9546
|
-
o,
|
|
9547
|
-
i,
|
|
9548
|
-
s,
|
|
9549
|
-
_args6 = arguments;
|
|
9550
|
-
return regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
9784
|
+
var _getDeviceType = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee7() {
|
|
9785
|
+
var e, t, a, i;
|
|
9786
|
+
return regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
9551
9787
|
while (1) {
|
|
9552
|
-
switch (
|
|
9788
|
+
switch (_context7.prev = _context7.next) {
|
|
9553
9789
|
case 0:
|
|
9554
|
-
e =
|
|
9555
|
-
|
|
9556
|
-
|
|
9557
|
-
|
|
9558
|
-
isDrag: !0,
|
|
9559
|
-
showLocal: !0,
|
|
9560
|
-
callback: new Function()
|
|
9561
|
-
};
|
|
9562
|
-
|
|
9563
|
-
if (this.online()) {
|
|
9564
|
-
_context6.next = 4;
|
|
9565
|
-
break;
|
|
9566
|
-
}
|
|
9567
|
-
|
|
9568
|
-
e.callback({
|
|
9569
|
-
code: -2,
|
|
9570
|
-
type: "internet",
|
|
9571
|
-
err: "当前网络差,请检查网络后重试"
|
|
9572
|
-
});
|
|
9573
|
-
return _context6.abrupt("return");
|
|
9790
|
+
e = [], t = -1;
|
|
9791
|
+
_context7.prev = 1;
|
|
9792
|
+
_context7.next = 4;
|
|
9793
|
+
return navigator.mediaDevices.enumerateDevices();
|
|
9574
9794
|
|
|
9575
9795
|
case 4:
|
|
9576
|
-
|
|
9577
|
-
|
|
9578
|
-
|
|
9579
|
-
}
|
|
9580
|
-
|
|
9581
|
-
console.log("请添加视频容器");
|
|
9582
|
-
return _context6.abrupt("return");
|
|
9796
|
+
e = _context7.sent;
|
|
9797
|
+
_context7.next = 10;
|
|
9798
|
+
break;
|
|
9583
9799
|
|
|
9584
9800
|
case 7:
|
|
9585
|
-
|
|
9586
|
-
|
|
9587
|
-
|
|
9588
|
-
|
|
9589
|
-
|
|
9590
|
-
|
|
9591
|
-
|
|
9801
|
+
_context7.prev = 7;
|
|
9802
|
+
_context7.t0 = _context7["catch"](1);
|
|
9803
|
+
return _context7.abrupt("return", (this.messageBack.call(null, {
|
|
9804
|
+
code: -1,
|
|
9805
|
+
type: "device",
|
|
9806
|
+
err: "失败_无法获取设备列表"
|
|
9807
|
+
}), t));
|
|
9592
9808
|
|
|
9593
9809
|
case 10:
|
|
9594
|
-
|
|
9595
|
-
|
|
9596
|
-
|
|
9597
|
-
if (t) {
|
|
9598
|
-
_context6.next = 15;
|
|
9810
|
+
if (e) {
|
|
9811
|
+
_context7.next = 12;
|
|
9599
9812
|
break;
|
|
9600
9813
|
}
|
|
9601
9814
|
|
|
9602
|
-
|
|
9603
|
-
code: -2,
|
|
9604
|
-
type: "error",
|
|
9605
|
-
err: "无法查找到父级容器,请查看"
|
|
9606
|
-
});
|
|
9607
|
-
return _context6.abrupt("return");
|
|
9815
|
+
return _context7.abrupt("return", t);
|
|
9608
9816
|
|
|
9609
|
-
case
|
|
9610
|
-
|
|
9611
|
-
|
|
9817
|
+
case 12:
|
|
9818
|
+
a = e.some(function (o) {
|
|
9819
|
+
return (o.kind === "videoinput" || o.kind === "videoinput") && o.deviceId;
|
|
9820
|
+
}), i = e.some(function (o) {
|
|
9821
|
+
return (o.kind === "audioinput" || o.kind === "audiooutput") && o.deviceId;
|
|
9822
|
+
});
|
|
9823
|
+
return _context7.abrupt("return", (a && (t = 1), i && (t = 2), a && i && (t = 3), t));
|
|
9824
|
+
|
|
9825
|
+
case 14:
|
|
9826
|
+
case "end":
|
|
9827
|
+
return _context7.stop();
|
|
9828
|
+
}
|
|
9829
|
+
}
|
|
9830
|
+
}, _callee7, this, [[1, 7]]);
|
|
9831
|
+
}));
|
|
9832
|
+
|
|
9833
|
+
function getDeviceType() {
|
|
9834
|
+
return _getDeviceType.apply(this, arguments);
|
|
9835
|
+
}
|
|
9836
|
+
|
|
9837
|
+
return getDeviceType;
|
|
9838
|
+
}()
|
|
9839
|
+
}, {
|
|
9840
|
+
key: "testGetDeviceMore",
|
|
9841
|
+
value: function () {
|
|
9842
|
+
var _testGetDeviceMore = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee8() {
|
|
9843
|
+
return regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
9844
|
+
while (1) {
|
|
9845
|
+
switch (_context8.prev = _context8.next) {
|
|
9846
|
+
case 0:
|
|
9847
|
+
this.cameraMicrophoneStream();
|
|
9848
|
+
|
|
9849
|
+
case 1:
|
|
9850
|
+
case "end":
|
|
9851
|
+
return _context8.stop();
|
|
9852
|
+
}
|
|
9853
|
+
}
|
|
9854
|
+
}, _callee8, this);
|
|
9855
|
+
}));
|
|
9856
|
+
|
|
9857
|
+
function testGetDeviceMore() {
|
|
9858
|
+
return _testGetDeviceMore.apply(this, arguments);
|
|
9859
|
+
}
|
|
9860
|
+
|
|
9861
|
+
return testGetDeviceMore;
|
|
9862
|
+
}()
|
|
9863
|
+
}, {
|
|
9864
|
+
key: "closeAudio",
|
|
9865
|
+
value: function () {
|
|
9866
|
+
var _closeAudio = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee9() {
|
|
9867
|
+
return regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
9868
|
+
while (1) {
|
|
9869
|
+
switch (_context9.prev = _context9.next) {
|
|
9870
|
+
case 0:
|
|
9871
|
+
this.audioStream.getTracks().forEach(function (t) {
|
|
9872
|
+
t.stop();
|
|
9873
|
+
}), this.audioStream = null;
|
|
9874
|
+
|
|
9875
|
+
case 1:
|
|
9876
|
+
case "end":
|
|
9877
|
+
return _context9.stop();
|
|
9878
|
+
}
|
|
9879
|
+
}
|
|
9880
|
+
}, _callee9, this);
|
|
9881
|
+
}));
|
|
9882
|
+
|
|
9883
|
+
function closeAudio() {
|
|
9884
|
+
return _closeAudio.apply(this, arguments);
|
|
9885
|
+
}
|
|
9886
|
+
|
|
9887
|
+
return closeAudio;
|
|
9888
|
+
}()
|
|
9889
|
+
}, {
|
|
9890
|
+
key: "getAudioOrVideoErr",
|
|
9891
|
+
value: function getAudioOrVideoErr(e, t) {
|
|
9892
|
+
var a = null,
|
|
9893
|
+
i = t == 1 ? "麦克风" : t == 2 ? "摄像头" : "";
|
|
9894
|
+
return a = [{
|
|
9895
|
+
err: "NotFoundError",
|
|
9896
|
+
msg: "无法获取到" + i
|
|
9897
|
+
}, {
|
|
9898
|
+
err: "NotReadableError",
|
|
9899
|
+
msg: "" + i + "无法被访问,请查看" + i + "是否被占用"
|
|
9900
|
+
}, {
|
|
9901
|
+
err: "OverconstrainedError",
|
|
9902
|
+
msg: "无法找到指定" + i
|
|
9903
|
+
}, {
|
|
9904
|
+
err: "TypeError",
|
|
9905
|
+
msg: "getUserMedia()中传入正确的参数错误"
|
|
9906
|
+
}, {
|
|
9907
|
+
err: "PermissionDeniedError",
|
|
9908
|
+
msg: "用户拒绝了访问" + i + "的权限"
|
|
9909
|
+
}, {
|
|
9910
|
+
err: "AbortError",
|
|
9911
|
+
msg: "用户禁止了媒体捕获,或者在获取媒体设备时发生了其他错误"
|
|
9912
|
+
}, {
|
|
9913
|
+
err: "Other",
|
|
9914
|
+
msg: "浏览器特定的错误,或硬件问题"
|
|
9915
|
+
}, {
|
|
9916
|
+
err: "SecurityError",
|
|
9917
|
+
msg: "在不安全的网页上尝试获取" + i
|
|
9918
|
+
}].find(function (s) {
|
|
9919
|
+
return e.toString().indexOf(s.err) > -1;
|
|
9920
|
+
}), console.warn("returnErr-->", a), a;
|
|
9921
|
+
}
|
|
9922
|
+
}, {
|
|
9923
|
+
key: "cameraMicrophoneStream",
|
|
9924
|
+
value: function () {
|
|
9925
|
+
var _cameraMicrophoneStream = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee10(e, t) {
|
|
9926
|
+
var a, i, o, s, r, c, n, u, l, g, h, d, m, _m, k, T;
|
|
9927
|
+
|
|
9928
|
+
return regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
9929
|
+
while (1) {
|
|
9930
|
+
switch (_context10.prev = _context10.next) {
|
|
9931
|
+
case 0:
|
|
9932
|
+
a = this, i = a.os(), o = 640, s = 480;
|
|
9933
|
+
i.isPc ? (o = 1280, s = 720) : i.isPhone && (o = 640, s = 480);
|
|
9934
|
+
r = "", c = "";
|
|
9935
|
+
t && (t.camerId && (r = t.camerId), t.voiceId && (c = t.voiceId), t.width && (o = t.width), t.height && (o = t.height));
|
|
9936
|
+
n = {
|
|
9937
|
+
video: {
|
|
9938
|
+
width: {
|
|
9939
|
+
min: 320,
|
|
9940
|
+
ideal: o,
|
|
9941
|
+
max: 1920
|
|
9942
|
+
},
|
|
9943
|
+
height: {
|
|
9944
|
+
min: 480,
|
|
9945
|
+
ideal: s,
|
|
9946
|
+
max: 1080
|
|
9947
|
+
},
|
|
9948
|
+
// aspectRatio: 16 / 9,
|
|
9949
|
+
frameRate: 25
|
|
9950
|
+
}
|
|
9951
|
+
}, u = {
|
|
9952
|
+
audio: {
|
|
9953
|
+
noiseSuppression: !0,
|
|
9954
|
+
echoCancellation: !0
|
|
9955
|
+
}
|
|
9956
|
+
};
|
|
9957
|
+
r && (n.video.deviceId = r), c && (u.audio.deviceId = c), a.camearStream && a.camearStream.getTracks().forEach(function (k) {
|
|
9958
|
+
k.stop();
|
|
9959
|
+
});
|
|
9960
|
+
d = {};
|
|
9961
|
+
|
|
9962
|
+
if (!(e == 1)) {
|
|
9963
|
+
_context10.next = 27;
|
|
9612
9964
|
break;
|
|
9613
9965
|
}
|
|
9614
9966
|
|
|
9615
|
-
|
|
9616
|
-
|
|
9967
|
+
_context10.prev = 8;
|
|
9968
|
+
m = {
|
|
9969
|
+
audio: {
|
|
9970
|
+
noiseSuppression: !0,
|
|
9971
|
+
echoCancellation: !0
|
|
9972
|
+
},
|
|
9973
|
+
video: !1
|
|
9974
|
+
};
|
|
9975
|
+
_context10.next = 12;
|
|
9976
|
+
return navigator.mediaDevices.getUserMedia(m);
|
|
9617
9977
|
|
|
9618
|
-
case
|
|
9619
|
-
|
|
9620
|
-
|
|
9978
|
+
case 12:
|
|
9979
|
+
h = _context10.sent;
|
|
9980
|
+
l = new MediaStream(Object(toConsumableArray["a" /* default */])(h.getTracks()));
|
|
9981
|
+
_context10.next = 16;
|
|
9982
|
+
return this.addTracks(l);
|
|
9983
|
+
|
|
9984
|
+
case 16:
|
|
9985
|
+
this.videoStream = l;
|
|
9986
|
+
l.label = "voice";
|
|
9987
|
+
console.log("stream--->", l.getAudioTracks(), l.getVideoTracks());
|
|
9988
|
+
return _context10.abrupt("return", l);
|
|
9989
|
+
|
|
9990
|
+
case 22:
|
|
9991
|
+
_context10.prev = 22;
|
|
9992
|
+
_context10.t0 = _context10["catch"](8);
|
|
9993
|
+
d = a.getAudioOrVideoErr(_context10.t0, 1), a.messageBack.call(null, {
|
|
9994
|
+
code: -1,
|
|
9995
|
+
type: "device",
|
|
9996
|
+
message: "麦克风获取异常_" + d.err,
|
|
9997
|
+
err: d.msg,
|
|
9998
|
+
data: {}
|
|
9999
|
+
});
|
|
10000
|
+
|
|
10001
|
+
case 25:
|
|
10002
|
+
_context10.next = 91;
|
|
10003
|
+
break;
|
|
10004
|
+
|
|
10005
|
+
case 27:
|
|
10006
|
+
_context10.prev = 27;
|
|
10007
|
+
_context10.next = 30;
|
|
10008
|
+
return navigator.mediaDevices.getUserMedia(n);
|
|
10009
|
+
|
|
10010
|
+
case 30:
|
|
10011
|
+
g = _context10.sent;
|
|
10012
|
+
_context10.prev = 31;
|
|
10013
|
+
_context10.next = 34;
|
|
10014
|
+
return navigator.mediaDevices.getUserMedia(u);
|
|
10015
|
+
|
|
10016
|
+
case 34:
|
|
10017
|
+
h = _context10.sent;
|
|
10018
|
+
l = new MediaStream([].concat(Object(toConsumableArray["a" /* default */])(h.getTracks()), Object(toConsumableArray["a" /* default */])(g.getTracks())));
|
|
10019
|
+
_m = l.getVideoTracks();
|
|
10020
|
+
_m[0].contentHint = "detail";
|
|
10021
|
+
_context10.next = 40;
|
|
10022
|
+
return this.addTracks(l);
|
|
10023
|
+
|
|
10024
|
+
case 40:
|
|
10025
|
+
this.videoStream = l;
|
|
10026
|
+
l.label = "camer";
|
|
10027
|
+
console.log("stream--->", l);
|
|
10028
|
+
this.bindLocalPicture(l);
|
|
10029
|
+
return _context10.abrupt("return", l);
|
|
10030
|
+
|
|
10031
|
+
case 47:
|
|
10032
|
+
_context10.prev = 47;
|
|
10033
|
+
_context10.t1 = _context10["catch"](31);
|
|
10034
|
+
console.log("获取麦克风失败--->", _context10.t1), d = a.getAudioOrVideoErr(_context10.t1, 1), a.messageBack.call(null, {
|
|
10035
|
+
code: -1,
|
|
10036
|
+
type: "device",
|
|
10037
|
+
message: "麦克风获取异常_" + d.err,
|
|
10038
|
+
err: d.msg,
|
|
10039
|
+
data: {}
|
|
10040
|
+
});
|
|
10041
|
+
|
|
10042
|
+
case 50:
|
|
10043
|
+
_context10.next = 91;
|
|
10044
|
+
break;
|
|
10045
|
+
|
|
10046
|
+
case 52:
|
|
10047
|
+
_context10.prev = 52;
|
|
10048
|
+
_context10.t2 = _context10["catch"](27);
|
|
10049
|
+
_context10.t2 && e == 2 && (console.log("errr-->"), d = a.getAudioOrVideoErr(_context10.t2, 2), a.messageBack.call(null, {
|
|
10050
|
+
code: -6,
|
|
10051
|
+
type: "device",
|
|
10052
|
+
message: "摄像头获取异常_" + d.err + ",仅拉起麦克风",
|
|
10053
|
+
err: d.msg,
|
|
10054
|
+
data: {}
|
|
10055
|
+
}));
|
|
10056
|
+
_context10.next = 57;
|
|
10057
|
+
return this.createdVirtualVideo(e);
|
|
10058
|
+
|
|
10059
|
+
case 57:
|
|
10060
|
+
g = _context10.sent;
|
|
10061
|
+
_context10.prev = 58;
|
|
10062
|
+
k = {
|
|
10063
|
+
audio: {
|
|
10064
|
+
noiseSuppression: !0,
|
|
10065
|
+
echoCancellation: !0
|
|
10066
|
+
}
|
|
10067
|
+
};
|
|
10068
|
+
_context10.next = 62;
|
|
10069
|
+
return navigator.mediaDevices.getUserMedia(k);
|
|
10070
|
+
|
|
10071
|
+
case 62:
|
|
10072
|
+
h = _context10.sent;
|
|
10073
|
+
l = new MediaStream([].concat(Object(toConsumableArray["a" /* default */])(h.getTracks()), Object(toConsumableArray["a" /* default */])(g.getTracks())));
|
|
10074
|
+
console.log("stream-->", l);
|
|
10075
|
+
T = l.getVideoTracks();
|
|
10076
|
+
T[0].contentHint = "detail";
|
|
10077
|
+
_context10.next = 69;
|
|
10078
|
+
return this.addTracks(l);
|
|
10079
|
+
|
|
10080
|
+
case 69:
|
|
10081
|
+
this.videoStream = l;
|
|
10082
|
+
l.label = "virtual";
|
|
10083
|
+
this.bindLocalPicture(l);
|
|
10084
|
+
return _context10.abrupt("return", l);
|
|
10085
|
+
|
|
10086
|
+
case 75:
|
|
10087
|
+
_context10.prev = 75;
|
|
10088
|
+
_context10.t3 = _context10["catch"](58);
|
|
10089
|
+
_context10.next = 79;
|
|
10090
|
+
return this.createdVirtualVideo(e);
|
|
10091
|
+
|
|
10092
|
+
case 79:
|
|
10093
|
+
g = _context10.sent;
|
|
10094
|
+
_context10.next = 82;
|
|
10095
|
+
return this.createSilentAudioStream();
|
|
10096
|
+
|
|
10097
|
+
case 82:
|
|
10098
|
+
h = _context10.sent;
|
|
10099
|
+
console.log("audioStream-->", h.getTracks());
|
|
10100
|
+
l = new MediaStream([].concat(Object(toConsumableArray["a" /* default */])(h.getTracks()), Object(toConsumableArray["a" /* default */])(g.getTracks())));
|
|
10101
|
+
_context10.next = 87;
|
|
10102
|
+
return this.addTracks(l);
|
|
10103
|
+
|
|
10104
|
+
case 87:
|
|
10105
|
+
this.videoStream = l;
|
|
10106
|
+
d = a.getAudioOrVideoErr(_context10.t3, 1);
|
|
10107
|
+
a.messageBack.call(null, {
|
|
10108
|
+
code: -1,
|
|
10109
|
+
type: "device",
|
|
10110
|
+
message: "麦克风获取异常_" + d.err,
|
|
10111
|
+
err: d.msg,
|
|
10112
|
+
data: {}
|
|
10113
|
+
});
|
|
10114
|
+
return _context10.abrupt("return", l);
|
|
9621
10115
|
|
|
9622
|
-
case
|
|
10116
|
+
case 91:
|
|
9623
10117
|
case "end":
|
|
9624
|
-
return
|
|
10118
|
+
return _context10.stop();
|
|
10119
|
+
}
|
|
10120
|
+
}
|
|
10121
|
+
}, _callee10, this, [[8, 22], [27, 52], [31, 47], [58, 75]]);
|
|
10122
|
+
}));
|
|
10123
|
+
|
|
10124
|
+
function cameraMicrophoneStream(_x7, _x8) {
|
|
10125
|
+
return _cameraMicrophoneStream.apply(this, arguments);
|
|
10126
|
+
}
|
|
10127
|
+
|
|
10128
|
+
return cameraMicrophoneStream;
|
|
10129
|
+
}()
|
|
10130
|
+
}, {
|
|
10131
|
+
key: "cameraMicrophoneStream_old",
|
|
10132
|
+
value: function () {
|
|
10133
|
+
var _cameraMicrophoneStream_old = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee11() {
|
|
10134
|
+
var e, t, a, s, r, c, i;
|
|
10135
|
+
return regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
10136
|
+
while (1) {
|
|
10137
|
+
switch (_context11.prev = _context11.next) {
|
|
10138
|
+
case 0:
|
|
10139
|
+
e = this, t = {
|
|
10140
|
+
audio: {
|
|
10141
|
+
noiseSuppression: !0,
|
|
10142
|
+
echoCancellation: !0
|
|
10143
|
+
},
|
|
10144
|
+
video: {
|
|
10145
|
+
deviceId: {
|
|
10146
|
+
exclude: ["video"]
|
|
10147
|
+
},
|
|
10148
|
+
width: {
|
|
10149
|
+
min: 1280,
|
|
10150
|
+
ideal: 1280,
|
|
10151
|
+
max: 1280
|
|
10152
|
+
},
|
|
10153
|
+
height: {
|
|
10154
|
+
min: 720,
|
|
10155
|
+
ideal: 720,
|
|
10156
|
+
max: 720
|
|
10157
|
+
},
|
|
10158
|
+
aspectRatio: 16 / 9,
|
|
10159
|
+
frameRate: 30
|
|
10160
|
+
}
|
|
10161
|
+
};
|
|
10162
|
+
_context11.prev = 1;
|
|
10163
|
+
_context11.next = 4;
|
|
10164
|
+
return navigator.mediaDevices.getUserMedia(t);
|
|
10165
|
+
|
|
10166
|
+
case 4:
|
|
10167
|
+
a = _context11.sent;
|
|
10168
|
+
_context11.next = 24;
|
|
10169
|
+
break;
|
|
10170
|
+
|
|
10171
|
+
case 7:
|
|
10172
|
+
_context11.prev = 7;
|
|
10173
|
+
_context11.t0 = _context11["catch"](1);
|
|
10174
|
+
|
|
10175
|
+
if (!(console.warn("无摄像头或麦克风,自动切换到麦克风--》", _context11.t0), e.messageBack.call(null, {
|
|
10176
|
+
code: -6,
|
|
10177
|
+
type: "device",
|
|
10178
|
+
message: "失败_设备获取异常,自动切换到语音呼叫",
|
|
10179
|
+
err: _context11.t0,
|
|
10180
|
+
data: {}
|
|
10181
|
+
}), _context11.t0)) {
|
|
10182
|
+
_context11.next = 24;
|
|
10183
|
+
break;
|
|
10184
|
+
}
|
|
10185
|
+
|
|
10186
|
+
_context11.prev = 10;
|
|
10187
|
+
s = {
|
|
10188
|
+
audio: {
|
|
10189
|
+
noiseSuppression: !0,
|
|
10190
|
+
echoCancellation: !0
|
|
10191
|
+
}
|
|
10192
|
+
};
|
|
10193
|
+
_context11.next = 14;
|
|
10194
|
+
return navigator.mediaDevices.getUserMedia(s);
|
|
10195
|
+
|
|
10196
|
+
case 14:
|
|
10197
|
+
r = _context11.sent;
|
|
10198
|
+
_context11.next = 17;
|
|
10199
|
+
return this.createdVirtualVideo();
|
|
10200
|
+
|
|
10201
|
+
case 17:
|
|
10202
|
+
c = _context11.sent;
|
|
10203
|
+
a = new MediaStream([].concat(Object(toConsumableArray["a" /* default */])(r.getTracks()), Object(toConsumableArray["a" /* default */])(c.getTracks())));
|
|
10204
|
+
_context11.next = 24;
|
|
10205
|
+
break;
|
|
10206
|
+
|
|
10207
|
+
case 21:
|
|
10208
|
+
_context11.prev = 21;
|
|
10209
|
+
_context11.t1 = _context11["catch"](10);
|
|
10210
|
+
console.error("无麦克风--》", _context11.t1), e.messageBack.call(null, {
|
|
10211
|
+
code: -1,
|
|
10212
|
+
type: "device",
|
|
10213
|
+
message: "无法获取麦克风,不能正常使用通信功能",
|
|
10214
|
+
err: _context11.t0,
|
|
10215
|
+
data: {}
|
|
10216
|
+
});
|
|
10217
|
+
|
|
10218
|
+
case 24:
|
|
10219
|
+
if (a) {
|
|
10220
|
+
_context11.next = 27;
|
|
10221
|
+
break;
|
|
10222
|
+
}
|
|
10223
|
+
|
|
10224
|
+
e.messageBack.call(null, {
|
|
10225
|
+
code: -1,
|
|
10226
|
+
type: "device",
|
|
10227
|
+
message: "无法获取麦克风,不能正常使用通信功能",
|
|
10228
|
+
err: err,
|
|
10229
|
+
data: {}
|
|
10230
|
+
});
|
|
10231
|
+
return _context11.abrupt("return");
|
|
10232
|
+
|
|
10233
|
+
case 27:
|
|
10234
|
+
i = a.getVideoTracks();
|
|
10235
|
+
i[0].contentHint = "detail";
|
|
10236
|
+
console.log("videoTrack-->", a);
|
|
10237
|
+
this.videoStream = a;
|
|
10238
|
+
_context11.next = 33;
|
|
10239
|
+
return this.addTracks(a);
|
|
10240
|
+
|
|
10241
|
+
case 33:
|
|
10242
|
+
return _context11.abrupt("return", a);
|
|
10243
|
+
|
|
10244
|
+
case 34:
|
|
10245
|
+
case "end":
|
|
10246
|
+
return _context11.stop();
|
|
10247
|
+
}
|
|
10248
|
+
}
|
|
10249
|
+
}, _callee11, this, [[1, 7], [10, 21]]);
|
|
10250
|
+
}));
|
|
10251
|
+
|
|
10252
|
+
function cameraMicrophoneStream_old() {
|
|
10253
|
+
return _cameraMicrophoneStream_old.apply(this, arguments);
|
|
10254
|
+
}
|
|
10255
|
+
|
|
10256
|
+
return cameraMicrophoneStream_old;
|
|
10257
|
+
}()
|
|
10258
|
+
}, {
|
|
10259
|
+
key: "createdVirtualVideo_bck",
|
|
10260
|
+
value: function () {
|
|
10261
|
+
var _createdVirtualVideo_bck = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee13() {
|
|
10262
|
+
var e, t, a, i, o, s;
|
|
10263
|
+
return regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
10264
|
+
while (1) {
|
|
10265
|
+
switch (_context13.prev = _context13.next) {
|
|
10266
|
+
case 0:
|
|
10267
|
+
e = this, t = "无 摄 像 头", a = document.createElement("canvas"), i = a.getContext("2d"), o = new Image();
|
|
10268
|
+
o.width = 120, o.height = 120, o.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAABZtJREFUeF7tmluoVkUUx/9/6KHoIYgsKoIeCjGJLkSGKaSBRBgUZVJRZNBDaVQPSmj3i1EGFaSEL/kQPmgERRLlg1oo2QVLLOxClJkg9BCUQVT82+s0u+bs9uy9Z/b+ztkf37dAj3hmZq3122vWzKwZYsSFI+4/xgDGETDiBMZTICUAJC0BcBrJl1L696lPVARIugLA3QAMwEEAV5I80ieHYm1pDEDSeZnjnxcUPEPygVilfWrfGIAZLekhAI97DhwDsIDkR31yKsaWWADHAfgYwAWeks0kb4lR2qe2UQBcFNj831Jw4lqSb/TJsaa2RANwEDYDuMlTsoukJcihk1oAkm4HcA2AkwEcJnmrpIsA7AFwvOfxCpLrJV0PYMWASXwH4HuSj7bVUwlA0gcA5hSULCK5XdJTAFZ7v/sWwFySRyW9B2B+W+Ma9N9JckGDdsEmQQCS3nRfvtj5IMlZkiwiLApmeg3WkVwVWDLb2FnV9w6Sr6QOXgpA0ukAqjY499guUNKdADZ6yv8CcDnJvZJeAHBvqmER/faT9FeliK4oPw67Hd8Ob6Sd2Xq/yx85n3+S3skiYZH3uy0kl0qy/JC6SRL+s83/90QOzv6aNPeZGRPltdc4FAGW0ScBCM01Sea8QfBlKcniUplq46R+JR8H0wpg4pNINg1sOuSy100FmxKdSgwA13YGya0hI1pHgANgidASoiXGXFaRXNep9//ALkbn/yJA0tlZ00cA2BJuspXkjWW2tAZgU4Dku5JsSbSlMZejblm05bEzqQPg9i3mvEHw5RKSnxQNaQVA0hoAN7g1/08XBbZJymU9yU43RSEAJV+96Ksd2iyZT5JkAJKeB3CfG20NybWS7FD0akHHQpJ+Qm0VDWUAsl3hMhfyxa/u6+ocwD4AFzoNPwK4jORhSa8DuM7TvI3k4lZee50DAJoM3zmAA1lyme1pfo7kSknzskrR+wWLlpHc1MTKujYRACzc/QNa5wDmAtjtGfwHgItJHihMD2tisOyc8Eudg3W/bwDgUzcd7h8oADNUks29mwFc6naKG0m+JeksB8d+5vJYF6e3GgC27JqeY5Is7wwuAhp8KUuQlihzsa9vUWDRkCwBAF8CsPPJ9nzgaQfgIsRygeWEXDaRtKhJlrp9QN8A2Gpgq4Ivi0luSyUwVABcFNi+wC+a7iC5cJQABMtnKRCGLgJcFATLZ7EQhhVAsHw2EgBcFATLZzEQhjICvKWptHw2SgBal88CG6E5JD/0QfZiI1T2ZduWzyq2wg+S/Lcg02cArcpnNWcBq1yvJrmntwBcQkwunzU4DZqKhwHYZmv6DkNVic3dGVgRNbp81hCAqR9sPSAmcwdyQVL5LADAYFp9okq6LYi0BeCmQnT5rKIo+iyAlRV29RJAdPmsaiMkyU6fBuKcEhD9A+CiwK8u239Vls/qdoKSzgSwFsBtBQgzSX5VBJNcFu9iCjgAUeWzOgDernM5gLsAnJr92RAqx4UAnA9gf1dOVoyzhORrkoLlM0lvA7iqYoyfspcpM1JtDQE4Kbv0+Dl10Ih+9sxl4jJDUmn5rMFbhd0k/bJbhPrA+wBnkN3B2x3boGWiWuwSWGn5TJLZEXoPNDu7+Pwi1ci6N0JlT+JSdVX1OzF7WvObpGD5LHuNYrdPZ3iD/GCJruy+L8bA2pcV7i3QuQBOiBk4tq05Enh9tpzkBpf88mENxiGSv8fqabQKtB20TX9JTwKwW+dcvraLF5IDyUm1EdDGmZS+kk7JDjL2zG6W1/8JknbA6Vx6B8Al4GL57Fc7OJH8pmsCvQTgINjlydWewy9njzBtY9Op9BmAOW8Q7Os/DeBFu/Ts1HvvLV7X43Yyniuf2TObzzoZsGSQ3kbAoBzu/TI4VY7nesYRMNXE+6ZvHAF9+yJTbc/fXxAjbt8pZd0AAAAASUVORK5CYII=";
|
|
10269
|
+
|
|
10270
|
+
s = /*#__PURE__*/function () {
|
|
10271
|
+
var _ref2 = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee12() {
|
|
10272
|
+
return regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
10273
|
+
while (1) {
|
|
10274
|
+
switch (_context12.prev = _context12.next) {
|
|
10275
|
+
case 0:
|
|
10276
|
+
a.width = 640, a.height = 480, i.fillStyle = "#000", i.fillRect(0, 0, a.width, a.height), i.fillStyle = "#fff", i.font = "50px Helvetica Neue", i.textAlign = "center", i.fillText(t, a.width / 2, (a.height - o.height) / 2), i.drawImage(o, (a.width - o.width) / 2, (a.height - o.height + 80) / 2, o.width, o.height), e.requestAnimationFrameTimer = requestAnimationFrame(s);
|
|
10277
|
+
|
|
10278
|
+
case 1:
|
|
10279
|
+
case "end":
|
|
10280
|
+
return _context12.stop();
|
|
10281
|
+
}
|
|
10282
|
+
}
|
|
10283
|
+
}, _callee12);
|
|
10284
|
+
}));
|
|
10285
|
+
|
|
10286
|
+
return function s() {
|
|
10287
|
+
return _ref2.apply(this, arguments);
|
|
10288
|
+
};
|
|
10289
|
+
}();
|
|
10290
|
+
|
|
10291
|
+
return _context13.abrupt("return", (e.requestAnimationFrameTimer && cancelAnimationFrame(e.requestAnimationFrameTimer), s(), a.captureStream()));
|
|
10292
|
+
|
|
10293
|
+
case 4:
|
|
10294
|
+
case "end":
|
|
10295
|
+
return _context13.stop();
|
|
10296
|
+
}
|
|
10297
|
+
}
|
|
10298
|
+
}, _callee13, this);
|
|
10299
|
+
}));
|
|
10300
|
+
|
|
10301
|
+
function createdVirtualVideo_bck() {
|
|
10302
|
+
return _createdVirtualVideo_bck.apply(this, arguments);
|
|
10303
|
+
}
|
|
10304
|
+
|
|
10305
|
+
return createdVirtualVideo_bck;
|
|
10306
|
+
}()
|
|
10307
|
+
}, {
|
|
10308
|
+
key: "createdVirtualVideo",
|
|
10309
|
+
value: function createdVirtualVideo(e) {
|
|
10310
|
+
var t = document.createElement("canvas"),
|
|
10311
|
+
a = t.getContext("2d");
|
|
10312
|
+
var i = this,
|
|
10313
|
+
o = e && e == 2 ? "无 摄 像 头" : "";
|
|
10314
|
+
|
|
10315
|
+
var s = /*#__PURE__*/function () {
|
|
10316
|
+
var _ref3 = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee14() {
|
|
10317
|
+
return regeneratorRuntime.wrap(function _callee14$(_context14) {
|
|
10318
|
+
while (1) {
|
|
10319
|
+
switch (_context14.prev = _context14.next) {
|
|
10320
|
+
case 0:
|
|
10321
|
+
t.width = 640, t.height = 480, a.fillStyle = "black", a.fillRect(0, 0, t.width, t.height), a.fillStyle = "#fff", a.font = "50px Helvetica Neue", a.textAlign = "center", a.fillText(o, t.width / 2, t.height / 2), i.requestAnimationFrameTimer = requestAnimationFrame(s);
|
|
10322
|
+
|
|
10323
|
+
case 1:
|
|
10324
|
+
case "end":
|
|
10325
|
+
return _context14.stop();
|
|
10326
|
+
}
|
|
10327
|
+
}
|
|
10328
|
+
}, _callee14);
|
|
10329
|
+
}));
|
|
10330
|
+
|
|
10331
|
+
return function s() {
|
|
10332
|
+
return _ref3.apply(this, arguments);
|
|
10333
|
+
};
|
|
10334
|
+
}();
|
|
10335
|
+
|
|
10336
|
+
s();
|
|
10337
|
+
var r = t.captureStream(30);
|
|
10338
|
+
return console.log("videoStream-->", r), r;
|
|
10339
|
+
}
|
|
10340
|
+
/**
|
|
10341
|
+
* 生成一个指定时长的静音 MediaStream (包含 Audio Track)
|
|
10342
|
+
* @param {number} durationSeconds - 静音时长(秒)。如果设为 Infinity 或省略,则生成无限持续的流。
|
|
10343
|
+
* @returns {MediaStream} 包含静音轨道的 MediaStream 对象
|
|
10344
|
+
*/
|
|
10345
|
+
|
|
10346
|
+
}, {
|
|
10347
|
+
key: "createSilentAudioStream",
|
|
10348
|
+
value: function createSilentAudioStream() {
|
|
10349
|
+
var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1 / 0;
|
|
10350
|
+
var t = new (window.AudioContext || window.webkitAudioContext)(),
|
|
10351
|
+
a = t.createMediaStreamDestination();
|
|
10352
|
+
var i;
|
|
10353
|
+
|
|
10354
|
+
if (e === 1 / 0 || e <= 0) {
|
|
10355
|
+
var o = t.sampleRate,
|
|
10356
|
+
s = o * 1,
|
|
10357
|
+
r = t.createBuffer(1, s, o);
|
|
10358
|
+
r.getChannelData(0).fill(0), i = t.createBufferSource(), i.buffer = r, i.loop = !0;
|
|
10359
|
+
} else {
|
|
10360
|
+
var _o = t.sampleRate,
|
|
10361
|
+
_s = _o * e,
|
|
10362
|
+
_r2 = t.createBuffer(1, _s, _o);
|
|
10363
|
+
|
|
10364
|
+
_r2.getChannelData(0).fill(0), i = t.createBufferSource(), i.buffer = _r2, i.loop = !1;
|
|
10365
|
+
}
|
|
10366
|
+
|
|
10367
|
+
return i.connect(a), i.start(0), e !== 1 / 0 && e > 0 && (i.onended = function () {
|
|
10368
|
+
console.log("静音流播放完毕"), t.close();
|
|
10369
|
+
}), a.stream;
|
|
10370
|
+
}
|
|
10371
|
+
}, {
|
|
10372
|
+
key: "getVideoTacks",
|
|
10373
|
+
value: function () {
|
|
10374
|
+
var _getVideoTacks = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee15() {
|
|
10375
|
+
var t;
|
|
10376
|
+
return regeneratorRuntime.wrap(function _callee15$(_context15) {
|
|
10377
|
+
while (1) {
|
|
10378
|
+
switch (_context15.prev = _context15.next) {
|
|
10379
|
+
case 0:
|
|
10380
|
+
if (this.videoStream) {
|
|
10381
|
+
this.videoStream.getTracks().forEach(function (a) {
|
|
10382
|
+
a.stop();
|
|
10383
|
+
});
|
|
10384
|
+
t = document.getElementById(this.localId);
|
|
10385
|
+
t.srcObject = null;
|
|
10386
|
+
}
|
|
10387
|
+
|
|
10388
|
+
case 1:
|
|
10389
|
+
case "end":
|
|
10390
|
+
return _context15.stop();
|
|
10391
|
+
}
|
|
10392
|
+
}
|
|
10393
|
+
}, _callee15, this);
|
|
10394
|
+
}));
|
|
10395
|
+
|
|
10396
|
+
function getVideoTacks() {
|
|
10397
|
+
return _getVideoTacks.apply(this, arguments);
|
|
10398
|
+
}
|
|
10399
|
+
|
|
10400
|
+
return getVideoTacks;
|
|
10401
|
+
}()
|
|
10402
|
+
/**
|
|
10403
|
+
* 初始化 dome 配置和方法
|
|
10404
|
+
* video 开启视频
|
|
10405
|
+
* audio 开启音频
|
|
10406
|
+
* callback 贯穿整个线的消息回调
|
|
10407
|
+
* @param {*} data
|
|
10408
|
+
*/
|
|
10409
|
+
|
|
10410
|
+
}, {
|
|
10411
|
+
key: "initDom",
|
|
10412
|
+
value: function () {
|
|
10413
|
+
var _initDom = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee16() {
|
|
10414
|
+
var e,
|
|
10415
|
+
t,
|
|
10416
|
+
a,
|
|
10417
|
+
i,
|
|
10418
|
+
o,
|
|
10419
|
+
s,
|
|
10420
|
+
r,
|
|
10421
|
+
_args16 = arguments;
|
|
10422
|
+
return regeneratorRuntime.wrap(function _callee16$(_context16) {
|
|
10423
|
+
while (1) {
|
|
10424
|
+
switch (_context16.prev = _context16.next) {
|
|
10425
|
+
case 0:
|
|
10426
|
+
e = _args16.length > 0 && _args16[0] !== undefined ? _args16[0] : {
|
|
10427
|
+
video: !0,
|
|
10428
|
+
audio: !0,
|
|
10429
|
+
parentId: "",
|
|
10430
|
+
isDrag: !0,
|
|
10431
|
+
showLocal: !0,
|
|
10432
|
+
callback: new Function()
|
|
10433
|
+
};
|
|
10434
|
+
|
|
10435
|
+
if (e.parentId) {
|
|
10436
|
+
_context16.next = 4;
|
|
10437
|
+
break;
|
|
10438
|
+
}
|
|
10439
|
+
|
|
10440
|
+
console.log("请添加视频容器");
|
|
10441
|
+
return _context16.abrupt("return");
|
|
10442
|
+
|
|
10443
|
+
case 4:
|
|
10444
|
+
if (e.callback) {
|
|
10445
|
+
_context16.next = 7;
|
|
10446
|
+
break;
|
|
10447
|
+
}
|
|
10448
|
+
|
|
10449
|
+
console.log("请注册消息回调函数");
|
|
10450
|
+
return _context16.abrupt("return");
|
|
10451
|
+
|
|
10452
|
+
case 7:
|
|
10453
|
+
if (this.online()) {
|
|
10454
|
+
_context16.next = 10;
|
|
10455
|
+
break;
|
|
10456
|
+
}
|
|
10457
|
+
|
|
10458
|
+
e.callback({
|
|
10459
|
+
code: -2,
|
|
10460
|
+
type: "internet",
|
|
10461
|
+
err: "当前网络差,请检查网络后重试"
|
|
10462
|
+
}), this.messageBack = e.callback;
|
|
10463
|
+
return _context16.abrupt("return");
|
|
10464
|
+
|
|
10465
|
+
case 10:
|
|
10466
|
+
this.mediaSet.video = e.video, this.mediaSet.audio = e.audio, this.messageBack = e.callback, this.newSocket();
|
|
10467
|
+
t = document.querySelector("#" + e.parentId);
|
|
10468
|
+
|
|
10469
|
+
if (t) {
|
|
10470
|
+
_context16.next = 15;
|
|
10471
|
+
break;
|
|
10472
|
+
}
|
|
10473
|
+
|
|
10474
|
+
console.log("无法查找到父级容器"), e.callback({
|
|
10475
|
+
code: -2,
|
|
10476
|
+
type: "error",
|
|
10477
|
+
err: "无法查找到父级容器,请查看"
|
|
10478
|
+
});
|
|
10479
|
+
return _context16.abrupt("return");
|
|
10480
|
+
|
|
10481
|
+
case 15:
|
|
10482
|
+
a = document.createElement("video"), i = document.createElement("video"), o = document.createElement("audio");
|
|
10483
|
+
a.id = "local_video", a.autoplay = !0, a.playsInline = "playsInline", a.muted = !0, i.id = "remote_video", o.id = "remote_audio", i.autoplay = !0, i.playsInline = "playsInline", i.muted = !0, a.className = "local_video_class", i.className = "remote_video_class", o.style.display = "none", o.controls = !0;
|
|
10484
|
+
s = document.querySelector("#" + e.parentId), r = document.querySelector("#remote_video");
|
|
10485
|
+
s.contains(r) ? (console.log("已成功创建video标签"), this.localId = "local_video", this.remoteId = "remote_video", this.remoteAudioId = "remote_audio", e.isDrag && this.pcDrag("remote_video", "local_video")) : (console.log("没有标签,进行创建"), t.appendChild(i), t.appendChild(a), t.appendChild(o), e.showLocal || (a.style.display = "none"), this.localId = "local_video", this.remoteId = "remote_video", this.remoteAudioId = "remote_audio", e.isDrag && this.pcDrag("remote_video", "local_video"));
|
|
10486
|
+
|
|
10487
|
+
case 19:
|
|
10488
|
+
case "end":
|
|
10489
|
+
return _context16.stop();
|
|
9625
10490
|
}
|
|
9626
10491
|
}
|
|
9627
|
-
},
|
|
10492
|
+
}, _callee16, this);
|
|
9628
10493
|
}));
|
|
9629
10494
|
|
|
9630
10495
|
function initDom() {
|
|
@@ -9636,7 +10501,7 @@ var phoneClient_j = /*#__PURE__*/function () {
|
|
|
9636
10501
|
}, {
|
|
9637
10502
|
key: "changeShowLocal",
|
|
9638
10503
|
value: function changeShowLocal(e) {
|
|
9639
|
-
var t = document.
|
|
10504
|
+
var t = document.getElementById(this.localId);
|
|
9640
10505
|
t.style.display = e ? "block" : "none";
|
|
9641
10506
|
}
|
|
9642
10507
|
}, {
|
|
@@ -9644,15 +10509,15 @@ var phoneClient_j = /*#__PURE__*/function () {
|
|
|
9644
10509
|
value: function os() {
|
|
9645
10510
|
var e = navigator.userAgent,
|
|
9646
10511
|
t = /(?:Windows Phone)/.test(e),
|
|
9647
|
-
|
|
10512
|
+
a = /(?:SymbianOS)/.test(e) || t,
|
|
9648
10513
|
i = /(?:Android)/.test(e),
|
|
9649
|
-
|
|
9650
|
-
|
|
9651
|
-
|
|
9652
|
-
c = !
|
|
10514
|
+
o = /(?:Firefox)/.test(e),
|
|
10515
|
+
s = /(?:iPad|PlayBook)/.test(e) || i && !/(?:Mobile)/.test(e) || o && /(?:Tablet)/.test(e),
|
|
10516
|
+
r = /(?:iPhone)/.test(e) && !s,
|
|
10517
|
+
c = !r && !i && !a;
|
|
9653
10518
|
return {
|
|
9654
|
-
isTablet:
|
|
9655
|
-
isPhone:
|
|
10519
|
+
isTablet: s,
|
|
10520
|
+
isPhone: r,
|
|
9656
10521
|
isAndroid: i,
|
|
9657
10522
|
isPc: c
|
|
9658
10523
|
};
|
|
@@ -9660,43 +10525,53 @@ var phoneClient_j = /*#__PURE__*/function () {
|
|
|
9660
10525
|
}, {
|
|
9661
10526
|
key: "pcDrag",
|
|
9662
10527
|
value: function pcDrag(e, t) {
|
|
9663
|
-
|
|
9664
|
-
|
|
9665
|
-
|
|
9666
|
-
|
|
9667
|
-
|
|
9668
|
-
|
|
9669
|
-
|
|
9670
|
-
|
|
9671
|
-
|
|
9672
|
-
|
|
9673
|
-
|
|
9674
|
-
|
|
9675
|
-
|
|
9676
|
-
|
|
9677
|
-
|
|
9678
|
-
|
|
9679
|
-
|
|
9680
|
-
|
|
10528
|
+
document.getElementById(e);
|
|
10529
|
+
var a = document.getElementById(t),
|
|
10530
|
+
i = this.os().isPc,
|
|
10531
|
+
o = this.os().isPhone;
|
|
10532
|
+
i ? a.addEventListener("mousedown", function (s) {
|
|
10533
|
+
var r = document.getElementById(e),
|
|
10534
|
+
c = document.getElementById(t),
|
|
10535
|
+
n = r.offsetWidth,
|
|
10536
|
+
u = r.offsetHeight,
|
|
10537
|
+
l = c.offsetWidth,
|
|
10538
|
+
g = c.offsetHeight,
|
|
10539
|
+
h = r.offsetLeft,
|
|
10540
|
+
d = r.offsetTop,
|
|
10541
|
+
m = s.pageX - h - c.offsetLeft,
|
|
10542
|
+
k = s.pageY - d - c.offsetTop;
|
|
10543
|
+
|
|
10544
|
+
function T(v) {
|
|
10545
|
+
var p = v.pageX - h - m,
|
|
10546
|
+
f = v.pageY - d - k;
|
|
10547
|
+
p < 20 && (p = 20), p > n - l && (p = n - l), f < 20 && (f = 20), f > u - g && (f = u - g), c.style.left = p + "px", c.style.top = f + "px";
|
|
9681
10548
|
}
|
|
9682
10549
|
|
|
9683
|
-
document.addEventListener("mousemove",
|
|
9684
|
-
document.removeEventListener("mousemove",
|
|
10550
|
+
document.addEventListener("mousemove", T), document.addEventListener("mouseup", function (v) {
|
|
10551
|
+
document.removeEventListener("mousemove", T);
|
|
9685
10552
|
});
|
|
9686
|
-
}) :
|
|
9687
|
-
var
|
|
9688
|
-
|
|
9689
|
-
|
|
9690
|
-
|
|
9691
|
-
|
|
9692
|
-
|
|
9693
|
-
|
|
9694
|
-
|
|
9695
|
-
|
|
10553
|
+
}) : o && a.addEventListener("touchstart", function (s) {
|
|
10554
|
+
var r = document.getElementById(e),
|
|
10555
|
+
c = document.getElementById(t),
|
|
10556
|
+
n = r.offsetWidth,
|
|
10557
|
+
u = r.offsetHeight,
|
|
10558
|
+
l = c.offsetWidth,
|
|
10559
|
+
g = c.offsetHeight,
|
|
10560
|
+
h = r.offsetLeft,
|
|
10561
|
+
d = r.offsetTop,
|
|
10562
|
+
m = document.body;
|
|
10563
|
+
m.style.overflow = "hidden";
|
|
10564
|
+
var k = s.pageX - h - c.offsetLeft,
|
|
10565
|
+
T = s.pageY - d - c.offsetTop;
|
|
10566
|
+
|
|
10567
|
+
function v(p) {
|
|
10568
|
+
var f = p.pageX - h - k,
|
|
10569
|
+
w = p.pageY - d - T;
|
|
10570
|
+
f < 20 && (f = 20), f > n - l && (f = n - l), w < 20 && (w = 20), w > u - g && (w = u - g), c.style.left = f + "px", c.style.top = w + "px";
|
|
9696
10571
|
}
|
|
9697
10572
|
|
|
9698
|
-
document.addEventListener("touchmove",
|
|
9699
|
-
|
|
10573
|
+
document.addEventListener("touchmove", v), document.addEventListener("touchend", function (p) {
|
|
10574
|
+
m.style.overflow = "auto", document.removeEventListener("touchmove", v);
|
|
9700
10575
|
});
|
|
9701
10576
|
});
|
|
9702
10577
|
}
|
|
@@ -9711,40 +10586,86 @@ var phoneClient_j = /*#__PURE__*/function () {
|
|
|
9711
10586
|
}, {
|
|
9712
10587
|
key: "call",
|
|
9713
10588
|
value: function () {
|
|
9714
|
-
var _call = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9715
|
-
var
|
|
9716
|
-
return regeneratorRuntime.wrap(function
|
|
10589
|
+
var _call = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee18(e, t) {
|
|
10590
|
+
var a, i, o;
|
|
10591
|
+
return regeneratorRuntime.wrap(function _callee18$(_context18) {
|
|
9717
10592
|
while (1) {
|
|
9718
|
-
switch (
|
|
10593
|
+
switch (_context18.prev = _context18.next) {
|
|
9719
10594
|
case 0:
|
|
9720
|
-
|
|
10595
|
+
a = Object.assign({
|
|
9721
10596
|
sdp: "",
|
|
9722
10597
|
type: "make_call"
|
|
9723
10598
|
}, e);
|
|
9724
|
-
|
|
9725
|
-
return this.
|
|
10599
|
+
_context18.next = 3;
|
|
10600
|
+
return this.cameraMicrophoneStream(2, t);
|
|
9726
10601
|
|
|
9727
10602
|
case 3:
|
|
9728
|
-
|
|
9729
|
-
this.
|
|
9730
|
-
this
|
|
9731
|
-
|
|
10603
|
+
i = _context18.sent;
|
|
10604
|
+
this.camearStream = i;
|
|
10605
|
+
o = this;
|
|
10606
|
+
navigator.mediaDevices.ondevicechange = /*#__PURE__*/Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee17() {
|
|
10607
|
+
var r, c, n;
|
|
10608
|
+
return regeneratorRuntime.wrap(function _callee17$(_context17) {
|
|
10609
|
+
while (1) {
|
|
10610
|
+
switch (_context17.prev = _context17.next) {
|
|
10611
|
+
case 0:
|
|
10612
|
+
_context17.next = 2;
|
|
10613
|
+
return navigator.mediaDevices.enumerateDevices();
|
|
10614
|
+
|
|
10615
|
+
case 2:
|
|
10616
|
+
r = _context17.sent.filter(function (c) {
|
|
10617
|
+
return c.kind === "videoinput";
|
|
10618
|
+
});
|
|
10619
|
+
console.log("videoDevices-->", r);
|
|
10620
|
+
_context17.t0 = r && r.length > 0;
|
|
10621
|
+
|
|
10622
|
+
if (!_context17.t0) {
|
|
10623
|
+
_context17.next = 10;
|
|
10624
|
+
break;
|
|
10625
|
+
}
|
|
10626
|
+
|
|
10627
|
+
_context17.next = 8;
|
|
10628
|
+
return o.cameraMicrophoneStream(2);
|
|
10629
|
+
|
|
10630
|
+
case 8:
|
|
10631
|
+
i = _context17.sent;
|
|
10632
|
+
_context17.t0 = i;
|
|
10633
|
+
|
|
10634
|
+
case 10:
|
|
10635
|
+
if (!_context17.t0) {
|
|
10636
|
+
_context17.next = 13;
|
|
10637
|
+
break;
|
|
10638
|
+
}
|
|
10639
|
+
|
|
10640
|
+
c = i.getVideoTracks(), n = i.getAudioTracks();
|
|
10641
|
+
o.RTC.getSenders().forEach(function (l) {
|
|
10642
|
+
l.track && l.track.kind == "video" ? l.replaceTrack(c[0]) : l.track && l.track.kind == "audio" && l.replaceTrack(n[0]);
|
|
10643
|
+
}), o.camearStream = i;
|
|
10644
|
+
|
|
10645
|
+
case 13:
|
|
10646
|
+
case "end":
|
|
10647
|
+
return _context17.stop();
|
|
10648
|
+
}
|
|
10649
|
+
}
|
|
10650
|
+
}, _callee17);
|
|
10651
|
+
}));
|
|
10652
|
+
this.bindLocalPicture(i);
|
|
10653
|
+
_context18.next = 10;
|
|
9732
10654
|
return this.createOffer();
|
|
9733
10655
|
|
|
9734
|
-
case
|
|
9735
|
-
|
|
9736
|
-
|
|
9737
|
-
this.send(t);
|
|
10656
|
+
case 10:
|
|
10657
|
+
a.sdp = this.Offer.sdp;
|
|
10658
|
+
this.send(a);
|
|
9738
10659
|
|
|
9739
|
-
case
|
|
10660
|
+
case 12:
|
|
9740
10661
|
case "end":
|
|
9741
|
-
return
|
|
10662
|
+
return _context18.stop();
|
|
9742
10663
|
}
|
|
9743
10664
|
}
|
|
9744
|
-
},
|
|
10665
|
+
}, _callee18, this);
|
|
9745
10666
|
}));
|
|
9746
10667
|
|
|
9747
|
-
function call(
|
|
10668
|
+
function call(_x9, _x10) {
|
|
9748
10669
|
return _call.apply(this, arguments);
|
|
9749
10670
|
}
|
|
9750
10671
|
|
|
@@ -9753,43 +10674,39 @@ var phoneClient_j = /*#__PURE__*/function () {
|
|
|
9753
10674
|
}, {
|
|
9754
10675
|
key: "audioCall",
|
|
9755
10676
|
value: function () {
|
|
9756
|
-
var _audioCall = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9757
|
-
var
|
|
9758
|
-
return regeneratorRuntime.wrap(function
|
|
10677
|
+
var _audioCall = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee19(e, t) {
|
|
10678
|
+
var a, i;
|
|
10679
|
+
return regeneratorRuntime.wrap(function _callee19$(_context19) {
|
|
9759
10680
|
while (1) {
|
|
9760
|
-
switch (
|
|
10681
|
+
switch (_context19.prev = _context19.next) {
|
|
9761
10682
|
case 0:
|
|
9762
|
-
|
|
10683
|
+
a = Object.assign({
|
|
9763
10684
|
sdp: "",
|
|
9764
10685
|
type: "make_call"
|
|
9765
10686
|
}, e);
|
|
9766
10687
|
this.getVideoTacks();
|
|
9767
|
-
|
|
9768
|
-
return this.
|
|
9769
|
-
audio: {
|
|
9770
|
-
noiseSuppression: !0,
|
|
9771
|
-
echoCancellation: !0
|
|
9772
|
-
}
|
|
9773
|
-
});
|
|
10688
|
+
_context19.next = 4;
|
|
10689
|
+
return this.cameraMicrophoneStream(1, t);
|
|
9774
10690
|
|
|
9775
10691
|
case 4:
|
|
9776
|
-
|
|
10692
|
+
i = _context19.sent;
|
|
10693
|
+
this.camearStream = i;
|
|
10694
|
+
_context19.next = 8;
|
|
9777
10695
|
return this.createOffer();
|
|
9778
10696
|
|
|
9779
|
-
case
|
|
9780
|
-
|
|
9781
|
-
|
|
9782
|
-
this.send(t);
|
|
10697
|
+
case 8:
|
|
10698
|
+
a.sdp = this.Offer.sdp;
|
|
10699
|
+
this.send(a);
|
|
9783
10700
|
|
|
9784
|
-
case
|
|
10701
|
+
case 10:
|
|
9785
10702
|
case "end":
|
|
9786
|
-
return
|
|
10703
|
+
return _context19.stop();
|
|
9787
10704
|
}
|
|
9788
10705
|
}
|
|
9789
|
-
},
|
|
10706
|
+
}, _callee19, this);
|
|
9790
10707
|
}));
|
|
9791
10708
|
|
|
9792
|
-
function audioCall(
|
|
10709
|
+
function audioCall(_x11, _x12) {
|
|
9793
10710
|
return _audioCall.apply(this, arguments);
|
|
9794
10711
|
}
|
|
9795
10712
|
|
|
@@ -9798,39 +10715,89 @@ var phoneClient_j = /*#__PURE__*/function () {
|
|
|
9798
10715
|
}, {
|
|
9799
10716
|
key: "answer",
|
|
9800
10717
|
value: function () {
|
|
9801
|
-
var _answer = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9802
|
-
var
|
|
9803
|
-
|
|
10718
|
+
var _answer = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee21(e, t) {
|
|
10719
|
+
var _this6 = this;
|
|
10720
|
+
|
|
10721
|
+
var a, i, o;
|
|
10722
|
+
return regeneratorRuntime.wrap(function _callee21$(_context21) {
|
|
9804
10723
|
while (1) {
|
|
9805
|
-
switch (
|
|
10724
|
+
switch (_context21.prev = _context21.next) {
|
|
9806
10725
|
case 0:
|
|
9807
|
-
|
|
10726
|
+
a = Object.assign({
|
|
9808
10727
|
sdp: "",
|
|
9809
10728
|
type: "answer"
|
|
9810
10729
|
}, e);
|
|
9811
|
-
this.callData = e;
|
|
9812
|
-
|
|
9813
|
-
return this.
|
|
10730
|
+
this.callData = e, console.log("callInType-->", this.callInType);
|
|
10731
|
+
_context21.next = 4;
|
|
10732
|
+
return this.cameraMicrophoneStream(this.callInType, t);
|
|
9814
10733
|
|
|
9815
10734
|
case 4:
|
|
9816
|
-
|
|
9817
|
-
this.
|
|
9818
|
-
|
|
10735
|
+
i = _context21.sent;
|
|
10736
|
+
this.camearStream = i;
|
|
10737
|
+
o = this;
|
|
10738
|
+
navigator.mediaDevices.ondevicechange = /*#__PURE__*/Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee20() {
|
|
10739
|
+
var r, c, n;
|
|
10740
|
+
return regeneratorRuntime.wrap(function _callee20$(_context20) {
|
|
10741
|
+
while (1) {
|
|
10742
|
+
switch (_context20.prev = _context20.next) {
|
|
10743
|
+
case 0:
|
|
10744
|
+
_context20.next = 2;
|
|
10745
|
+
return navigator.mediaDevices.enumerateDevices();
|
|
10746
|
+
|
|
10747
|
+
case 2:
|
|
10748
|
+
r = _context20.sent.filter(function (c) {
|
|
10749
|
+
return c.kind === "videoinput";
|
|
10750
|
+
});
|
|
10751
|
+
console.log("videoDevices-->", r);
|
|
10752
|
+
_context20.t0 = r && r.length > 0;
|
|
10753
|
+
|
|
10754
|
+
if (!_context20.t0) {
|
|
10755
|
+
_context20.next = 10;
|
|
10756
|
+
break;
|
|
10757
|
+
}
|
|
10758
|
+
|
|
10759
|
+
_context20.next = 8;
|
|
10760
|
+
return o.cameraMicrophoneStream(_this6.callInType);
|
|
10761
|
+
|
|
10762
|
+
case 8:
|
|
10763
|
+
i = _context20.sent;
|
|
10764
|
+
_context20.t0 = i;
|
|
10765
|
+
|
|
10766
|
+
case 10:
|
|
10767
|
+
if (!_context20.t0) {
|
|
10768
|
+
_context20.next = 13;
|
|
10769
|
+
break;
|
|
10770
|
+
}
|
|
10771
|
+
|
|
10772
|
+
c = i.getVideoTracks(), n = i.getAudioTracks();
|
|
10773
|
+
o.RTC.getSenders().forEach(function (l) {
|
|
10774
|
+
l.track && l.track.kind == "video" ? l.replaceTrack(c[0]) : l.track && l.track.kind == "audio" && l.replaceTrack(n[0]);
|
|
10775
|
+
}), o.camearStream = i;
|
|
10776
|
+
|
|
10777
|
+
case 13:
|
|
10778
|
+
case "end":
|
|
10779
|
+
return _context20.stop();
|
|
10780
|
+
}
|
|
10781
|
+
}
|
|
10782
|
+
}, _callee20);
|
|
10783
|
+
}));
|
|
10784
|
+
this.bindLocalPicture(i);
|
|
10785
|
+
_context21.next = 11;
|
|
9819
10786
|
return this.createOffer();
|
|
9820
10787
|
|
|
9821
|
-
case
|
|
9822
|
-
|
|
9823
|
-
this.send(
|
|
10788
|
+
case 11:
|
|
10789
|
+
a.sdp = this.Offer.sdp;
|
|
10790
|
+
this.send(a);
|
|
9824
10791
|
|
|
9825
|
-
case
|
|
10792
|
+
case 13:
|
|
9826
10793
|
case "end":
|
|
9827
|
-
return
|
|
10794
|
+
return _context21.stop();
|
|
9828
10795
|
}
|
|
9829
10796
|
}
|
|
9830
|
-
},
|
|
10797
|
+
}, _callee21, this);
|
|
9831
10798
|
}));
|
|
9832
10799
|
|
|
9833
|
-
function answer(
|
|
10800
|
+
function answer(_x13, _x14) {
|
|
9834
10801
|
return _answer.apply(this, arguments);
|
|
9835
10802
|
}
|
|
9836
10803
|
|
|
@@ -9839,26 +10806,32 @@ var phoneClient_j = /*#__PURE__*/function () {
|
|
|
9839
10806
|
}, {
|
|
9840
10807
|
key: "hangup",
|
|
9841
10808
|
value: function () {
|
|
9842
|
-
var _hangup = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9843
|
-
var t;
|
|
9844
|
-
return regeneratorRuntime.wrap(function
|
|
10809
|
+
var _hangup = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee22(e) {
|
|
10810
|
+
var t, a;
|
|
10811
|
+
return regeneratorRuntime.wrap(function _callee22$(_context22) {
|
|
9845
10812
|
while (1) {
|
|
9846
|
-
switch (
|
|
10813
|
+
switch (_context22.prev = _context22.next) {
|
|
9847
10814
|
case 0:
|
|
9848
10815
|
t = Object.assign({
|
|
9849
10816
|
type: "hangup"
|
|
9850
10817
|
}, e);
|
|
9851
|
-
|
|
10818
|
+
this.send(t);
|
|
10819
|
+
a = this;
|
|
10820
|
+
a.stopStack(), a.RTC && a.RTC.getSenders().forEach(function (o) {
|
|
10821
|
+
o && o.track && o.track.stop();
|
|
10822
|
+
}), a.RTC = null, a.requestAnimationFrameTimer && cancelAnimationFrame(a.requestAnimationFrameTimer), setTimeout(function () {
|
|
10823
|
+
a.createRTC();
|
|
10824
|
+
}, 1e3);
|
|
9852
10825
|
|
|
9853
|
-
case
|
|
10826
|
+
case 4:
|
|
9854
10827
|
case "end":
|
|
9855
|
-
return
|
|
10828
|
+
return _context22.stop();
|
|
9856
10829
|
}
|
|
9857
10830
|
}
|
|
9858
|
-
},
|
|
10831
|
+
}, _callee22, this);
|
|
9859
10832
|
}));
|
|
9860
10833
|
|
|
9861
|
-
function hangup(
|
|
10834
|
+
function hangup(_x15) {
|
|
9862
10835
|
return _hangup.apply(this, arguments);
|
|
9863
10836
|
}
|
|
9864
10837
|
|
|
@@ -9867,27 +10840,49 @@ var phoneClient_j = /*#__PURE__*/function () {
|
|
|
9867
10840
|
}, {
|
|
9868
10841
|
key: "stopStack",
|
|
9869
10842
|
value: function () {
|
|
9870
|
-
var _stopStack = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9871
|
-
var e, t;
|
|
9872
|
-
|
|
10843
|
+
var _stopStack = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee23() {
|
|
10844
|
+
var e, t, a, _a, _a2, _a3;
|
|
10845
|
+
|
|
10846
|
+
return regeneratorRuntime.wrap(function _callee23$(_context23) {
|
|
9873
10847
|
while (1) {
|
|
9874
|
-
switch (
|
|
10848
|
+
switch (_context23.prev = _context23.next) {
|
|
9875
10849
|
case 0:
|
|
9876
|
-
e = document.querySelector("#" + this.localId);
|
|
10850
|
+
e = document.querySelector("#" + this.localId), t = document.getElementById(this.remoteId);
|
|
9877
10851
|
|
|
9878
10852
|
if (e.srcObject) {
|
|
9879
|
-
|
|
9880
|
-
Array.isArray(
|
|
9881
|
-
|
|
9882
|
-
}) :
|
|
10853
|
+
a = e.srcObject.getTracks();
|
|
10854
|
+
Array.isArray(a) ? a.forEach(function (i) {
|
|
10855
|
+
i.stop();
|
|
10856
|
+
}) : a.stop(), e.srcObject = null;
|
|
9883
10857
|
}
|
|
9884
10858
|
|
|
9885
|
-
|
|
10859
|
+
if (t.srcObject) {
|
|
10860
|
+
_a = t.srcObject.getTracks();
|
|
10861
|
+
Array.isArray(_a) ? _a.forEach(function (i) {
|
|
10862
|
+
i.stop();
|
|
10863
|
+
}) : _a.stop(), t.srcObject = null;
|
|
10864
|
+
}
|
|
10865
|
+
|
|
10866
|
+
if (this.displayMedia) {
|
|
10867
|
+
_a2 = this.displayMedia.getTracks();
|
|
10868
|
+
Array.isArray(_a2) ? _a2.forEach(function (i) {
|
|
10869
|
+
i.stop();
|
|
10870
|
+
}) : distrack.stop();
|
|
10871
|
+
}
|
|
10872
|
+
|
|
10873
|
+
if (this.camearStream) {
|
|
10874
|
+
_a3 = this.camearStream.getTracks();
|
|
10875
|
+
Array.isArray(_a3) ? _a3.forEach(function (i) {
|
|
10876
|
+
i.stop();
|
|
10877
|
+
}) : _a3.stop();
|
|
10878
|
+
}
|
|
10879
|
+
|
|
10880
|
+
case 5:
|
|
9886
10881
|
case "end":
|
|
9887
|
-
return
|
|
10882
|
+
return _context23.stop();
|
|
9888
10883
|
}
|
|
9889
10884
|
}
|
|
9890
|
-
},
|
|
10885
|
+
}, _callee23, this);
|
|
9891
10886
|
}));
|
|
9892
10887
|
|
|
9893
10888
|
function stopStack() {
|
|
@@ -9899,48 +10894,54 @@ var phoneClient_j = /*#__PURE__*/function () {
|
|
|
9899
10894
|
}, {
|
|
9900
10895
|
key: "cameraUser",
|
|
9901
10896
|
value: function () {
|
|
9902
|
-
var _cameraUser = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9903
|
-
var
|
|
9904
|
-
return regeneratorRuntime.wrap(function
|
|
10897
|
+
var _cameraUser = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee24(e) {
|
|
10898
|
+
var t, a, i, o, s, r, c, n;
|
|
10899
|
+
return regeneratorRuntime.wrap(function _callee24$(_context24) {
|
|
9905
10900
|
while (1) {
|
|
9906
|
-
switch (
|
|
10901
|
+
switch (_context24.prev = _context24.next) {
|
|
9907
10902
|
case 0:
|
|
9908
10903
|
console.log("前置"), this.stopStack();
|
|
9909
|
-
|
|
9910
|
-
t =
|
|
9911
|
-
|
|
10904
|
+
t = this.os(), a = 640, i = 480;
|
|
10905
|
+
(t.isPc || t.isPhone) && (a = 640, i = 480);
|
|
10906
|
+
o = i, s = a;
|
|
10907
|
+
e && (e.width && (s = e.width), e.height && (o = e.height));
|
|
10908
|
+
_context24.next = 7;
|
|
9912
10909
|
return navigator.mediaDevices.getUserMedia({
|
|
9913
10910
|
audio: !0,
|
|
9914
10911
|
video: {
|
|
9915
10912
|
width: {
|
|
9916
|
-
|
|
10913
|
+
min: s,
|
|
10914
|
+
ideal: s,
|
|
10915
|
+
max: s
|
|
9917
10916
|
},
|
|
9918
10917
|
height: {
|
|
9919
|
-
|
|
10918
|
+
min: o,
|
|
10919
|
+
max: o,
|
|
10920
|
+
ideal: o
|
|
9920
10921
|
},
|
|
9921
10922
|
facingMode: "user"
|
|
9922
10923
|
}
|
|
9923
|
-
})["catch"](function (
|
|
9924
|
-
console.log("user--err--",
|
|
10924
|
+
})["catch"](function (l) {
|
|
10925
|
+
console.log("user--err--", l);
|
|
9925
10926
|
});
|
|
9926
10927
|
|
|
9927
|
-
case
|
|
9928
|
-
|
|
9929
|
-
this.bindLocalPicture(
|
|
9930
|
-
|
|
9931
|
-
this.RTC.getSenders().forEach(function (
|
|
9932
|
-
|
|
10928
|
+
case 7:
|
|
10929
|
+
r = _context24.sent;
|
|
10930
|
+
r.label = "userCamer", this.bindLocalPicture(r), this.presentStream = "user";
|
|
10931
|
+
c = r.getVideoTracks(), n = r.getAudioTracks();
|
|
10932
|
+
this.RTC.getSenders().forEach(function (l) {
|
|
10933
|
+
l.track && l.track.kind == "video" ? l.replaceTrack(c[0]) : l.track && l.track.kind == "audio" && l.replaceTrack(n[0]);
|
|
9933
10934
|
});
|
|
9934
10935
|
|
|
9935
|
-
case
|
|
10936
|
+
case 11:
|
|
9936
10937
|
case "end":
|
|
9937
|
-
return
|
|
10938
|
+
return _context24.stop();
|
|
9938
10939
|
}
|
|
9939
10940
|
}
|
|
9940
|
-
},
|
|
10941
|
+
}, _callee24, this);
|
|
9941
10942
|
}));
|
|
9942
10943
|
|
|
9943
|
-
function cameraUser() {
|
|
10944
|
+
function cameraUser(_x16) {
|
|
9944
10945
|
return _cameraUser.apply(this, arguments);
|
|
9945
10946
|
}
|
|
9946
10947
|
|
|
@@ -9949,48 +10950,54 @@ var phoneClient_j = /*#__PURE__*/function () {
|
|
|
9949
10950
|
}, {
|
|
9950
10951
|
key: "cameraRear",
|
|
9951
10952
|
value: function () {
|
|
9952
|
-
var _cameraRear = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9953
|
-
var
|
|
9954
|
-
return regeneratorRuntime.wrap(function
|
|
10953
|
+
var _cameraRear = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee25(e) {
|
|
10954
|
+
var t, a, i, o, s, r, c, n;
|
|
10955
|
+
return regeneratorRuntime.wrap(function _callee25$(_context25) {
|
|
9955
10956
|
while (1) {
|
|
9956
|
-
switch (
|
|
10957
|
+
switch (_context25.prev = _context25.next) {
|
|
9957
10958
|
case 0:
|
|
9958
10959
|
console.log("后置"), this.stopStack();
|
|
9959
|
-
|
|
9960
|
-
t =
|
|
9961
|
-
|
|
10960
|
+
t = this.os(), a = 640, i = 480;
|
|
10961
|
+
(t.isPc || t.isPhone) && (a = 640, i = 480);
|
|
10962
|
+
o = i, s = a;
|
|
10963
|
+
e && (e.width && (s = e.width), e.height && (o = e.height));
|
|
10964
|
+
_context25.next = 7;
|
|
9962
10965
|
return navigator.mediaDevices.getUserMedia({
|
|
9963
10966
|
audio: !0,
|
|
9964
10967
|
video: {
|
|
9965
10968
|
width: {
|
|
9966
|
-
|
|
10969
|
+
min: s,
|
|
10970
|
+
ideal: s,
|
|
10971
|
+
max: s
|
|
9967
10972
|
},
|
|
9968
10973
|
height: {
|
|
9969
|
-
|
|
10974
|
+
min: o,
|
|
10975
|
+
max: o,
|
|
10976
|
+
ideal: o
|
|
9970
10977
|
},
|
|
9971
10978
|
facingMode: "environment"
|
|
9972
10979
|
}
|
|
9973
|
-
})["catch"](function (
|
|
9974
|
-
console.log("environment--err--",
|
|
10980
|
+
})["catch"](function (l) {
|
|
10981
|
+
console.log("environment--err--", l);
|
|
9975
10982
|
});
|
|
9976
10983
|
|
|
9977
|
-
case
|
|
9978
|
-
|
|
9979
|
-
this.bindLocalPicture(
|
|
9980
|
-
|
|
9981
|
-
this.RTC.getSenders().forEach(function (
|
|
9982
|
-
|
|
10984
|
+
case 7:
|
|
10985
|
+
r = _context25.sent;
|
|
10986
|
+
r.label = "environmentCamer", this.bindLocalPicture(r), this.presentStream = "environment";
|
|
10987
|
+
c = r.getVideoTracks(), n = r.getAudioTracks();
|
|
10988
|
+
this.RTC.getSenders().forEach(function (l) {
|
|
10989
|
+
l.track.kind == "video" ? l.replaceTrack(c[0]) : l.track.kind == "audio" && l.replaceTrack(n[0]);
|
|
9983
10990
|
});
|
|
9984
10991
|
|
|
9985
|
-
case
|
|
10992
|
+
case 11:
|
|
9986
10993
|
case "end":
|
|
9987
|
-
return
|
|
10994
|
+
return _context25.stop();
|
|
9988
10995
|
}
|
|
9989
10996
|
}
|
|
9990
|
-
},
|
|
10997
|
+
}, _callee25, this);
|
|
9991
10998
|
}));
|
|
9992
10999
|
|
|
9993
|
-
function cameraRear() {
|
|
11000
|
+
function cameraRear(_x17) {
|
|
9994
11001
|
return _cameraRear.apply(this, arguments);
|
|
9995
11002
|
}
|
|
9996
11003
|
|
|
@@ -9999,21 +11006,94 @@ var phoneClient_j = /*#__PURE__*/function () {
|
|
|
9999
11006
|
}, {
|
|
10000
11007
|
key: "microphoneChange",
|
|
10001
11008
|
value: function microphoneChange(e) {
|
|
10002
|
-
var t = document.
|
|
11009
|
+
var t = document.getElementById(this.localId);
|
|
10003
11010
|
|
|
10004
|
-
if (t.srcObject) {
|
|
10005
|
-
var
|
|
10006
|
-
|
|
11011
|
+
if (t && t.srcObject) {
|
|
11012
|
+
var a = t.srcObject.getAudioTracks();
|
|
11013
|
+
a[0].enabled = e;
|
|
11014
|
+
}
|
|
11015
|
+
}
|
|
11016
|
+
}, {
|
|
11017
|
+
key: "cameraChange",
|
|
11018
|
+
value: function cameraChange(e) {
|
|
11019
|
+
var t = document.getElementById(this.localId);
|
|
11020
|
+
|
|
11021
|
+
if (t && t.srcObject) {
|
|
11022
|
+
var a = t.srcObject.getVideoTracks();
|
|
11023
|
+
a[0].enabled = e, this.localCameraStaus = a[0].enabled;
|
|
10007
11024
|
}
|
|
10008
11025
|
}
|
|
11026
|
+
}, {
|
|
11027
|
+
key: "localCameraChange",
|
|
11028
|
+
value: function () {
|
|
11029
|
+
var _localCameraChange = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee26(e) {
|
|
11030
|
+
var t, a, i, _a4, o;
|
|
11031
|
+
|
|
11032
|
+
return regeneratorRuntime.wrap(function _callee26$(_context26) {
|
|
11033
|
+
while (1) {
|
|
11034
|
+
switch (_context26.prev = _context26.next) {
|
|
11035
|
+
case 0:
|
|
11036
|
+
t = this;
|
|
11037
|
+
|
|
11038
|
+
if (!e) {
|
|
11039
|
+
_context26.next = 9;
|
|
11040
|
+
break;
|
|
11041
|
+
}
|
|
11042
|
+
|
|
11043
|
+
a = t.RTC.getSenders();
|
|
11044
|
+
_context26.next = 5;
|
|
11045
|
+
return t.createdVirtualVideo();
|
|
11046
|
+
|
|
11047
|
+
case 5:
|
|
11048
|
+
i = _context26.sent;
|
|
11049
|
+
a.forEach(function (o, s) {
|
|
11050
|
+
if (o.track && o.track.kind == "video") {
|
|
11051
|
+
var r = i.getVideoTracks()[0];
|
|
11052
|
+
o.replaceTrack(r);
|
|
11053
|
+
}
|
|
11054
|
+
});
|
|
11055
|
+
_context26.next = 15;
|
|
11056
|
+
break;
|
|
11057
|
+
|
|
11058
|
+
case 9:
|
|
11059
|
+
if (!t.RTC) {
|
|
11060
|
+
_context26.next = 15;
|
|
11061
|
+
break;
|
|
11062
|
+
}
|
|
11063
|
+
|
|
11064
|
+
_a4 = t.RTC.getSenders();
|
|
11065
|
+
_context26.next = 13;
|
|
11066
|
+
return t.cameraMicrophoneStream(2);
|
|
11067
|
+
|
|
11068
|
+
case 13:
|
|
11069
|
+
o = _context26.sent.getVideoTracks()[0];
|
|
11070
|
+
|
|
11071
|
+
_a4.forEach(function (s, r) {
|
|
11072
|
+
s && s.track && s.track.kind == "video" && s.replaceTrack(o);
|
|
11073
|
+
});
|
|
11074
|
+
|
|
11075
|
+
case 15:
|
|
11076
|
+
case "end":
|
|
11077
|
+
return _context26.stop();
|
|
11078
|
+
}
|
|
11079
|
+
}
|
|
11080
|
+
}, _callee26, this);
|
|
11081
|
+
}));
|
|
11082
|
+
|
|
11083
|
+
function localCameraChange(_x18) {
|
|
11084
|
+
return _localCameraChange.apply(this, arguments);
|
|
11085
|
+
}
|
|
11086
|
+
|
|
11087
|
+
return localCameraChange;
|
|
11088
|
+
}()
|
|
10009
11089
|
}, {
|
|
10010
11090
|
key: "mutedChange",
|
|
10011
11091
|
value: function mutedChange(e) {
|
|
10012
|
-
var t = document.
|
|
11092
|
+
var t = document.getElementById("audio_remote");
|
|
10013
11093
|
|
|
10014
11094
|
if (t.srcObject) {
|
|
10015
|
-
var
|
|
10016
|
-
|
|
11095
|
+
var a = t.srcObject.getAudioTracks();
|
|
11096
|
+
a[0].enabled = e;
|
|
10017
11097
|
}
|
|
10018
11098
|
}
|
|
10019
11099
|
}, {
|
|
@@ -10022,21 +11102,255 @@ var phoneClient_j = /*#__PURE__*/function () {
|
|
|
10022
11102
|
var t = Object.assign({
|
|
10023
11103
|
type: "login_out"
|
|
10024
11104
|
}, e);
|
|
10025
|
-
|
|
11105
|
+
this.send(t);
|
|
10026
11106
|
}
|
|
10027
11107
|
}, {
|
|
10028
11108
|
key: "changePicture",
|
|
10029
11109
|
value: function changePicture() {
|
|
10030
|
-
|
|
10031
|
-
|
|
10032
|
-
|
|
10033
|
-
o = e.srcObject,
|
|
11110
|
+
var e = document.getElementById(this.localId),
|
|
11111
|
+
t = document.getElementById(this.remoteId),
|
|
11112
|
+
a = e.srcObject,
|
|
10034
11113
|
i = t.srcObject;
|
|
10035
|
-
|
|
11114
|
+
a && i && (e.srcObject = i, t.srcObject = a);
|
|
11115
|
+
}
|
|
11116
|
+
}, {
|
|
11117
|
+
key: "shareStopCheckMedia",
|
|
11118
|
+
value: function () {
|
|
11119
|
+
var _shareStopCheckMedia = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee27(e) {
|
|
11120
|
+
var t, a, i, _i, o, _i2, _o2, s;
|
|
11121
|
+
|
|
11122
|
+
return regeneratorRuntime.wrap(function _callee27$(_context27) {
|
|
11123
|
+
while (1) {
|
|
11124
|
+
switch (_context27.prev = _context27.next) {
|
|
11125
|
+
case 0:
|
|
11126
|
+
t = this;
|
|
11127
|
+
_context27.next = 3;
|
|
11128
|
+
return this.getDeviceType();
|
|
11129
|
+
|
|
11130
|
+
case 3:
|
|
11131
|
+
a = _context27.sent;
|
|
11132
|
+
|
|
11133
|
+
if (console.log("deviceType-->", a, t.displayMedia), t.displayMedia) {
|
|
11134
|
+
i = t.displayMedia.getTracks();
|
|
11135
|
+
console.log("displayStream-->", i), i && i.forEach(function (o) {
|
|
11136
|
+
o.stop();
|
|
11137
|
+
});
|
|
11138
|
+
}
|
|
11139
|
+
|
|
11140
|
+
if (!(a == 2)) {
|
|
11141
|
+
_context27.next = 14;
|
|
11142
|
+
break;
|
|
11143
|
+
}
|
|
11144
|
+
|
|
11145
|
+
if (!t.RTC) {
|
|
11146
|
+
_context27.next = 12;
|
|
11147
|
+
break;
|
|
11148
|
+
}
|
|
11149
|
+
|
|
11150
|
+
_i = t.RTC.getSenders();
|
|
11151
|
+
_context27.next = 10;
|
|
11152
|
+
return t.createdVirtualVideo(2);
|
|
11153
|
+
|
|
11154
|
+
case 10:
|
|
11155
|
+
o = _context27.sent;
|
|
11156
|
+
|
|
11157
|
+
_i.forEach(function (s, r) {
|
|
11158
|
+
if (s.track) {
|
|
11159
|
+
if (s.track.kind == "video") {
|
|
11160
|
+
var c = o.getVideoTracks()[0];
|
|
11161
|
+
s.replaceTrack(c);
|
|
11162
|
+
} else if (s.track.kind == "audio") {
|
|
11163
|
+
var _c = o.getAudioTracks()[0];
|
|
11164
|
+
s.replaceTrack(_c);
|
|
11165
|
+
}
|
|
11166
|
+
}
|
|
11167
|
+
});
|
|
11168
|
+
|
|
11169
|
+
case 12:
|
|
11170
|
+
_context27.next = 21;
|
|
11171
|
+
break;
|
|
11172
|
+
|
|
11173
|
+
case 14:
|
|
11174
|
+
if (!t.RTC) {
|
|
11175
|
+
_context27.next = 21;
|
|
11176
|
+
break;
|
|
11177
|
+
}
|
|
11178
|
+
|
|
11179
|
+
_i2 = t.RTC.getSenders();
|
|
11180
|
+
_context27.next = 18;
|
|
11181
|
+
return this.cameraMicrophoneStream(2, e);
|
|
11182
|
+
|
|
11183
|
+
case 18:
|
|
11184
|
+
_o2 = _context27.sent;
|
|
11185
|
+
s = _o2.getVideoTracks()[0];
|
|
11186
|
+
|
|
11187
|
+
_i2.forEach(function (r, c) {
|
|
11188
|
+
if (r && r.track) {
|
|
11189
|
+
if (r.track.kind == "video") r.replaceTrack(s);else if (r.track.kind == "audio") {
|
|
11190
|
+
var n = _o2.getAudioTracks()[0];
|
|
11191
|
+
|
|
11192
|
+
r.replaceTrack(n);
|
|
11193
|
+
}
|
|
11194
|
+
}
|
|
11195
|
+
});
|
|
11196
|
+
|
|
11197
|
+
case 21:
|
|
11198
|
+
case "end":
|
|
11199
|
+
return _context27.stop();
|
|
11200
|
+
}
|
|
11201
|
+
}
|
|
11202
|
+
}, _callee27, this);
|
|
11203
|
+
}));
|
|
11204
|
+
|
|
11205
|
+
function shareStopCheckMedia(_x19) {
|
|
11206
|
+
return _shareStopCheckMedia.apply(this, arguments);
|
|
11207
|
+
}
|
|
11208
|
+
|
|
11209
|
+
return shareStopCheckMedia;
|
|
11210
|
+
}()
|
|
11211
|
+
}, {
|
|
11212
|
+
key: "stopDisplayMedia",
|
|
11213
|
+
value: function stopDisplayMedia() {
|
|
11214
|
+
this.displayMedia ? (this.messageBack.call(null, {
|
|
11215
|
+
code: 200,
|
|
11216
|
+
type: "share_end",
|
|
11217
|
+
msg: "屏幕已结束"
|
|
11218
|
+
}), this.shareStopCheckMedia()) : (console.log("无法获取分享视频流,请查看分享是否成功"), this.messageBack.call(null, {
|
|
11219
|
+
code: -5,
|
|
11220
|
+
type: "error",
|
|
11221
|
+
err: "无法获取分享视频流,请查看分享是否成功" + error
|
|
11222
|
+
}));
|
|
10036
11223
|
}
|
|
11224
|
+
}, {
|
|
11225
|
+
key: "getDisplayMedia",
|
|
11226
|
+
value: function () {
|
|
11227
|
+
var _getDisplayMedia = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee29(e) {
|
|
11228
|
+
var t, a, i, _a5, _i3, o;
|
|
11229
|
+
|
|
11230
|
+
return regeneratorRuntime.wrap(function _callee29$(_context29) {
|
|
11231
|
+
while (1) {
|
|
11232
|
+
switch (_context29.prev = _context29.next) {
|
|
11233
|
+
case 0:
|
|
11234
|
+
t = this;
|
|
11235
|
+
|
|
11236
|
+
if (!(e && e.sourcesId)) {
|
|
11237
|
+
_context29.next = 7;
|
|
11238
|
+
break;
|
|
11239
|
+
}
|
|
11240
|
+
|
|
11241
|
+
_context29.next = 4;
|
|
11242
|
+
return navigator.mediaDevices.getUserMedia({
|
|
11243
|
+
audio: !1,
|
|
11244
|
+
video: {
|
|
11245
|
+
mandatory: {
|
|
11246
|
+
chromeMediaSource: "desktop",
|
|
11247
|
+
chromeMediaSourceId: e.sourcesId
|
|
11248
|
+
}
|
|
11249
|
+
}
|
|
11250
|
+
})["catch"](function (a) {
|
|
11251
|
+
console.log("获取屏幕共享失败:", a), t.messageBack.call(null, {
|
|
11252
|
+
code: -5,
|
|
11253
|
+
type: "error",
|
|
11254
|
+
err: "屏幕共享拉起失败_" + a
|
|
11255
|
+
});
|
|
11256
|
+
});
|
|
11257
|
+
|
|
11258
|
+
case 4:
|
|
11259
|
+
t.displayMedia = _context29.sent;
|
|
11260
|
+
_context29.next = 13;
|
|
11261
|
+
break;
|
|
11262
|
+
|
|
11263
|
+
case 7:
|
|
11264
|
+
a = !1;
|
|
11265
|
+
e && e.getAudio && (a = !!e.getAudio), t.shareGetAudio = a;
|
|
11266
|
+
i = {
|
|
11267
|
+
cursor: "always",
|
|
11268
|
+
// width: { ideal: 960 },
|
|
11269
|
+
// height: { ideal: 660 },
|
|
11270
|
+
width: {
|
|
11271
|
+
ideal: 1280,
|
|
11272
|
+
max: 1280
|
|
11273
|
+
},
|
|
11274
|
+
height: {
|
|
11275
|
+
ideal: 720,
|
|
11276
|
+
max: 720
|
|
11277
|
+
},
|
|
11278
|
+
resizeMode: "crop-and-scale",
|
|
11279
|
+
chromeMediaSource: "desktop",
|
|
11280
|
+
logicalSurface: !1
|
|
11281
|
+
};
|
|
11282
|
+
_context29.next = 12;
|
|
11283
|
+
return navigator.mediaDevices.getDisplayMedia({
|
|
11284
|
+
video: i,
|
|
11285
|
+
audio: a,
|
|
11286
|
+
displaySurface: "browser"
|
|
11287
|
+
})["catch"](function (o) {
|
|
11288
|
+
console.log("获取屏幕共享失败:", o), t.messageBack.call(null, {
|
|
11289
|
+
code: -5,
|
|
11290
|
+
type: "error",
|
|
11291
|
+
err: "屏幕共享拉起失败_" + o
|
|
11292
|
+
});
|
|
11293
|
+
});
|
|
11294
|
+
|
|
11295
|
+
case 12:
|
|
11296
|
+
t.displayMedia = _context29.sent;
|
|
11297
|
+
|
|
11298
|
+
case 13:
|
|
11299
|
+
if (t.displayMedia) {
|
|
11300
|
+
t.bindLocalPicture(t.displayMedia);
|
|
11301
|
+
_a5 = t.displayMedia.getVideoTracks(), _i3 = t.displayMedia.getAudioTracks();
|
|
11302
|
+
t.messageBack.call(null, {
|
|
11303
|
+
code: 200,
|
|
11304
|
+
type: "share_start",
|
|
11305
|
+
message: "开始屏幕共享",
|
|
11306
|
+
data: {}
|
|
11307
|
+
});
|
|
11308
|
+
o = t.RTC.getSenders();
|
|
11309
|
+
o.forEach(function (s, r) {
|
|
11310
|
+
s.track && (s.track.kind == "video" ? s.replaceTrack(_a5[0]) : s.track.kind == "audio" && t.shareGetAudio && s.replaceTrack(_i3[0]));
|
|
11311
|
+
}), o && o.length > 0 && t.messageBack.call(null, {
|
|
11312
|
+
code: 200,
|
|
11313
|
+
type: "share_sharing",
|
|
11314
|
+
message: "正在共享",
|
|
11315
|
+
data: {}
|
|
11316
|
+
}), t.displayMedia.getVideoTracks()[0].addEventListener("ended", /*#__PURE__*/Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee28() {
|
|
11317
|
+
return regeneratorRuntime.wrap(function _callee28$(_context28) {
|
|
11318
|
+
while (1) {
|
|
11319
|
+
switch (_context28.prev = _context28.next) {
|
|
11320
|
+
case 0:
|
|
11321
|
+
console.log("结束共享------"), t.messageBack.call(null, {
|
|
11322
|
+
code: 200,
|
|
11323
|
+
type: "share_end",
|
|
11324
|
+
message: "屏幕已结束",
|
|
11325
|
+
data: {}
|
|
11326
|
+
}), t.shareGetAudio = !1, t.shareStopCheckMedia();
|
|
11327
|
+
|
|
11328
|
+
case 1:
|
|
11329
|
+
case "end":
|
|
11330
|
+
return _context28.stop();
|
|
11331
|
+
}
|
|
11332
|
+
}
|
|
11333
|
+
}, _callee28);
|
|
11334
|
+
})));
|
|
11335
|
+
}
|
|
11336
|
+
|
|
11337
|
+
case 14:
|
|
11338
|
+
case "end":
|
|
11339
|
+
return _context29.stop();
|
|
11340
|
+
}
|
|
11341
|
+
}
|
|
11342
|
+
}, _callee29, this);
|
|
11343
|
+
}));
|
|
11344
|
+
|
|
11345
|
+
function getDisplayMedia(_x20) {
|
|
11346
|
+
return _getDisplayMedia.apply(this, arguments);
|
|
11347
|
+
}
|
|
11348
|
+
|
|
11349
|
+
return getDisplayMedia;
|
|
11350
|
+
}()
|
|
10037
11351
|
}]);
|
|
10038
11352
|
|
|
10039
|
-
return
|
|
11353
|
+
return O;
|
|
10040
11354
|
}();
|
|
10041
11355
|
|
|
10042
11356
|
|
|
@@ -10146,7 +11460,7 @@ var common_request_getH265PlayerObj = function getH265PlayerObj(rtcServe, docePr
|
|
|
10146
11460
|
};
|
|
10147
11461
|
|
|
10148
11462
|
var common_request_initPhoneClientWs = function initPhoneClientWs(ws) {
|
|
10149
|
-
var phoneClientObj = new
|
|
11463
|
+
var phoneClientObj = new phoneClient_O(ws);
|
|
10150
11464
|
return phoneClientObj;
|
|
10151
11465
|
}; // 组合发送ws信息
|
|
10152
11466
|
|
|
@@ -10268,8 +11582,14 @@ var common_request_wsClass = /*#__PURE__*/function () {
|
|
|
10268
11582
|
|
|
10269
11583
|
_classPrivateFieldSet(this, _player, null);
|
|
10270
11584
|
|
|
10271
|
-
this.socket.closeSocket();
|
|
10272
|
-
|
|
11585
|
+
this.socket.closeSocket(1000, '通知关闭websocket连接');
|
|
11586
|
+
this.socket = null;
|
|
11587
|
+
|
|
11588
|
+
if (_classPrivateFieldGet(this, _phoneClientObj)) {
|
|
11589
|
+
_classPrivateFieldGet(this, _phoneClientObj).onclose();
|
|
11590
|
+
|
|
11591
|
+
_classPrivateFieldSet(this, _phoneClientObj, null);
|
|
11592
|
+
}
|
|
10273
11593
|
}
|
|
10274
11594
|
}]);
|
|
10275
11595
|
|