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