kucservice 1.1.9 → 1.2.1
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 +1420 -116
- package/dist/kucservice.common.js.gz +0 -0
- package/dist/kucservice.common.js.map +1 -1
- package/dist/kucservice.umd.js +1420 -116
- package/dist/kucservice.umd.js.gz +0 -0
- package/dist/kucservice.umd.js.map +1 -1
- package/dist/kucservice.umd.min.js +1 -1
- package/dist/kucservice.umd.min.js.gz +0 -0
- package/dist/kucservice.umd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/kucservice.umd.js
CHANGED
|
@@ -931,6 +931,56 @@ module.exports = function (it) {
|
|
|
931
931
|
};
|
|
932
932
|
|
|
933
933
|
|
|
934
|
+
/***/ }),
|
|
935
|
+
|
|
936
|
+
/***/ "1da1":
|
|
937
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
938
|
+
|
|
939
|
+
"use strict";
|
|
940
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _asyncToGenerator; });
|
|
941
|
+
/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("d3b7");
|
|
942
|
+
/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
943
|
+
/* harmony import */ var core_js_modules_es_promise_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("e6cf");
|
|
944
|
+
/* harmony import */ var core_js_modules_es_promise_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_promise_js__WEBPACK_IMPORTED_MODULE_1__);
|
|
945
|
+
|
|
946
|
+
|
|
947
|
+
|
|
948
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
949
|
+
try {
|
|
950
|
+
var info = gen[key](arg);
|
|
951
|
+
var value = info.value;
|
|
952
|
+
} catch (error) {
|
|
953
|
+
reject(error);
|
|
954
|
+
return;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
if (info.done) {
|
|
958
|
+
resolve(value);
|
|
959
|
+
} else {
|
|
960
|
+
Promise.resolve(value).then(_next, _throw);
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
function _asyncToGenerator(fn) {
|
|
965
|
+
return function () {
|
|
966
|
+
var self = this,
|
|
967
|
+
args = arguments;
|
|
968
|
+
return new Promise(function (resolve, reject) {
|
|
969
|
+
var gen = fn.apply(self, args);
|
|
970
|
+
|
|
971
|
+
function _next(value) {
|
|
972
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
function _throw(err) {
|
|
976
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
_next(undefined);
|
|
980
|
+
});
|
|
981
|
+
};
|
|
982
|
+
}
|
|
983
|
+
|
|
934
984
|
/***/ }),
|
|
935
985
|
|
|
936
986
|
/***/ "1dde":
|
|
@@ -1565,6 +1615,18 @@ defineIterator(String, 'String', function (iterated) {
|
|
|
1565
1615
|
module.exports = {};
|
|
1566
1616
|
|
|
1567
1617
|
|
|
1618
|
+
/***/ }),
|
|
1619
|
+
|
|
1620
|
+
/***/ "408a":
|
|
1621
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1622
|
+
|
|
1623
|
+
var uncurryThis = __webpack_require__("e330");
|
|
1624
|
+
|
|
1625
|
+
// `thisNumberValue` abstract operation
|
|
1626
|
+
// https://tc39.es/ecma262/#sec-thisnumbervalue
|
|
1627
|
+
module.exports = uncurryThis(1.0.valueOf);
|
|
1628
|
+
|
|
1629
|
+
|
|
1568
1630
|
/***/ }),
|
|
1569
1631
|
|
|
1570
1632
|
/***/ "40d5":
|
|
@@ -1704,48 +1766,16 @@ function _isNativeReflectConstruct() {
|
|
|
1704
1766
|
return false;
|
|
1705
1767
|
}
|
|
1706
1768
|
}
|
|
1707
|
-
// EXTERNAL MODULE: ./node_modules/
|
|
1708
|
-
var
|
|
1709
|
-
|
|
1710
|
-
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.symbol.description.js
|
|
1711
|
-
var es_symbol_description = __webpack_require__("e01a");
|
|
1712
|
-
|
|
1713
|
-
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.symbol.iterator.js
|
|
1714
|
-
var es_symbol_iterator = __webpack_require__("d28b");
|
|
1715
|
-
|
|
1716
|
-
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.iterator.js
|
|
1717
|
-
var es_array_iterator = __webpack_require__("e260");
|
|
1718
|
-
|
|
1719
|
-
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.iterator.js
|
|
1720
|
-
var es_string_iterator = __webpack_require__("3ca3");
|
|
1721
|
-
|
|
1722
|
-
// EXTERNAL MODULE: ./node_modules/core-js/modules/web.dom-collections.iterator.js
|
|
1723
|
-
var web_dom_collections_iterator = __webpack_require__("ddb0");
|
|
1724
|
-
|
|
1725
|
-
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
1726
|
-
|
|
1727
|
-
|
|
1769
|
+
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
1770
|
+
var esm_typeof = __webpack_require__("53ca");
|
|
1728
1771
|
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
function _typeof(obj) {
|
|
1734
|
-
"@babel/helpers - typeof";
|
|
1735
|
-
|
|
1736
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
1737
|
-
return typeof obj;
|
|
1738
|
-
} : function (obj) {
|
|
1739
|
-
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
1740
|
-
}, _typeof(obj);
|
|
1741
|
-
}
|
|
1742
1772
|
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js
|
|
1743
1773
|
|
|
1744
1774
|
|
|
1745
1775
|
|
|
1746
1776
|
|
|
1747
1777
|
function _possibleConstructorReturn(self, call) {
|
|
1748
|
-
if (call && (
|
|
1778
|
+
if (call && (Object(esm_typeof["a" /* default */])(call) === "object" || typeof call === "function")) {
|
|
1749
1779
|
return call;
|
|
1750
1780
|
} else if (call !== void 0) {
|
|
1751
1781
|
throw new TypeError("Derived constructors may only return object or undefined");
|
|
@@ -1776,9 +1806,18 @@ function _createSuper(Derived) {
|
|
|
1776
1806
|
return _possibleConstructorReturn(this, result);
|
|
1777
1807
|
};
|
|
1778
1808
|
}
|
|
1809
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.iterator.js
|
|
1810
|
+
var es_array_iterator = __webpack_require__("e260");
|
|
1811
|
+
|
|
1779
1812
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.map.js
|
|
1780
1813
|
var es_map = __webpack_require__("4ec9");
|
|
1781
1814
|
|
|
1815
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.iterator.js
|
|
1816
|
+
var es_string_iterator = __webpack_require__("3ca3");
|
|
1817
|
+
|
|
1818
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/web.dom-collections.iterator.js
|
|
1819
|
+
var web_dom_collections_iterator = __webpack_require__("ddb0");
|
|
1820
|
+
|
|
1782
1821
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.index-of.js
|
|
1783
1822
|
var es_array_index_of = __webpack_require__("c975");
|
|
1784
1823
|
|
|
@@ -1945,13 +1984,13 @@ var DEFAULT_CHECK_DATA = {
|
|
|
1945
1984
|
var CLOSE_ABNORMAL = 1000; // WebSocket正常关闭code码
|
|
1946
1985
|
|
|
1947
1986
|
function deepClone(source) {
|
|
1948
|
-
if (!source &&
|
|
1987
|
+
if (!source && Object(esm_typeof["a" /* default */])(source) !== 'object') {
|
|
1949
1988
|
throw new Error('error arguments', 'deepClone');
|
|
1950
1989
|
}
|
|
1951
1990
|
|
|
1952
1991
|
var targetObj = source.constructor === Array ? [] : {};
|
|
1953
1992
|
Object.keys(source).forEach(function (keys) {
|
|
1954
|
-
if (source[keys] &&
|
|
1993
|
+
if (source[keys] && Object(esm_typeof["a" /* default */])(source[keys]) === 'object') {
|
|
1955
1994
|
targetObj[keys] = deepClone(source[keys]);
|
|
1956
1995
|
} else {
|
|
1957
1996
|
targetObj[keys] = source[keys];
|
|
@@ -2014,7 +2053,7 @@ var websocket_Socket = /*#__PURE__*/function (_WebSocket) {
|
|
|
2014
2053
|
checkData = options.checkData;
|
|
2015
2054
|
|
|
2016
2055
|
var _queryParams = Object.keys(query).reduce(function (str, key) {
|
|
2017
|
-
if (
|
|
2056
|
+
if (Object(esm_typeof["a" /* default */])(query[key]) !== 'object' && typeof query[key] !== 'function') {
|
|
2018
2057
|
return str += str.length > 0 ? "&".concat(key, "=").concat(query[key]) : "".concat(key, "=").concat(query[key]);
|
|
2019
2058
|
} else {
|
|
2020
2059
|
return str;
|
|
@@ -2158,7 +2197,7 @@ var websocket_Socket = /*#__PURE__*/function (_WebSocket) {
|
|
|
2158
2197
|
|
|
2159
2198
|
this.heartCheckInterval = setInterval(function () {
|
|
2160
2199
|
if (_this4.readyState === _this4.OPEN) {
|
|
2161
|
-
var transformJSON =
|
|
2200
|
+
var transformJSON = Object(esm_typeof["a" /* default */])(_this4.heartCheckData) === 'object';
|
|
2162
2201
|
|
|
2163
2202
|
_this4.sendMessage(_this4.heartCheckData, {
|
|
2164
2203
|
transformJSON: transformJSON
|
|
@@ -2710,6 +2749,44 @@ webpackContext.id = "5180";
|
|
|
2710
2749
|
|
|
2711
2750
|
/***/ }),
|
|
2712
2751
|
|
|
2752
|
+
/***/ "53ca":
|
|
2753
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
2754
|
+
|
|
2755
|
+
"use strict";
|
|
2756
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _typeof; });
|
|
2757
|
+
/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("a4d3");
|
|
2758
|
+
/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
2759
|
+
/* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("e01a");
|
|
2760
|
+
/* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_1__);
|
|
2761
|
+
/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("d3b7");
|
|
2762
|
+
/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_2__);
|
|
2763
|
+
/* harmony import */ var core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("d28b");
|
|
2764
|
+
/* harmony import */ var core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_3__);
|
|
2765
|
+
/* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("e260");
|
|
2766
|
+
/* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_4__);
|
|
2767
|
+
/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("3ca3");
|
|
2768
|
+
/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_5__);
|
|
2769
|
+
/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("ddb0");
|
|
2770
|
+
/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_6__);
|
|
2771
|
+
|
|
2772
|
+
|
|
2773
|
+
|
|
2774
|
+
|
|
2775
|
+
|
|
2776
|
+
|
|
2777
|
+
|
|
2778
|
+
function _typeof(obj) {
|
|
2779
|
+
"@babel/helpers - typeof";
|
|
2780
|
+
|
|
2781
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
2782
|
+
return typeof obj;
|
|
2783
|
+
} : function (obj) {
|
|
2784
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
2785
|
+
}, _typeof(obj);
|
|
2786
|
+
}
|
|
2787
|
+
|
|
2788
|
+
/***/ }),
|
|
2789
|
+
|
|
2713
2790
|
/***/ "5692":
|
|
2714
2791
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2715
2792
|
|
|
@@ -2764,6 +2841,54 @@ module.exports = function (argument) {
|
|
|
2764
2841
|
};
|
|
2765
2842
|
|
|
2766
2843
|
|
|
2844
|
+
/***/ }),
|
|
2845
|
+
|
|
2846
|
+
/***/ "5899":
|
|
2847
|
+
/***/ (function(module, exports) {
|
|
2848
|
+
|
|
2849
|
+
// a string of all valid unicode whitespaces
|
|
2850
|
+
module.exports = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
|
|
2851
|
+
'\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
|
|
2852
|
+
|
|
2853
|
+
|
|
2854
|
+
/***/ }),
|
|
2855
|
+
|
|
2856
|
+
/***/ "58a8":
|
|
2857
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2858
|
+
|
|
2859
|
+
var uncurryThis = __webpack_require__("e330");
|
|
2860
|
+
var requireObjectCoercible = __webpack_require__("1d80");
|
|
2861
|
+
var toString = __webpack_require__("577e");
|
|
2862
|
+
var whitespaces = __webpack_require__("5899");
|
|
2863
|
+
|
|
2864
|
+
var replace = uncurryThis(''.replace);
|
|
2865
|
+
var whitespace = '[' + whitespaces + ']';
|
|
2866
|
+
var ltrim = RegExp('^' + whitespace + whitespace + '*');
|
|
2867
|
+
var rtrim = RegExp(whitespace + whitespace + '*$');
|
|
2868
|
+
|
|
2869
|
+
// `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
|
|
2870
|
+
var createMethod = function (TYPE) {
|
|
2871
|
+
return function ($this) {
|
|
2872
|
+
var string = toString(requireObjectCoercible($this));
|
|
2873
|
+
if (TYPE & 1) string = replace(string, ltrim, '');
|
|
2874
|
+
if (TYPE & 2) string = replace(string, rtrim, '');
|
|
2875
|
+
return string;
|
|
2876
|
+
};
|
|
2877
|
+
};
|
|
2878
|
+
|
|
2879
|
+
module.exports = {
|
|
2880
|
+
// `String.prototype.{ trimLeft, trimStart }` methods
|
|
2881
|
+
// https://tc39.es/ecma262/#sec-string.prototype.trimstart
|
|
2882
|
+
start: createMethod(1),
|
|
2883
|
+
// `String.prototype.{ trimRight, trimEnd }` methods
|
|
2884
|
+
// https://tc39.es/ecma262/#sec-string.prototype.trimend
|
|
2885
|
+
end: createMethod(2),
|
|
2886
|
+
// `String.prototype.trim` method
|
|
2887
|
+
// https://tc39.es/ecma262/#sec-string.prototype.trim
|
|
2888
|
+
trim: createMethod(3)
|
|
2889
|
+
};
|
|
2890
|
+
|
|
2891
|
+
|
|
2767
2892
|
/***/ }),
|
|
2768
2893
|
|
|
2769
2894
|
/***/ "5926":
|
|
@@ -3831,51 +3956,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3831
3956
|
// EXPORTS
|
|
3832
3957
|
__webpack_require__.d(__webpack_exports__, "useHttp", function() { return /* binding */ useHttp; });
|
|
3833
3958
|
|
|
3834
|
-
// EXTERNAL MODULE: ./node_modules/
|
|
3835
|
-
var
|
|
3836
|
-
|
|
3837
|
-
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.promise.js
|
|
3838
|
-
var es_promise = __webpack_require__("e6cf");
|
|
3839
|
-
|
|
3840
|
-
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
3845
|
-
try {
|
|
3846
|
-
var info = gen[key](arg);
|
|
3847
|
-
var value = info.value;
|
|
3848
|
-
} catch (error) {
|
|
3849
|
-
reject(error);
|
|
3850
|
-
return;
|
|
3851
|
-
}
|
|
3852
|
-
|
|
3853
|
-
if (info.done) {
|
|
3854
|
-
resolve(value);
|
|
3855
|
-
} else {
|
|
3856
|
-
Promise.resolve(value).then(_next, _throw);
|
|
3857
|
-
}
|
|
3858
|
-
}
|
|
3859
|
-
|
|
3860
|
-
function _asyncToGenerator(fn) {
|
|
3861
|
-
return function () {
|
|
3862
|
-
var self = this,
|
|
3863
|
-
args = arguments;
|
|
3864
|
-
return new Promise(function (resolve, reject) {
|
|
3865
|
-
var gen = fn.apply(self, args);
|
|
3866
|
-
|
|
3867
|
-
function _next(value) {
|
|
3868
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
3869
|
-
}
|
|
3870
|
-
|
|
3871
|
-
function _throw(err) {
|
|
3872
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
3873
|
-
}
|
|
3959
|
+
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
|
|
3960
|
+
var asyncToGenerator = __webpack_require__("1da1");
|
|
3874
3961
|
|
|
3875
|
-
_next(undefined);
|
|
3876
|
-
});
|
|
3877
|
-
};
|
|
3878
|
-
}
|
|
3879
3962
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.is-array.js
|
|
3880
3963
|
var es_array_is_array = __webpack_require__("277d");
|
|
3881
3964
|
|
|
@@ -3901,6 +3984,9 @@ var es_symbol = __webpack_require__("a4d3");
|
|
|
3901
3984
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.symbol.description.js
|
|
3902
3985
|
var es_symbol_description = __webpack_require__("e01a");
|
|
3903
3986
|
|
|
3987
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.to-string.js
|
|
3988
|
+
var es_object_to_string = __webpack_require__("d3b7");
|
|
3989
|
+
|
|
3904
3990
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.symbol.iterator.js
|
|
3905
3991
|
var es_symbol_iterator = __webpack_require__("d28b");
|
|
3906
3992
|
|
|
@@ -4060,6 +4146,9 @@ var es_array_index_of = __webpack_require__("c975");
|
|
|
4060
4146
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.concat.js
|
|
4061
4147
|
var es_array_concat = __webpack_require__("99af");
|
|
4062
4148
|
|
|
4149
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.promise.js
|
|
4150
|
+
var es_promise = __webpack_require__("e6cf");
|
|
4151
|
+
|
|
4063
4152
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.weak-map.js
|
|
4064
4153
|
var es_weak_map = __webpack_require__("10d1");
|
|
4065
4154
|
|
|
@@ -4148,7 +4237,7 @@ var http_httpWay = /*#__PURE__*/function () {
|
|
|
4148
4237
|
Object(createClass["a" /* default */])(httpWay, [{
|
|
4149
4238
|
key: "initAsync",
|
|
4150
4239
|
value: function () {
|
|
4151
|
-
var _initAsync =
|
|
4240
|
+
var _initAsync = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee(params, success, fail) {
|
|
4152
4241
|
var response, text;
|
|
4153
4242
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
4154
4243
|
while (1) {
|
|
@@ -5966,6 +6055,102 @@ module.exports = function (METHOD_NAME, argument) {
|
|
|
5966
6055
|
};
|
|
5967
6056
|
|
|
5968
6057
|
|
|
6058
|
+
/***/ }),
|
|
6059
|
+
|
|
6060
|
+
/***/ "a9e3":
|
|
6061
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
6062
|
+
|
|
6063
|
+
"use strict";
|
|
6064
|
+
|
|
6065
|
+
var DESCRIPTORS = __webpack_require__("83ab");
|
|
6066
|
+
var global = __webpack_require__("da84");
|
|
6067
|
+
var uncurryThis = __webpack_require__("e330");
|
|
6068
|
+
var isForced = __webpack_require__("94ca");
|
|
6069
|
+
var redefine = __webpack_require__("6eeb");
|
|
6070
|
+
var hasOwn = __webpack_require__("1a2d");
|
|
6071
|
+
var inheritIfRequired = __webpack_require__("7156");
|
|
6072
|
+
var isPrototypeOf = __webpack_require__("3a9b");
|
|
6073
|
+
var isSymbol = __webpack_require__("d9b5");
|
|
6074
|
+
var toPrimitive = __webpack_require__("c04e");
|
|
6075
|
+
var fails = __webpack_require__("d039");
|
|
6076
|
+
var getOwnPropertyNames = __webpack_require__("241c").f;
|
|
6077
|
+
var getOwnPropertyDescriptor = __webpack_require__("06cf").f;
|
|
6078
|
+
var defineProperty = __webpack_require__("9bf2").f;
|
|
6079
|
+
var thisNumberValue = __webpack_require__("408a");
|
|
6080
|
+
var trim = __webpack_require__("58a8").trim;
|
|
6081
|
+
|
|
6082
|
+
var NUMBER = 'Number';
|
|
6083
|
+
var NativeNumber = global[NUMBER];
|
|
6084
|
+
var NumberPrototype = NativeNumber.prototype;
|
|
6085
|
+
var TypeError = global.TypeError;
|
|
6086
|
+
var arraySlice = uncurryThis(''.slice);
|
|
6087
|
+
var charCodeAt = uncurryThis(''.charCodeAt);
|
|
6088
|
+
|
|
6089
|
+
// `ToNumeric` abstract operation
|
|
6090
|
+
// https://tc39.es/ecma262/#sec-tonumeric
|
|
6091
|
+
var toNumeric = function (value) {
|
|
6092
|
+
var primValue = toPrimitive(value, 'number');
|
|
6093
|
+
return typeof primValue == 'bigint' ? primValue : toNumber(primValue);
|
|
6094
|
+
};
|
|
6095
|
+
|
|
6096
|
+
// `ToNumber` abstract operation
|
|
6097
|
+
// https://tc39.es/ecma262/#sec-tonumber
|
|
6098
|
+
var toNumber = function (argument) {
|
|
6099
|
+
var it = toPrimitive(argument, 'number');
|
|
6100
|
+
var first, third, radix, maxCode, digits, length, index, code;
|
|
6101
|
+
if (isSymbol(it)) throw TypeError('Cannot convert a Symbol value to a number');
|
|
6102
|
+
if (typeof it == 'string' && it.length > 2) {
|
|
6103
|
+
it = trim(it);
|
|
6104
|
+
first = charCodeAt(it, 0);
|
|
6105
|
+
if (first === 43 || first === 45) {
|
|
6106
|
+
third = charCodeAt(it, 2);
|
|
6107
|
+
if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix
|
|
6108
|
+
} else if (first === 48) {
|
|
6109
|
+
switch (charCodeAt(it, 1)) {
|
|
6110
|
+
case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i
|
|
6111
|
+
case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i
|
|
6112
|
+
default: return +it;
|
|
6113
|
+
}
|
|
6114
|
+
digits = arraySlice(it, 2);
|
|
6115
|
+
length = digits.length;
|
|
6116
|
+
for (index = 0; index < length; index++) {
|
|
6117
|
+
code = charCodeAt(digits, index);
|
|
6118
|
+
// parseInt parses a string to a first unavailable symbol
|
|
6119
|
+
// but ToNumber should return NaN if a string contains unavailable symbols
|
|
6120
|
+
if (code < 48 || code > maxCode) return NaN;
|
|
6121
|
+
} return parseInt(digits, radix);
|
|
6122
|
+
}
|
|
6123
|
+
} return +it;
|
|
6124
|
+
};
|
|
6125
|
+
|
|
6126
|
+
// `Number` constructor
|
|
6127
|
+
// https://tc39.es/ecma262/#sec-number-constructor
|
|
6128
|
+
if (isForced(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) {
|
|
6129
|
+
var NumberWrapper = function Number(value) {
|
|
6130
|
+
var n = arguments.length < 1 ? 0 : NativeNumber(toNumeric(value));
|
|
6131
|
+
var dummy = this;
|
|
6132
|
+
// check on 1..constructor(foo) case
|
|
6133
|
+
return isPrototypeOf(NumberPrototype, dummy) && fails(function () { thisNumberValue(dummy); })
|
|
6134
|
+
? inheritIfRequired(Object(n), dummy, NumberWrapper) : n;
|
|
6135
|
+
};
|
|
6136
|
+
for (var keys = DESCRIPTORS ? getOwnPropertyNames(NativeNumber) : (
|
|
6137
|
+
// ES3:
|
|
6138
|
+
'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
|
|
6139
|
+
// ES2015 (in case, if modules with ES2015 Number statics required before):
|
|
6140
|
+
'EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,' +
|
|
6141
|
+
// ESNext
|
|
6142
|
+
'fromString,range'
|
|
6143
|
+
).split(','), j = 0, key; keys.length > j; j++) {
|
|
6144
|
+
if (hasOwn(NativeNumber, key = keys[j]) && !hasOwn(NumberWrapper, key)) {
|
|
6145
|
+
defineProperty(NumberWrapper, key, getOwnPropertyDescriptor(NativeNumber, key));
|
|
6146
|
+
}
|
|
6147
|
+
}
|
|
6148
|
+
NumberWrapper.prototype = NumberPrototype;
|
|
6149
|
+
NumberPrototype.constructor = NumberWrapper;
|
|
6150
|
+
redefine(global, NUMBER, NumberWrapper);
|
|
6151
|
+
}
|
|
6152
|
+
|
|
6153
|
+
|
|
5969
6154
|
/***/ }),
|
|
5970
6155
|
|
|
5971
6156
|
/***/ "aa1f":
|
|
@@ -8763,17 +8948,37 @@ var modulesFiles = mf.keys().reduce(function (pre, cur) {
|
|
|
8763
8948
|
console.log("=====modulesFiles========");
|
|
8764
8949
|
console.log(modulesFiles);
|
|
8765
8950
|
/* harmony default export */ var webApi = (modulesFiles);
|
|
8766
|
-
//
|
|
8951
|
+
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
|
|
8952
|
+
var asyncToGenerator = __webpack_require__("1da1");
|
|
8767
8953
|
|
|
8954
|
+
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
8955
|
+
var esm_typeof = __webpack_require__("53ca");
|
|
8768
8956
|
|
|
8957
|
+
// EXTERNAL MODULE: ./node_modules/regenerator-runtime/runtime.js
|
|
8958
|
+
var runtime = __webpack_require__("96cf");
|
|
8769
8959
|
|
|
8960
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.define-property.js
|
|
8961
|
+
var es_object_define_property = __webpack_require__("7a82");
|
|
8770
8962
|
|
|
8963
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.promise.js
|
|
8964
|
+
var es_promise = __webpack_require__("e6cf");
|
|
8771
8965
|
|
|
8966
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.number.constructor.js
|
|
8967
|
+
var es_number_constructor = __webpack_require__("a9e3");
|
|
8772
8968
|
|
|
8969
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/web.timers.js
|
|
8970
|
+
var web_timers = __webpack_require__("4795");
|
|
8773
8971
|
|
|
8972
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.index-of.js
|
|
8973
|
+
var es_array_index_of = __webpack_require__("c975");
|
|
8774
8974
|
|
|
8975
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.regexp.test.js
|
|
8976
|
+
var es_regexp_test = __webpack_require__("00b4");
|
|
8775
8977
|
|
|
8978
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.is-array.js
|
|
8979
|
+
var es_array_is_array = __webpack_require__("277d");
|
|
8776
8980
|
|
|
8981
|
+
// CONCATENATED MODULE: ./src/lib/phoneClient/index.mjs
|
|
8777
8982
|
|
|
8778
8983
|
|
|
8779
8984
|
|
|
@@ -8782,29 +8987,1100 @@ console.log(modulesFiles);
|
|
|
8782
8987
|
|
|
8783
8988
|
|
|
8784
8989
|
|
|
8785
|
-
/**
|
|
8786
|
-
* 接口请求通用方法
|
|
8787
|
-
* @param {*} url
|
|
8788
|
-
* @param {*} param
|
|
8789
|
-
* @param {*} backSuccfn
|
|
8790
|
-
* @param {*} async
|
|
8791
|
-
* @param {*} method
|
|
8792
|
-
*/
|
|
8793
8990
|
|
|
8794
|
-
var common_request_useRequest = function useRequest(type) {
|
|
8795
|
-
console.log(webApi);
|
|
8796
|
-
var requestObj = webApi[type];
|
|
8797
|
-
console.log(requestObj);
|
|
8798
|
-
if (!requestObj) throw new Error('未找到对应的请求方法!');
|
|
8799
|
-
return function () {
|
|
8800
|
-
return requestObj.apply(void 0, arguments);
|
|
8801
|
-
};
|
|
8802
|
-
};
|
|
8803
8991
|
|
|
8804
|
-
|
|
8805
|
-
|
|
8806
|
-
|
|
8807
|
-
|
|
8992
|
+
|
|
8993
|
+
|
|
8994
|
+
|
|
8995
|
+
|
|
8996
|
+
|
|
8997
|
+
|
|
8998
|
+
|
|
8999
|
+
|
|
9000
|
+
|
|
9001
|
+
|
|
9002
|
+
var T = Object.defineProperty;
|
|
9003
|
+
|
|
9004
|
+
var w = function w(d, e, t) {
|
|
9005
|
+
return e in d ? T(d, e, {
|
|
9006
|
+
enumerable: !0,
|
|
9007
|
+
configurable: !0,
|
|
9008
|
+
writable: !0,
|
|
9009
|
+
value: t
|
|
9010
|
+
}) : d[e] = t;
|
|
9011
|
+
};
|
|
9012
|
+
|
|
9013
|
+
var phoneClient_b = function b(d, e, t) {
|
|
9014
|
+
return w(d, Object(esm_typeof["a" /* default */])(e) != "symbol" ? e + "" : e, t), t;
|
|
9015
|
+
};
|
|
9016
|
+
|
|
9017
|
+
var phoneClient_j = /*#__PURE__*/function () {
|
|
9018
|
+
function j(e) {
|
|
9019
|
+
var _this = this;
|
|
9020
|
+
|
|
9021
|
+
Object(classCallCheck["a" /* default */])(this, j);
|
|
9022
|
+
|
|
9023
|
+
phoneClient_b(this, "socket", null);
|
|
9024
|
+
phoneClient_b(this, "RTC", null);
|
|
9025
|
+
phoneClient_b(this, "bindLocalPicture", function (e) {
|
|
9026
|
+
var t = document.querySelector("#" + _this.localId);
|
|
9027
|
+
t.srcObject = e, t.onloadedmetadata = function () {
|
|
9028
|
+
t.play();
|
|
9029
|
+
};
|
|
9030
|
+
});
|
|
9031
|
+
this.wsUrl = e, this.Offer = null, this.localId = "", this.remoteId = "", this.remoteAudioId = "", this.videoStream = null, this.timeOutKL = null, this.reloadObj = {
|
|
9032
|
+
num: 0,
|
|
9033
|
+
maxNum: 10,
|
|
9034
|
+
timeOut: null,
|
|
9035
|
+
reloadTime: 5e3,
|
|
9036
|
+
href: ""
|
|
9037
|
+
}, this.mediaSet = {
|
|
9038
|
+
video: !0,
|
|
9039
|
+
audio: !0
|
|
9040
|
+
}, this.callData = {}, this.socketCode = -1, this.compatible(), this.createRTC(), this.newSocket();
|
|
9041
|
+
}
|
|
9042
|
+
|
|
9043
|
+
Object(createClass["a" /* default */])(j, [{
|
|
9044
|
+
key: "compatible",
|
|
9045
|
+
value: function compatible() {
|
|
9046
|
+
window.RTCPeerConnection = window.RTCPeerConnection || window.webkitRTCPeerConnection || window.mozRTCPeerConnection || window.msRTCPeerConnection, navigator.mediaDevices.getUserMedia === void 0 && (navigator.mediaDevices.getUserMedia = function (e) {
|
|
9047
|
+
var t = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia || navigator.oGetUserMedia;
|
|
9048
|
+
return t ? new Promise(function (o, i) {
|
|
9049
|
+
t.call(navigator, e, o, i);
|
|
9050
|
+
}) : Promise.reject(new Error("getUserMedia is not implemented in this browser"));
|
|
9051
|
+
}());
|
|
9052
|
+
}
|
|
9053
|
+
}, {
|
|
9054
|
+
key: "newSocket",
|
|
9055
|
+
value: function newSocket() {
|
|
9056
|
+
if (this.socket && (console.log(this.socket), this.socket = null), !this.online()) {
|
|
9057
|
+
console.log("当前网络差,无法连接");
|
|
9058
|
+
return;
|
|
9059
|
+
}
|
|
9060
|
+
|
|
9061
|
+
if (this.wsUrl) this.socket = new WebSocket(this.wsUrl), this.initSocekt();else throw new Error("前端提示:WebSocket缺少baseURL!");
|
|
9062
|
+
}
|
|
9063
|
+
}, {
|
|
9064
|
+
key: "initSocekt",
|
|
9065
|
+
value: function initSocekt() {
|
|
9066
|
+
this.open(), this.message(), this.error(), this.close(), this.disconnect();
|
|
9067
|
+
}
|
|
9068
|
+
}, {
|
|
9069
|
+
key: "online",
|
|
9070
|
+
value: function online() {
|
|
9071
|
+
var e = !0;
|
|
9072
|
+
return navigator.onLine ? e = !0 : e = !1, e;
|
|
9073
|
+
}
|
|
9074
|
+
}, {
|
|
9075
|
+
key: "onbeforeunload",
|
|
9076
|
+
value: function onbeforeunload() {
|
|
9077
|
+
console.log("页面关闭");
|
|
9078
|
+
}
|
|
9079
|
+
}, {
|
|
9080
|
+
key: "onunload",
|
|
9081
|
+
value: function onunload() {
|
|
9082
|
+
console.log("页面刷新");
|
|
9083
|
+
}
|
|
9084
|
+
}, {
|
|
9085
|
+
key: "checkReadyState",
|
|
9086
|
+
value: function checkReadyState() {
|
|
9087
|
+
return Number(this.socket.readyState);
|
|
9088
|
+
}
|
|
9089
|
+
}, {
|
|
9090
|
+
key: "open",
|
|
9091
|
+
value: function open() {
|
|
9092
|
+
var _this2 = this;
|
|
9093
|
+
|
|
9094
|
+
var e = this;
|
|
9095
|
+
|
|
9096
|
+
this.socket.onopen = function (t) {
|
|
9097
|
+
console.log("onopen--->", t);
|
|
9098
|
+
|
|
9099
|
+
var o = _this2.checkReadyState();
|
|
9100
|
+
|
|
9101
|
+
e.socketCode = o;
|
|
9102
|
+
var i = "";
|
|
9103
|
+
|
|
9104
|
+
switch (Number(o)) {
|
|
9105
|
+
case 1:
|
|
9106
|
+
console.log("连接成功"), i = "socket连接成功_" + t.type, e.num = 0, e.keepLive();
|
|
9107
|
+
break;
|
|
9108
|
+
|
|
9109
|
+
case 2:
|
|
9110
|
+
console.log("连接正在关闭"), i = "socket连接正在关闭_" + t.type;
|
|
9111
|
+
break;
|
|
9112
|
+
|
|
9113
|
+
case 3:
|
|
9114
|
+
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 () {
|
|
9115
|
+
e.close();
|
|
9116
|
+
}, e.reloadObj.reloadTime)) : console.log("继续连接");
|
|
9117
|
+
break;
|
|
9118
|
+
}
|
|
9119
|
+
|
|
9120
|
+
e.messageBack && (o == 1 ? e.messageBack.call(null, {
|
|
9121
|
+
type: t.type,
|
|
9122
|
+
code: 200,
|
|
9123
|
+
message: i
|
|
9124
|
+
}) : e.messageBack.call(null, {
|
|
9125
|
+
type: t.type,
|
|
9126
|
+
code: -1,
|
|
9127
|
+
err: i
|
|
9128
|
+
}));
|
|
9129
|
+
};
|
|
9130
|
+
}
|
|
9131
|
+
}, {
|
|
9132
|
+
key: "keepLive",
|
|
9133
|
+
value: function keepLive() {
|
|
9134
|
+
var e = this;
|
|
9135
|
+
this.timeOutKL && clearTimeout(this.timeOutKL), this.timeOutKL = setTimeout(function () {
|
|
9136
|
+
e.send({
|
|
9137
|
+
type: "keepAlive"
|
|
9138
|
+
});
|
|
9139
|
+
}, (e.keepLiveTime ? e.keepLiveTime : 30) * 1e3);
|
|
9140
|
+
}
|
|
9141
|
+
}, {
|
|
9142
|
+
key: "message",
|
|
9143
|
+
value: function message() {
|
|
9144
|
+
var _this3 = this;
|
|
9145
|
+
|
|
9146
|
+
var e = this;
|
|
9147
|
+
|
|
9148
|
+
this.socket.onmessage = function (t) {
|
|
9149
|
+
var o = t.data,
|
|
9150
|
+
i = {};
|
|
9151
|
+
|
|
9152
|
+
if (o) {
|
|
9153
|
+
var s = JSON.parse(o),
|
|
9154
|
+
l = "";
|
|
9155
|
+
|
|
9156
|
+
switch (s.type) {
|
|
9157
|
+
case "login":
|
|
9158
|
+
l = "登录成功";
|
|
9159
|
+
break;
|
|
9160
|
+
|
|
9161
|
+
case "on_answer":
|
|
9162
|
+
l = "已接听", e.setRemote(s.sdp);
|
|
9163
|
+
break;
|
|
9164
|
+
|
|
9165
|
+
case "on_new_call":
|
|
9166
|
+
l = "有来电呼叫", i = {
|
|
9167
|
+
isvideo: s.isvideo,
|
|
9168
|
+
fromtel: s.from || ""
|
|
9169
|
+
};
|
|
9170
|
+
break;
|
|
9171
|
+
|
|
9172
|
+
case "on_ack":
|
|
9173
|
+
l = "来电接听成功", e.setRemote(s.sdp);
|
|
9174
|
+
break;
|
|
9175
|
+
|
|
9176
|
+
case "on_hangup":
|
|
9177
|
+
l = "已挂断", _this3.RTC.close(), _this3.RTC = null;
|
|
9178
|
+
var a = document.querySelector("#" + e.remoteId);
|
|
9179
|
+
a.srcObject = null, e.messageBack.call(null, s), e.getVideoTacks(), _this3.createRTC();
|
|
9180
|
+
break;
|
|
9181
|
+
|
|
9182
|
+
case "keepAlive":
|
|
9183
|
+
_this3.keepLive();
|
|
9184
|
+
|
|
9185
|
+
break;
|
|
9186
|
+
}
|
|
9187
|
+
|
|
9188
|
+
s.result ? (console.log("dataObj-->", s), e.messageBack.call(null, {
|
|
9189
|
+
code: 200,
|
|
9190
|
+
type: s.type,
|
|
9191
|
+
message: l,
|
|
9192
|
+
data: i
|
|
9193
|
+
})) : e.messageBack.call(null, {
|
|
9194
|
+
code: -1,
|
|
9195
|
+
type: s.type,
|
|
9196
|
+
err: "失败_" + s.reason || false
|
|
9197
|
+
});
|
|
9198
|
+
} else console.log("服务器无返回数据--");
|
|
9199
|
+
};
|
|
9200
|
+
} // 用于指定报错时的回调函数。
|
|
9201
|
+
|
|
9202
|
+
}, {
|
|
9203
|
+
key: "reloadSockte",
|
|
9204
|
+
value: function reloadSockte() {
|
|
9205
|
+
var e = this;
|
|
9206
|
+
this.reloadObj.num = this.reloadObj.num + 1, e.reloadObj.timeOut && clearTimeout(e.reloadObj.timeOut), this.reloadObj.num >= this.reloadObj.maxNum ? (e.reloadObj.href && (window.location.href = e.reloadObj.href), e.messageBack.call(null, {
|
|
9207
|
+
code: -1,
|
|
9208
|
+
type: "error",
|
|
9209
|
+
err: "重连已达到" + this.reloadObj.maxNum + "次,请刷新后重试"
|
|
9210
|
+
})) : e.reloadObj.timeOut = setTimeout(function () {
|
|
9211
|
+
e.newSocket();
|
|
9212
|
+
}, e.reloadObj.reloadTime);
|
|
9213
|
+
}
|
|
9214
|
+
}, {
|
|
9215
|
+
key: "error",
|
|
9216
|
+
value: function error() {
|
|
9217
|
+
var e = this;
|
|
9218
|
+
|
|
9219
|
+
this.socket.onerror = function (t) {
|
|
9220
|
+
var o = {
|
|
9221
|
+
type: t.type,
|
|
9222
|
+
code: -4,
|
|
9223
|
+
err: "socket连接错误_" + t.type // message:'连接_'+event.type,
|
|
9224
|
+
|
|
9225
|
+
};
|
|
9226
|
+
e.messageBack.call(null, o);
|
|
9227
|
+
};
|
|
9228
|
+
}
|
|
9229
|
+
}, {
|
|
9230
|
+
key: "close",
|
|
9231
|
+
value: function close() {
|
|
9232
|
+
var _this4 = this;
|
|
9233
|
+
|
|
9234
|
+
var e = this;
|
|
9235
|
+
|
|
9236
|
+
this.socket.onclose = function (t) {
|
|
9237
|
+
console.log("close--->", t);
|
|
9238
|
+
var o = {
|
|
9239
|
+
type: t.type,
|
|
9240
|
+
code: -1,
|
|
9241
|
+
err: "socket连接已关闭_" + t.type // message:'连接已关闭',
|
|
9242
|
+
|
|
9243
|
+
};
|
|
9244
|
+
clearTimeout(_this4.reloadObj.timeOut), e.messageBack.call(null, o);
|
|
9245
|
+
};
|
|
9246
|
+
}
|
|
9247
|
+
}, {
|
|
9248
|
+
key: "setSocketReloadConfig",
|
|
9249
|
+
value: function setSocketReloadConfig(e) {
|
|
9250
|
+
this.reloadObj = Object.assign(this.reloadObj, e || {});
|
|
9251
|
+
} //socket连接断开
|
|
9252
|
+
|
|
9253
|
+
}, {
|
|
9254
|
+
key: "disconnect",
|
|
9255
|
+
value: function disconnect() {
|
|
9256
|
+
var e = this;
|
|
9257
|
+
|
|
9258
|
+
this.socket.disconnect = function (t) {
|
|
9259
|
+
console.log("disconnect", t), e.socketCode = 5;
|
|
9260
|
+
var o = {
|
|
9261
|
+
type: t.type,
|
|
9262
|
+
code: -1,
|
|
9263
|
+
err: "连接已断开_" + t.type
|
|
9264
|
+
};
|
|
9265
|
+
e.messageBack.call(null, o);
|
|
9266
|
+
};
|
|
9267
|
+
}
|
|
9268
|
+
}, {
|
|
9269
|
+
key: "onclose",
|
|
9270
|
+
value: function onclose() {
|
|
9271
|
+
this.socket.close();
|
|
9272
|
+
} //发送消息
|
|
9273
|
+
|
|
9274
|
+
}, {
|
|
9275
|
+
key: "send",
|
|
9276
|
+
value: function send(e) {
|
|
9277
|
+
var t = e;
|
|
9278
|
+
|
|
9279
|
+
if (!this.online()) {
|
|
9280
|
+
this.messageBack.call(null, {
|
|
9281
|
+
code: -2,
|
|
9282
|
+
type: "internet",
|
|
9283
|
+
err: "当前网络差,请检查网络后重试"
|
|
9284
|
+
});
|
|
9285
|
+
return;
|
|
9286
|
+
}
|
|
9287
|
+
|
|
9288
|
+
console.log("checkReadyState--->", this.checkReadyState());
|
|
9289
|
+
var o = this.checkReadyState();
|
|
9290
|
+
o == 1 ? this.socket.send(JSON.stringify(t)) : this.messageBack.call(null, {
|
|
9291
|
+
code: -3,
|
|
9292
|
+
type: "error",
|
|
9293
|
+
err: "连接异常_" + o
|
|
9294
|
+
});
|
|
9295
|
+
}
|
|
9296
|
+
}, {
|
|
9297
|
+
key: "createRTC",
|
|
9298
|
+
value: function createRTC(e) {
|
|
9299
|
+
var t = this,
|
|
9300
|
+
o = {// iceServers: [
|
|
9301
|
+
// {
|
|
9302
|
+
// urls: ['turn:115.28.186.199:3478'],
|
|
9303
|
+
// username: "user1",
|
|
9304
|
+
// credential: "wex12345"
|
|
9305
|
+
// },
|
|
9306
|
+
// {
|
|
9307
|
+
// urls: ['stun:115.28.186.199:3478'],
|
|
9308
|
+
// username: "user1",
|
|
9309
|
+
// credential: "wex12345"
|
|
9310
|
+
// }
|
|
9311
|
+
// ],
|
|
9312
|
+
};
|
|
9313
|
+
this.RTC && (this.RTC = null), this.RTC = new RTCPeerConnection(e || o), this.RTC.onicecandidate = function (i) {
|
|
9314
|
+
console.log("onicecandidate--->", i);
|
|
9315
|
+
}, this.RTC.ontrack = function (i) {
|
|
9316
|
+
var s = document.querySelector("#" + t.remoteId),
|
|
9317
|
+
l = document.querySelector("#" + t.remoteAudioId),
|
|
9318
|
+
a = i.track;
|
|
9319
|
+
|
|
9320
|
+
if (a.kind == "video") {
|
|
9321
|
+
var c = new MediaStream();
|
|
9322
|
+
c.addTrack(a), s.srcObject = c, s.onloadedmetadata = function () {
|
|
9323
|
+
console.log("remoteVideo-onloadedmetadata->"), s.play();
|
|
9324
|
+
};
|
|
9325
|
+
} else {
|
|
9326
|
+
var _c = new MediaStream();
|
|
9327
|
+
|
|
9328
|
+
_c.addTrack(i.track), l.srcObject = _c, l.onloadedmetadata = function () {
|
|
9329
|
+
console.log("remoteAudio-onloadedmetadata->"), l.play();
|
|
9330
|
+
};
|
|
9331
|
+
}
|
|
9332
|
+
}, this.RTC.onnegotiationneeded = function (i) {
|
|
9333
|
+
console.log("onnegotiationneeded--->", i);
|
|
9334
|
+
}, this.RTC.iceconnectionstatechange = function (i) {};
|
|
9335
|
+
}
|
|
9336
|
+
}, {
|
|
9337
|
+
key: "addTracks",
|
|
9338
|
+
value: function addTracks(e) {
|
|
9339
|
+
var t = this,
|
|
9340
|
+
o = e.getTracks();
|
|
9341
|
+
|
|
9342
|
+
if (!o || o.length < 1) {
|
|
9343
|
+
console.log("无法获取视频或麦克风任一轨道数据,请查看是否开启成功");
|
|
9344
|
+
return;
|
|
9345
|
+
}
|
|
9346
|
+
|
|
9347
|
+
o.forEach(function (i) {
|
|
9348
|
+
console.log("track-->", i), t.RTC.addTrack(i, e);
|
|
9349
|
+
});
|
|
9350
|
+
}
|
|
9351
|
+
}, {
|
|
9352
|
+
key: "createOffer",
|
|
9353
|
+
value: function () {
|
|
9354
|
+
var _createOffer = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
9355
|
+
var e;
|
|
9356
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
9357
|
+
while (1) {
|
|
9358
|
+
switch (_context.prev = _context.next) {
|
|
9359
|
+
case 0:
|
|
9360
|
+
_context.next = 2;
|
|
9361
|
+
return this.RTC.createOffer();
|
|
9362
|
+
|
|
9363
|
+
case 2:
|
|
9364
|
+
e = _context.sent;
|
|
9365
|
+
this.Offer = e;
|
|
9366
|
+
_context.next = 6;
|
|
9367
|
+
return this.RTC.setLocalDescription(e);
|
|
9368
|
+
|
|
9369
|
+
case 6:
|
|
9370
|
+
case "end":
|
|
9371
|
+
return _context.stop();
|
|
9372
|
+
}
|
|
9373
|
+
}
|
|
9374
|
+
}, _callee, this);
|
|
9375
|
+
}));
|
|
9376
|
+
|
|
9377
|
+
function createOffer() {
|
|
9378
|
+
return _createOffer.apply(this, arguments);
|
|
9379
|
+
}
|
|
9380
|
+
|
|
9381
|
+
return createOffer;
|
|
9382
|
+
}()
|
|
9383
|
+
}, {
|
|
9384
|
+
key: "setRemote",
|
|
9385
|
+
value: function () {
|
|
9386
|
+
var _setRemote = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(e) {
|
|
9387
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
9388
|
+
while (1) {
|
|
9389
|
+
switch (_context2.prev = _context2.next) {
|
|
9390
|
+
case 0:
|
|
9391
|
+
this.RTC.setRemoteDescription(new RTCSessionDescription({
|
|
9392
|
+
type: "answer",
|
|
9393
|
+
sdp: e
|
|
9394
|
+
}), function (t) {
|
|
9395
|
+
console.log("setsuccess--->", t);
|
|
9396
|
+
}, function (t) {
|
|
9397
|
+
console.log("seterr--->", t);
|
|
9398
|
+
});
|
|
9399
|
+
|
|
9400
|
+
case 1:
|
|
9401
|
+
case "end":
|
|
9402
|
+
return _context2.stop();
|
|
9403
|
+
}
|
|
9404
|
+
}
|
|
9405
|
+
}, _callee2, this);
|
|
9406
|
+
}));
|
|
9407
|
+
|
|
9408
|
+
function setRemote(_x) {
|
|
9409
|
+
return _setRemote.apply(this, arguments);
|
|
9410
|
+
}
|
|
9411
|
+
|
|
9412
|
+
return setRemote;
|
|
9413
|
+
}()
|
|
9414
|
+
}, {
|
|
9415
|
+
key: "getDeviceList",
|
|
9416
|
+
value: function () {
|
|
9417
|
+
var _getDeviceList = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(e) {
|
|
9418
|
+
var t, o;
|
|
9419
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
9420
|
+
while (1) {
|
|
9421
|
+
switch (_context3.prev = _context3.next) {
|
|
9422
|
+
case 0:
|
|
9423
|
+
_context3.next = 2;
|
|
9424
|
+
return navigator.mediaDevices.enumerateDevices();
|
|
9425
|
+
|
|
9426
|
+
case 2:
|
|
9427
|
+
t = _context3.sent;
|
|
9428
|
+
|
|
9429
|
+
if (e) {
|
|
9430
|
+
_context3.next = 5;
|
|
9431
|
+
break;
|
|
9432
|
+
}
|
|
9433
|
+
|
|
9434
|
+
return _context3.abrupt("return", t);
|
|
9435
|
+
|
|
9436
|
+
case 5:
|
|
9437
|
+
o = [];
|
|
9438
|
+
return _context3.abrupt("return", (t && t.length > 0 && t.forEach(function (i) {
|
|
9439
|
+
i.kind.indexOf(e) > -1 && o.push(i);
|
|
9440
|
+
}), o));
|
|
9441
|
+
|
|
9442
|
+
case 7:
|
|
9443
|
+
case "end":
|
|
9444
|
+
return _context3.stop();
|
|
9445
|
+
}
|
|
9446
|
+
}
|
|
9447
|
+
}, _callee3);
|
|
9448
|
+
}));
|
|
9449
|
+
|
|
9450
|
+
function getDeviceList(_x2) {
|
|
9451
|
+
return _getDeviceList.apply(this, arguments);
|
|
9452
|
+
}
|
|
9453
|
+
|
|
9454
|
+
return getDeviceList;
|
|
9455
|
+
}()
|
|
9456
|
+
}, {
|
|
9457
|
+
key: "getUserMedia",
|
|
9458
|
+
value: function () {
|
|
9459
|
+
var _getUserMedia = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(e) {
|
|
9460
|
+
var t, o;
|
|
9461
|
+
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
9462
|
+
while (1) {
|
|
9463
|
+
switch (_context4.prev = _context4.next) {
|
|
9464
|
+
case 0:
|
|
9465
|
+
t = {
|
|
9466
|
+
video: !0,
|
|
9467
|
+
//videoConstraints,
|
|
9468
|
+
audio: {
|
|
9469
|
+
noiseSuppression: !0,
|
|
9470
|
+
echoCancellation: !0
|
|
9471
|
+
}
|
|
9472
|
+
};
|
|
9473
|
+
_context4.next = 3;
|
|
9474
|
+
return navigator.mediaDevices.getUserMedia(e || t);
|
|
9475
|
+
|
|
9476
|
+
case 3:
|
|
9477
|
+
o = _context4.sent;
|
|
9478
|
+
this.videoStream = o;
|
|
9479
|
+
_context4.next = 7;
|
|
9480
|
+
return this.addTracks(o);
|
|
9481
|
+
|
|
9482
|
+
case 7:
|
|
9483
|
+
return _context4.abrupt("return", o);
|
|
9484
|
+
|
|
9485
|
+
case 8:
|
|
9486
|
+
case "end":
|
|
9487
|
+
return _context4.stop();
|
|
9488
|
+
}
|
|
9489
|
+
}
|
|
9490
|
+
}, _callee4, this);
|
|
9491
|
+
}));
|
|
9492
|
+
|
|
9493
|
+
function getUserMedia(_x3) {
|
|
9494
|
+
return _getUserMedia.apply(this, arguments);
|
|
9495
|
+
}
|
|
9496
|
+
|
|
9497
|
+
return getUserMedia;
|
|
9498
|
+
}()
|
|
9499
|
+
}, {
|
|
9500
|
+
key: "getVideoTacks",
|
|
9501
|
+
value: function () {
|
|
9502
|
+
var _getVideoTacks = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
|
|
9503
|
+
var t;
|
|
9504
|
+
return regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
9505
|
+
while (1) {
|
|
9506
|
+
switch (_context5.prev = _context5.next) {
|
|
9507
|
+
case 0:
|
|
9508
|
+
if (this.videoStream) {
|
|
9509
|
+
this.videoStream.getTracks().forEach(function (o) {
|
|
9510
|
+
o.stop();
|
|
9511
|
+
});
|
|
9512
|
+
t = document.querySelector("#" + this.localId);
|
|
9513
|
+
t.srcObject = null;
|
|
9514
|
+
}
|
|
9515
|
+
|
|
9516
|
+
case 1:
|
|
9517
|
+
case "end":
|
|
9518
|
+
return _context5.stop();
|
|
9519
|
+
}
|
|
9520
|
+
}
|
|
9521
|
+
}, _callee5, this);
|
|
9522
|
+
}));
|
|
9523
|
+
|
|
9524
|
+
function getVideoTacks() {
|
|
9525
|
+
return _getVideoTacks.apply(this, arguments);
|
|
9526
|
+
}
|
|
9527
|
+
|
|
9528
|
+
return getVideoTacks;
|
|
9529
|
+
}()
|
|
9530
|
+
/**
|
|
9531
|
+
* 初始化 dome 配置和方法
|
|
9532
|
+
* video 开启视频
|
|
9533
|
+
* audio 开启音频
|
|
9534
|
+
* callback 贯穿整个线的消息回调
|
|
9535
|
+
* @param {*} data
|
|
9536
|
+
*/
|
|
9537
|
+
|
|
9538
|
+
}, {
|
|
9539
|
+
key: "initDom",
|
|
9540
|
+
value: function () {
|
|
9541
|
+
var _initDom = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() {
|
|
9542
|
+
var e,
|
|
9543
|
+
t,
|
|
9544
|
+
o,
|
|
9545
|
+
i,
|
|
9546
|
+
s,
|
|
9547
|
+
_args6 = arguments;
|
|
9548
|
+
return regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
9549
|
+
while (1) {
|
|
9550
|
+
switch (_context6.prev = _context6.next) {
|
|
9551
|
+
case 0:
|
|
9552
|
+
e = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {
|
|
9553
|
+
video: !0,
|
|
9554
|
+
audio: !0,
|
|
9555
|
+
parentId: "",
|
|
9556
|
+
isDrag: !0,
|
|
9557
|
+
showLocal: !0,
|
|
9558
|
+
callback: new Function()
|
|
9559
|
+
};
|
|
9560
|
+
|
|
9561
|
+
if (this.online()) {
|
|
9562
|
+
_context6.next = 4;
|
|
9563
|
+
break;
|
|
9564
|
+
}
|
|
9565
|
+
|
|
9566
|
+
e.callback({
|
|
9567
|
+
code: -2,
|
|
9568
|
+
type: "internet",
|
|
9569
|
+
err: "当前网络差,请检查网络后重试"
|
|
9570
|
+
});
|
|
9571
|
+
return _context6.abrupt("return");
|
|
9572
|
+
|
|
9573
|
+
case 4:
|
|
9574
|
+
if (e.parentId) {
|
|
9575
|
+
_context6.next = 7;
|
|
9576
|
+
break;
|
|
9577
|
+
}
|
|
9578
|
+
|
|
9579
|
+
console.log("请添加视频容器");
|
|
9580
|
+
return _context6.abrupt("return");
|
|
9581
|
+
|
|
9582
|
+
case 7:
|
|
9583
|
+
if (e.callback) {
|
|
9584
|
+
_context6.next = 10;
|
|
9585
|
+
break;
|
|
9586
|
+
}
|
|
9587
|
+
|
|
9588
|
+
console.log("请注册消息回调函数");
|
|
9589
|
+
return _context6.abrupt("return");
|
|
9590
|
+
|
|
9591
|
+
case 10:
|
|
9592
|
+
this.mediaSet.video = e.video, this.mediaSet.audio = e.audio, this.messageBack = e.callback;
|
|
9593
|
+
t = document.querySelector("#" + e.parentId);
|
|
9594
|
+
|
|
9595
|
+
if (t) {
|
|
9596
|
+
_context6.next = 15;
|
|
9597
|
+
break;
|
|
9598
|
+
}
|
|
9599
|
+
|
|
9600
|
+
console.log("无法查找到父级容器"), e.callback({
|
|
9601
|
+
code: -2,
|
|
9602
|
+
type: "error",
|
|
9603
|
+
err: "无法查找到父级容器,请查看"
|
|
9604
|
+
});
|
|
9605
|
+
return _context6.abrupt("return");
|
|
9606
|
+
|
|
9607
|
+
case 15:
|
|
9608
|
+
if (!t.innerHTML) {
|
|
9609
|
+
_context6.next = 18;
|
|
9610
|
+
break;
|
|
9611
|
+
}
|
|
9612
|
+
|
|
9613
|
+
console.log("已成功创建video标签");
|
|
9614
|
+
return _context6.abrupt("return");
|
|
9615
|
+
|
|
9616
|
+
case 18:
|
|
9617
|
+
o = document.createElement("video"), i = document.createElement("video"), s = document.createElement("audio");
|
|
9618
|
+
o.id = "local_video", o.autoplay = !0, o.playsInline = "playsInline", o.muted = !0, i.id = "remote_video", s.id = "remote_audio", i.autoplay = !0, i.playsInline = "playsInline", i.muted = !0, o.className = "local_video_class", i.className = "remote_video_class", s.style.display = "none", s.controls = !0, t.appendChild(i), t.appendChild(o), t.appendChild(s), console.log("showLocal--->", e.showLocal), e.showLocal || (o.style.display = "none"), this.localId = "local_video", this.remoteId = "remote_video", this.remoteAudioId = "remote_audio", e.isDrag && this.pcDrag("remote_video", "local_video");
|
|
9619
|
+
|
|
9620
|
+
case 20:
|
|
9621
|
+
case "end":
|
|
9622
|
+
return _context6.stop();
|
|
9623
|
+
}
|
|
9624
|
+
}
|
|
9625
|
+
}, _callee6, this);
|
|
9626
|
+
}));
|
|
9627
|
+
|
|
9628
|
+
function initDom() {
|
|
9629
|
+
return _initDom.apply(this, arguments);
|
|
9630
|
+
}
|
|
9631
|
+
|
|
9632
|
+
return initDom;
|
|
9633
|
+
}()
|
|
9634
|
+
}, {
|
|
9635
|
+
key: "changeShowLocal",
|
|
9636
|
+
value: function changeShowLocal(e) {
|
|
9637
|
+
var t = document.querySelector("#" + this.localId);
|
|
9638
|
+
t.style.display = e ? "block" : "none";
|
|
9639
|
+
}
|
|
9640
|
+
}, {
|
|
9641
|
+
key: "os",
|
|
9642
|
+
value: function os() {
|
|
9643
|
+
var e = navigator.userAgent,
|
|
9644
|
+
t = /(?:Windows Phone)/.test(e),
|
|
9645
|
+
o = /(?:SymbianOS)/.test(e) || t,
|
|
9646
|
+
i = /(?:Android)/.test(e),
|
|
9647
|
+
s = /(?:Firefox)/.test(e),
|
|
9648
|
+
l = /(?:iPad|PlayBook)/.test(e) || i && !/(?:Mobile)/.test(e) || s && /(?:Tablet)/.test(e),
|
|
9649
|
+
a = /(?:iPhone)/.test(e) && !l,
|
|
9650
|
+
c = !a && !i && !o;
|
|
9651
|
+
return {
|
|
9652
|
+
isTablet: l,
|
|
9653
|
+
isPhone: a,
|
|
9654
|
+
isAndroid: i,
|
|
9655
|
+
isPc: c
|
|
9656
|
+
};
|
|
9657
|
+
}
|
|
9658
|
+
}, {
|
|
9659
|
+
key: "pcDrag",
|
|
9660
|
+
value: function pcDrag(e, t) {
|
|
9661
|
+
var o = document.querySelector("#" + e),
|
|
9662
|
+
i = document.querySelector("#" + t),
|
|
9663
|
+
s = o.offsetWidth,
|
|
9664
|
+
l = o.offsetHeight,
|
|
9665
|
+
a = i.offsetWidth,
|
|
9666
|
+
c = i.offsetHeight,
|
|
9667
|
+
g = o.offsetLeft,
|
|
9668
|
+
f = o.offsetTop,
|
|
9669
|
+
O = this.os().isPc,
|
|
9670
|
+
v = this.os().isPhone;
|
|
9671
|
+
O ? i.addEventListener("mousedown", function (h) {
|
|
9672
|
+
var p = h.pageX - g - i.offsetLeft,
|
|
9673
|
+
y = h.pageY - f - i.offsetTop;
|
|
9674
|
+
|
|
9675
|
+
function k(u) {
|
|
9676
|
+
var r = u.pageX - g - p,
|
|
9677
|
+
n = u.pageY - f - y;
|
|
9678
|
+
r < 20 && (r = 20), r > s - a && (r = s - a), n < 20 && (n = 20), n > l - c && (n = l - c), i.style.left = r + "px", i.style.top = n + "px";
|
|
9679
|
+
}
|
|
9680
|
+
|
|
9681
|
+
document.addEventListener("mousemove", k), document.addEventListener("mouseup", function (u) {
|
|
9682
|
+
document.removeEventListener("mousemove", k);
|
|
9683
|
+
});
|
|
9684
|
+
}) : v && i.addEventListener("touchstart", function (h) {
|
|
9685
|
+
var p = document.body;
|
|
9686
|
+
p.style.overflow = "hidden";
|
|
9687
|
+
var y = h.pageX - g - i.offsetLeft,
|
|
9688
|
+
k = h.pageY - f - i.offsetTop;
|
|
9689
|
+
|
|
9690
|
+
function u(r) {
|
|
9691
|
+
var n = r.pageX - g - y,
|
|
9692
|
+
m = r.pageY - f - k;
|
|
9693
|
+
n < 20 && (n = 20), n > s - a && (n = s - a), m < 20 && (m = 20), m > l - c && (m = l - c), i.style.left = n + "px", i.style.top = m + "px";
|
|
9694
|
+
}
|
|
9695
|
+
|
|
9696
|
+
document.addEventListener("touchmove", u), document.addEventListener("touchend", function (r) {
|
|
9697
|
+
p.style.overflow = "auto", document.removeEventListener("touchmove", u);
|
|
9698
|
+
});
|
|
9699
|
+
});
|
|
9700
|
+
}
|
|
9701
|
+
}, {
|
|
9702
|
+
key: "login",
|
|
9703
|
+
value: function login(e) {
|
|
9704
|
+
var t = Object.assign({
|
|
9705
|
+
type: "login"
|
|
9706
|
+
}, e);
|
|
9707
|
+
this.send(t);
|
|
9708
|
+
}
|
|
9709
|
+
}, {
|
|
9710
|
+
key: "call",
|
|
9711
|
+
value: function () {
|
|
9712
|
+
var _call = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(e) {
|
|
9713
|
+
var t, o;
|
|
9714
|
+
return regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
9715
|
+
while (1) {
|
|
9716
|
+
switch (_context7.prev = _context7.next) {
|
|
9717
|
+
case 0:
|
|
9718
|
+
t = Object.assign({
|
|
9719
|
+
sdp: "",
|
|
9720
|
+
type: "make_call"
|
|
9721
|
+
}, e);
|
|
9722
|
+
_context7.next = 3;
|
|
9723
|
+
return this.getUserMedia();
|
|
9724
|
+
|
|
9725
|
+
case 3:
|
|
9726
|
+
o = _context7.sent;
|
|
9727
|
+
this.videoStream = o;
|
|
9728
|
+
this.bindLocalPicture(o);
|
|
9729
|
+
_context7.next = 8;
|
|
9730
|
+
return this.createOffer();
|
|
9731
|
+
|
|
9732
|
+
case 8:
|
|
9733
|
+
console.log("call---->", t);
|
|
9734
|
+
t.sdp = this.Offer.sdp;
|
|
9735
|
+
this.send(t);
|
|
9736
|
+
|
|
9737
|
+
case 11:
|
|
9738
|
+
case "end":
|
|
9739
|
+
return _context7.stop();
|
|
9740
|
+
}
|
|
9741
|
+
}
|
|
9742
|
+
}, _callee7, this);
|
|
9743
|
+
}));
|
|
9744
|
+
|
|
9745
|
+
function call(_x4) {
|
|
9746
|
+
return _call.apply(this, arguments);
|
|
9747
|
+
}
|
|
9748
|
+
|
|
9749
|
+
return call;
|
|
9750
|
+
}()
|
|
9751
|
+
}, {
|
|
9752
|
+
key: "audioCall",
|
|
9753
|
+
value: function () {
|
|
9754
|
+
var _audioCall = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee8(e) {
|
|
9755
|
+
var t;
|
|
9756
|
+
return regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
9757
|
+
while (1) {
|
|
9758
|
+
switch (_context8.prev = _context8.next) {
|
|
9759
|
+
case 0:
|
|
9760
|
+
t = Object.assign({
|
|
9761
|
+
sdp: "",
|
|
9762
|
+
type: "make_call"
|
|
9763
|
+
}, e);
|
|
9764
|
+
this.getVideoTacks();
|
|
9765
|
+
_context8.next = 4;
|
|
9766
|
+
return this.getUserMedia({
|
|
9767
|
+
audio: {
|
|
9768
|
+
noiseSuppression: !0,
|
|
9769
|
+
echoCancellation: !0
|
|
9770
|
+
}
|
|
9771
|
+
});
|
|
9772
|
+
|
|
9773
|
+
case 4:
|
|
9774
|
+
_context8.next = 6;
|
|
9775
|
+
return this.createOffer();
|
|
9776
|
+
|
|
9777
|
+
case 6:
|
|
9778
|
+
console.log("call---->", t);
|
|
9779
|
+
t.sdp = this.Offer.sdp;
|
|
9780
|
+
this.send(t);
|
|
9781
|
+
|
|
9782
|
+
case 9:
|
|
9783
|
+
case "end":
|
|
9784
|
+
return _context8.stop();
|
|
9785
|
+
}
|
|
9786
|
+
}
|
|
9787
|
+
}, _callee8, this);
|
|
9788
|
+
}));
|
|
9789
|
+
|
|
9790
|
+
function audioCall(_x5) {
|
|
9791
|
+
return _audioCall.apply(this, arguments);
|
|
9792
|
+
}
|
|
9793
|
+
|
|
9794
|
+
return audioCall;
|
|
9795
|
+
}()
|
|
9796
|
+
}, {
|
|
9797
|
+
key: "answer",
|
|
9798
|
+
value: function () {
|
|
9799
|
+
var _answer = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee9(e) {
|
|
9800
|
+
var t, o;
|
|
9801
|
+
return regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
9802
|
+
while (1) {
|
|
9803
|
+
switch (_context9.prev = _context9.next) {
|
|
9804
|
+
case 0:
|
|
9805
|
+
t = Object.assign({
|
|
9806
|
+
sdp: "",
|
|
9807
|
+
type: "answer"
|
|
9808
|
+
}, e);
|
|
9809
|
+
this.callData = e;
|
|
9810
|
+
_context9.next = 4;
|
|
9811
|
+
return this.getUserMedia();
|
|
9812
|
+
|
|
9813
|
+
case 4:
|
|
9814
|
+
o = _context9.sent;
|
|
9815
|
+
this.videoStream ? this.bindLocalPicture(this.videoStream) : this.bindLocalPicture(o);
|
|
9816
|
+
_context9.next = 8;
|
|
9817
|
+
return this.createOffer();
|
|
9818
|
+
|
|
9819
|
+
case 8:
|
|
9820
|
+
t.sdp = this.Offer.sdp;
|
|
9821
|
+
this.send(t);
|
|
9822
|
+
|
|
9823
|
+
case 10:
|
|
9824
|
+
case "end":
|
|
9825
|
+
return _context9.stop();
|
|
9826
|
+
}
|
|
9827
|
+
}
|
|
9828
|
+
}, _callee9, this);
|
|
9829
|
+
}));
|
|
9830
|
+
|
|
9831
|
+
function answer(_x6) {
|
|
9832
|
+
return _answer.apply(this, arguments);
|
|
9833
|
+
}
|
|
9834
|
+
|
|
9835
|
+
return answer;
|
|
9836
|
+
}()
|
|
9837
|
+
}, {
|
|
9838
|
+
key: "hangup",
|
|
9839
|
+
value: function () {
|
|
9840
|
+
var _hangup = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee10(e) {
|
|
9841
|
+
var t;
|
|
9842
|
+
return regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
9843
|
+
while (1) {
|
|
9844
|
+
switch (_context10.prev = _context10.next) {
|
|
9845
|
+
case 0:
|
|
9846
|
+
t = Object.assign({
|
|
9847
|
+
type: "hangup"
|
|
9848
|
+
}, e);
|
|
9849
|
+
console.log("hangup---->", t), this.send(t);
|
|
9850
|
+
|
|
9851
|
+
case 2:
|
|
9852
|
+
case "end":
|
|
9853
|
+
return _context10.stop();
|
|
9854
|
+
}
|
|
9855
|
+
}
|
|
9856
|
+
}, _callee10, this);
|
|
9857
|
+
}));
|
|
9858
|
+
|
|
9859
|
+
function hangup(_x7) {
|
|
9860
|
+
return _hangup.apply(this, arguments);
|
|
9861
|
+
}
|
|
9862
|
+
|
|
9863
|
+
return hangup;
|
|
9864
|
+
}()
|
|
9865
|
+
}, {
|
|
9866
|
+
key: "stopStack",
|
|
9867
|
+
value: function () {
|
|
9868
|
+
var _stopStack = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee11() {
|
|
9869
|
+
var e, t;
|
|
9870
|
+
return regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
9871
|
+
while (1) {
|
|
9872
|
+
switch (_context11.prev = _context11.next) {
|
|
9873
|
+
case 0:
|
|
9874
|
+
e = document.querySelector("#" + this.localId);
|
|
9875
|
+
|
|
9876
|
+
if (e.srcObject) {
|
|
9877
|
+
t = e.srcObject.getTracks();
|
|
9878
|
+
Array.isArray(t) ? t.forEach(function (o) {
|
|
9879
|
+
o.stop();
|
|
9880
|
+
}) : t.stop(), e.srcObject = null;
|
|
9881
|
+
}
|
|
9882
|
+
|
|
9883
|
+
case 2:
|
|
9884
|
+
case "end":
|
|
9885
|
+
return _context11.stop();
|
|
9886
|
+
}
|
|
9887
|
+
}
|
|
9888
|
+
}, _callee11, this);
|
|
9889
|
+
}));
|
|
9890
|
+
|
|
9891
|
+
function stopStack() {
|
|
9892
|
+
return _stopStack.apply(this, arguments);
|
|
9893
|
+
}
|
|
9894
|
+
|
|
9895
|
+
return stopStack;
|
|
9896
|
+
}()
|
|
9897
|
+
}, {
|
|
9898
|
+
key: "cameraUser",
|
|
9899
|
+
value: function () {
|
|
9900
|
+
var _cameraUser = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee12() {
|
|
9901
|
+
var e, t, o, i, s;
|
|
9902
|
+
return regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
9903
|
+
while (1) {
|
|
9904
|
+
switch (_context12.prev = _context12.next) {
|
|
9905
|
+
case 0:
|
|
9906
|
+
console.log("前置"), this.stopStack();
|
|
9907
|
+
e = document.documentElement.clientHeight;
|
|
9908
|
+
t = document.documentElement.clientWidth;
|
|
9909
|
+
_context12.next = 5;
|
|
9910
|
+
return navigator.mediaDevices.getUserMedia({
|
|
9911
|
+
audio: !0,
|
|
9912
|
+
video: {
|
|
9913
|
+
width: {
|
|
9914
|
+
ideal: t
|
|
9915
|
+
},
|
|
9916
|
+
height: {
|
|
9917
|
+
ideal: e
|
|
9918
|
+
},
|
|
9919
|
+
facingMode: "user"
|
|
9920
|
+
}
|
|
9921
|
+
})["catch"](function (a) {
|
|
9922
|
+
console.log("user--err--", a);
|
|
9923
|
+
});
|
|
9924
|
+
|
|
9925
|
+
case 5:
|
|
9926
|
+
o = _context12.sent;
|
|
9927
|
+
this.bindLocalPicture(o);
|
|
9928
|
+
i = o.getVideoTracks(), s = o.getAudioTracks();
|
|
9929
|
+
this.RTC.getSenders().forEach(function (a) {
|
|
9930
|
+
a.track.kind == "video" ? a.replaceTrack(i[0]) : a.track.kind == "audio" && a.replaceTrack(s[0]);
|
|
9931
|
+
});
|
|
9932
|
+
|
|
9933
|
+
case 9:
|
|
9934
|
+
case "end":
|
|
9935
|
+
return _context12.stop();
|
|
9936
|
+
}
|
|
9937
|
+
}
|
|
9938
|
+
}, _callee12, this);
|
|
9939
|
+
}));
|
|
9940
|
+
|
|
9941
|
+
function cameraUser() {
|
|
9942
|
+
return _cameraUser.apply(this, arguments);
|
|
9943
|
+
}
|
|
9944
|
+
|
|
9945
|
+
return cameraUser;
|
|
9946
|
+
}()
|
|
9947
|
+
}, {
|
|
9948
|
+
key: "cameraRear",
|
|
9949
|
+
value: function () {
|
|
9950
|
+
var _cameraRear = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regeneratorRuntime.mark(function _callee13() {
|
|
9951
|
+
var e, t, o, i, s;
|
|
9952
|
+
return regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
9953
|
+
while (1) {
|
|
9954
|
+
switch (_context13.prev = _context13.next) {
|
|
9955
|
+
case 0:
|
|
9956
|
+
console.log("后置"), this.stopStack();
|
|
9957
|
+
e = document.documentElement.clientHeight;
|
|
9958
|
+
t = document.documentElement.clientWidth;
|
|
9959
|
+
_context13.next = 5;
|
|
9960
|
+
return navigator.mediaDevices.getUserMedia({
|
|
9961
|
+
audio: !0,
|
|
9962
|
+
video: {
|
|
9963
|
+
width: {
|
|
9964
|
+
ideal: t
|
|
9965
|
+
},
|
|
9966
|
+
height: {
|
|
9967
|
+
ideal: e
|
|
9968
|
+
},
|
|
9969
|
+
facingMode: "environment"
|
|
9970
|
+
}
|
|
9971
|
+
})["catch"](function (a) {
|
|
9972
|
+
console.log("environment--err--", a);
|
|
9973
|
+
});
|
|
9974
|
+
|
|
9975
|
+
case 5:
|
|
9976
|
+
o = _context13.sent;
|
|
9977
|
+
this.bindLocalPicture(o);
|
|
9978
|
+
i = o.getVideoTracks(), s = o.getAudioTracks();
|
|
9979
|
+
this.RTC.getSenders().forEach(function (a) {
|
|
9980
|
+
a.track.kind == "video" ? a.replaceTrack(i[0]) : a.track.kind == "audio" && a.replaceTrack(s[0]);
|
|
9981
|
+
});
|
|
9982
|
+
|
|
9983
|
+
case 9:
|
|
9984
|
+
case "end":
|
|
9985
|
+
return _context13.stop();
|
|
9986
|
+
}
|
|
9987
|
+
}
|
|
9988
|
+
}, _callee13, this);
|
|
9989
|
+
}));
|
|
9990
|
+
|
|
9991
|
+
function cameraRear() {
|
|
9992
|
+
return _cameraRear.apply(this, arguments);
|
|
9993
|
+
}
|
|
9994
|
+
|
|
9995
|
+
return cameraRear;
|
|
9996
|
+
}()
|
|
9997
|
+
}, {
|
|
9998
|
+
key: "microphoneChange",
|
|
9999
|
+
value: function microphoneChange(e) {
|
|
10000
|
+
var t = document.querySelector("#" + this.localId);
|
|
10001
|
+
|
|
10002
|
+
if (t.srcObject) {
|
|
10003
|
+
var o = t.srcObject.getAudioTracks();
|
|
10004
|
+
o[0].enabled = e;
|
|
10005
|
+
}
|
|
10006
|
+
}
|
|
10007
|
+
}, {
|
|
10008
|
+
key: "mutedChange",
|
|
10009
|
+
value: function mutedChange(e) {
|
|
10010
|
+
var t = document.querySelector("#audio_remote");
|
|
10011
|
+
|
|
10012
|
+
if (t.srcObject) {
|
|
10013
|
+
var o = t.srcObject.getAudioTracks();
|
|
10014
|
+
o[0].enabled = e;
|
|
10015
|
+
}
|
|
10016
|
+
}
|
|
10017
|
+
}, {
|
|
10018
|
+
key: "loginOut",
|
|
10019
|
+
value: function loginOut(e) {
|
|
10020
|
+
var t = Object.assign({
|
|
10021
|
+
type: "login_out"
|
|
10022
|
+
}, e);
|
|
10023
|
+
console.log("loginOut-->", t), this.send(t);
|
|
10024
|
+
}
|
|
10025
|
+
}, {
|
|
10026
|
+
key: "changePicture",
|
|
10027
|
+
value: function changePicture() {
|
|
10028
|
+
console.log("changePicture--->");
|
|
10029
|
+
var e = document.querySelector("#" + this.localId),
|
|
10030
|
+
t = document.querySelector("#" + this.remoteId),
|
|
10031
|
+
o = e.srcObject,
|
|
10032
|
+
i = t.srcObject;
|
|
10033
|
+
console.log(o, i), o && i && (e.srcObject = i, t.srcObject = o);
|
|
10034
|
+
}
|
|
10035
|
+
}]);
|
|
10036
|
+
|
|
10037
|
+
return j;
|
|
10038
|
+
}();
|
|
10039
|
+
|
|
10040
|
+
|
|
10041
|
+
// CONCATENATED MODULE: ./src/common-request.js
|
|
10042
|
+
|
|
10043
|
+
|
|
10044
|
+
|
|
10045
|
+
|
|
10046
|
+
|
|
10047
|
+
|
|
10048
|
+
|
|
10049
|
+
|
|
10050
|
+
|
|
10051
|
+
|
|
10052
|
+
|
|
10053
|
+
|
|
10054
|
+
|
|
10055
|
+
|
|
10056
|
+
|
|
10057
|
+
|
|
10058
|
+
|
|
10059
|
+
|
|
10060
|
+
|
|
10061
|
+
/**
|
|
10062
|
+
* 接口请求通用方法
|
|
10063
|
+
* @param {*} url
|
|
10064
|
+
* @param {*} param
|
|
10065
|
+
* @param {*} backSuccfn
|
|
10066
|
+
* @param {*} async
|
|
10067
|
+
* @param {*} method
|
|
10068
|
+
*/
|
|
10069
|
+
|
|
10070
|
+
var common_request_useRequest = function useRequest(type) {
|
|
10071
|
+
console.log(webApi);
|
|
10072
|
+
var requestObj = webApi[type];
|
|
10073
|
+
console.log(requestObj);
|
|
10074
|
+
if (!requestObj) throw new Error('未找到对应的请求方法!');
|
|
10075
|
+
return function () {
|
|
10076
|
+
return requestObj.apply(void 0, arguments);
|
|
10077
|
+
};
|
|
10078
|
+
};
|
|
10079
|
+
|
|
10080
|
+
var initWsBaseTheme = function initWsBaseTheme(socket, _ref) {
|
|
10081
|
+
var onOpen = _ref.onOpen,
|
|
10082
|
+
onClose = _ref.onClose,
|
|
10083
|
+
onMessage = _ref.onMessage,
|
|
8808
10084
|
onError = _ref.onError,
|
|
8809
10085
|
onReconnect = _ref.onReconnect;
|
|
8810
10086
|
socket.subscribe('open', function () {
|
|
@@ -8848,6 +10124,11 @@ var getH265PlayerObj = function getH265PlayerObj(rtcServe, doceProUrl, videoConf
|
|
|
8848
10124
|
videoConfig: videoConfig || videoConfigdefault
|
|
8849
10125
|
});
|
|
8850
10126
|
return h265Play;
|
|
10127
|
+
};
|
|
10128
|
+
|
|
10129
|
+
var common_request_initPhoneClientWs = function initPhoneClientWs(ws) {
|
|
10130
|
+
var phoneClientObj = phoneClient_j(ws);
|
|
10131
|
+
return phoneClientObj;
|
|
8851
10132
|
}; // 组合发送ws信息
|
|
8852
10133
|
|
|
8853
10134
|
|
|
@@ -8865,8 +10146,9 @@ var GetSendModel = function GetSendModel(action, data, params) {
|
|
|
8865
10146
|
|
|
8866
10147
|
var _player = /*#__PURE__*/new WeakMap();
|
|
8867
10148
|
|
|
10149
|
+
var _phoneClientObj = /*#__PURE__*/new WeakMap();
|
|
10150
|
+
|
|
8868
10151
|
var common_request_wsClass = /*#__PURE__*/function () {
|
|
8869
|
-
//根据播放的id存储每个播放器,播放器们
|
|
8870
10152
|
function wsClass(config, _ref2) {
|
|
8871
10153
|
var _this = this;
|
|
8872
10154
|
|
|
@@ -8879,7 +10161,12 @@ var common_request_wsClass = /*#__PURE__*/function () {
|
|
|
8879
10161
|
|
|
8880
10162
|
Object(classPrivateFieldInitSpec["a" /* default */])(this, _player, {
|
|
8881
10163
|
writable: true,
|
|
8882
|
-
value:
|
|
10164
|
+
value: null
|
|
10165
|
+
});
|
|
10166
|
+
|
|
10167
|
+
Object(classPrivateFieldInitSpec["a" /* default */])(this, _phoneClientObj, {
|
|
10168
|
+
writable: true,
|
|
10169
|
+
value: null
|
|
8883
10170
|
});
|
|
8884
10171
|
|
|
8885
10172
|
this.config = config;
|
|
@@ -8925,24 +10212,41 @@ var common_request_wsClass = /*#__PURE__*/function () {
|
|
|
8925
10212
|
}
|
|
8926
10213
|
}, {
|
|
8927
10214
|
key: "getPlayer",
|
|
8928
|
-
value: function getPlayer(
|
|
8929
|
-
if (_classPrivateFieldGet(this, _player)
|
|
8930
|
-
|
|
8931
|
-
|
|
10215
|
+
value: function getPlayer(rtcServe, doceProUrl, videoConfig) {
|
|
10216
|
+
if (_classPrivateFieldGet(this, _player)) return _classPrivateFieldGet(this, _player);
|
|
10217
|
+
|
|
10218
|
+
_classPrivateFieldSet(this, _player, getH265PlayerObj(rtcServe, doceProUrl, videoConfig));
|
|
10219
|
+
|
|
10220
|
+
return _classPrivateFieldGet(this, _player);
|
|
10221
|
+
}
|
|
10222
|
+
}, {
|
|
10223
|
+
key: "getPhoneClientObj",
|
|
10224
|
+
value: function getPhoneClientObj(ws, config) {
|
|
10225
|
+
if (_classPrivateFieldGet(this, _phoneClientObj)) return _classPrivateFieldGet(this, _phoneClientObj);
|
|
10226
|
+
|
|
10227
|
+
_classPrivateFieldSet(this, _phoneClientObj, common_request_initPhoneClientWs(ws));
|
|
10228
|
+
|
|
10229
|
+
if (config) {
|
|
10230
|
+
_classPrivateFieldGet(this, _phoneClientObj).initDom(config);
|
|
10231
|
+
}
|
|
10232
|
+
|
|
10233
|
+
return _classPrivateFieldGet(this, _phoneClientObj);
|
|
8932
10234
|
}
|
|
8933
10235
|
}, {
|
|
8934
10236
|
key: "destroy",
|
|
8935
10237
|
value: function destroy() {
|
|
8936
10238
|
var _this2 = this;
|
|
8937
10239
|
|
|
8938
|
-
|
|
8939
|
-
|
|
8940
|
-
|
|
10240
|
+
_classPrivateFieldGet(this, _player) && _classPrivateFieldGet(this, _player).play265Obj && Object.keys(_classPrivateFieldGet(this, _player).play265Obj).forEach(function (key) {
|
|
10241
|
+
_classPrivateFieldGet(_this2, _player).play265Obj[key].destroy();
|
|
10242
|
+
|
|
10243
|
+
delete _classPrivateFieldGet(_this2, _player).play265Obj[key];
|
|
8941
10244
|
});
|
|
8942
10245
|
|
|
8943
|
-
_classPrivateFieldSet(this, _player,
|
|
10246
|
+
_classPrivateFieldSet(this, _player, null);
|
|
8944
10247
|
|
|
8945
10248
|
this.socket.closeSocket();
|
|
10249
|
+
if (_classPrivateFieldGet(this, _phoneClientObj)) _classPrivateFieldGet(this, _phoneClientObj).onclose();
|
|
8946
10250
|
}
|
|
8947
10251
|
}]);
|
|
8948
10252
|
|