@flashphoner/websdk 2.0.245 → 2.0.247

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.
@@ -6660,6 +6660,325 @@ function filterStats(result, track, outbound) {
6660
6660
  },{}],38:[function(require,module,exports){
6661
6661
  'use strict';
6662
6662
 
6663
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
6664
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
6665
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
6666
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
6667
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
6668
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
6669
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
6670
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6671
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
6672
+ function getClientHints(navigator) {
6673
+ var userAgent = navigator.userAgent;
6674
+ var mobile,
6675
+ platform = '',
6676
+ platformVersion = '',
6677
+ architecture = '',
6678
+ bitness = '',
6679
+ model = '',
6680
+ uaFullVersion = '',
6681
+ fullVersionList = [];
6682
+ var platformInfo = userAgent;
6683
+ var found = false;
6684
+ var versionInfo = userAgent.replace(/\(([^)]+)\)?/g, function ($0, $1) {
6685
+ if (!found) {
6686
+ platformInfo = $1;
6687
+ found = true;
6688
+ }
6689
+ return '';
6690
+ });
6691
+ var items = versionInfo.match(/(\S+)\/(\S+)/g);
6692
+ var webview = false;
6693
+ // detect mobile
6694
+ mobile = userAgent.indexOf('Mobile') !== -1;
6695
+ var m;
6696
+ var m2;
6697
+ // detect platform
6698
+ if ((m = /Windows NT (\d+(\.\d+)*)/.exec(platformInfo)) !== null) {
6699
+ platform = 'Windows';
6700
+ // see https://docs.microsoft.com/en-us/microsoft-edge/web-platform/how-to-detect-win11
6701
+ var nt2win = {
6702
+ '6.1': '0.1',
6703
+ // win-7
6704
+ '6.2': '0.2',
6705
+ // win-8
6706
+ '6.3': '0.3',
6707
+ // win-8.1
6708
+ '10.0': '10.0',
6709
+ // win-10
6710
+ '11.0': '13.0' // win-11
6711
+ };
6712
+ var ver = nt2win[m[1]];
6713
+ if (ver) platformVersion = padVersion(ver, 3);
6714
+ if ((m2 = /\b(WOW64|Win64|x64)\b/.exec(platformInfo)) !== null) {
6715
+ architecture = 'x86';
6716
+ bitness = '64';
6717
+ }
6718
+ } else if ((m = /Android (\d+(\.\d+)*)/.exec(platformInfo)) !== null) {
6719
+ platform = 'Android';
6720
+ platformVersion = padVersion(m[1]);
6721
+ if ((m2 = /Linux (\w+)/.exec(navigator.platform)) !== null) {
6722
+ if (m2[1]) {
6723
+ m2 = parseArch(m2[1]);
6724
+ architecture = m2[0];
6725
+ bitness = m2[1];
6726
+ }
6727
+ }
6728
+ } else if ((m = /(iPhone|iPod touch); CPU iPhone OS (\d+(_\d+)*)/.exec(platformInfo)) !== null) {
6729
+ // see special notes at https://www.whatismybrowser.com/guides/the-latest-user-agent/safari
6730
+ platform = 'iOS';
6731
+ platformVersion = padVersion(m[2].replace(/_/g, '.'));
6732
+ } else if ((m = /(iPad); CPU OS (\d+(_\d+)*)/.exec(platformInfo)) !== null) {
6733
+ platform = 'iOS';
6734
+ platformVersion = padVersion(m[2].replace(/_/g, '.'));
6735
+ } else if ((m = /Macintosh; (Intel|\w+) Mac OS X (\d+([_.]\d+)*)/.exec(platformInfo)) !== null) {
6736
+ platform = 'macOS';
6737
+ platformVersion = padVersion(m[2].replace(/_/g, '.'));
6738
+ } else if ((m = /Linux/.exec(platformInfo)) !== null) {
6739
+ platform = 'Linux';
6740
+ platformVersion = '';
6741
+ // TODO
6742
+ } else if ((m = /CrOS (\w+) (\d+(\.\d+)*)/.exec(platformInfo)) !== null) {
6743
+ platform = 'Chrome OS';
6744
+ platformVersion = padVersion(m[2]);
6745
+ m2 = parseArch(m[1]);
6746
+ architecture = m2[0];
6747
+ bitness = m2[1];
6748
+ }
6749
+ if (!platform) {
6750
+ platform = 'Unknown';
6751
+ }
6752
+ // detect fullVersionList / brands
6753
+ var notABrand = {
6754
+ brand: ' Not;A Brand',
6755
+ version: '99.0.0.0'
6756
+ };
6757
+ if ((m = /Chrome\/(\d+(\.\d+)*)/.exec(versionInfo)) !== null && navigator.vendor === 'Google Inc.') {
6758
+ fullVersionList.push({
6759
+ brand: 'Chromium',
6760
+ version: padVersion(m[1], 4)
6761
+ });
6762
+ if ((m2 = /(Edge?)\/(\d+(\.\d+)*)/.exec(versionInfo)) !== null) {
6763
+ var identBrandMap = {
6764
+ 'Edge': 'Microsoft Edge',
6765
+ 'Edg': 'Microsoft Edge'
6766
+ };
6767
+ var brand = identBrandMap[m[1]];
6768
+ fullVersionList.push({
6769
+ brand: brand,
6770
+ version: padVersion(m2[2], 4)
6771
+ });
6772
+ } else {
6773
+ fullVersionList.push({
6774
+ brand: 'Google Chrome',
6775
+ version: padVersion(m[1], 4)
6776
+ });
6777
+ }
6778
+ if (/\bwv\b/.exec(platformInfo)) {
6779
+ webview = true;
6780
+ }
6781
+ } else if ((m = /AppleWebKit\/(\d+(\.\d+)*)/.exec(versionInfo)) !== null && navigator.vendor === 'Apple Computer, Inc.') {
6782
+ fullVersionList.push({
6783
+ brand: 'WebKit',
6784
+ version: padVersion(m[1])
6785
+ });
6786
+ if (platform === 'iOS' && (m2 = /(CriOS|EdgiOS|FxiOS|Version)\/(\d+(\.\d+)*)/.exec(versionInfo)) != null) {
6787
+ var _identBrandMap = {
6788
+ // no
6789
+ 'CriOS': 'Google Chrome',
6790
+ 'EdgiOS': 'Microsoft Edge',
6791
+ 'FxiOS': 'Mozilla Firefox',
6792
+ 'Version': 'Apple Safari'
6793
+ };
6794
+ var _brand = _identBrandMap[m2[1]];
6795
+ fullVersionList.push({
6796
+ brand: _brand,
6797
+ version: padVersion(m2[2])
6798
+ });
6799
+ if (items.findIndex(function (s) {
6800
+ return s.startsWith('Safari/');
6801
+ }) === -1) {
6802
+ webview = true;
6803
+ }
6804
+ }
6805
+ } else if ((m = /Firefox\/(\d+(\.\d+)*)/.exec(versionInfo)) !== null) {
6806
+ fullVersionList.push({
6807
+ brand: 'Firefox',
6808
+ version: padVersion(m[1])
6809
+ });
6810
+ } else {
6811
+ fullVersionList.push(notABrand);
6812
+ }
6813
+ uaFullVersion = fullVersionList.length > 0 ? fullVersionList[fullVersionList.length - 1] : '';
6814
+ var brands = fullVersionList.map(function (b) {
6815
+ var pos = b.version.indexOf('.');
6816
+ var version = pos === -1 ? b.version : b.version.slice(0, pos);
6817
+ return {
6818
+ brand: b.brand,
6819
+ version: version
6820
+ };
6821
+ });
6822
+ // TODO detect architecture, bitness and model
6823
+ return {
6824
+ mobile: mobile,
6825
+ platform: platform,
6826
+ brands: brands,
6827
+ platformVersion: platformVersion,
6828
+ architecture: architecture,
6829
+ bitness: bitness,
6830
+ model: model,
6831
+ uaFullVersion: uaFullVersion,
6832
+ fullVersionList: fullVersionList,
6833
+ webview: webview
6834
+ };
6835
+ }
6836
+ function parseArch(arch) {
6837
+ switch (arch) {
6838
+ case 'x86_64':
6839
+ case 'x64':
6840
+ return ['x86', '64'];
6841
+ case 'x86_32':
6842
+ case 'x86':
6843
+ return ['x86', ''];
6844
+ case 'armv6l':
6845
+ case 'armv7l':
6846
+ case 'armv8l':
6847
+ return [arch, ''];
6848
+ case 'aarch64':
6849
+ return ['arm', '64'];
6850
+ default:
6851
+ return ['', ''];
6852
+ }
6853
+ }
6854
+ function padVersion(ver) {
6855
+ var minSegs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
6856
+ var parts = ver.split('.');
6857
+ var len = parts.length;
6858
+ if (len < minSegs) {
6859
+ for (var i = 0, lenToPad = minSegs - len; i < lenToPad; i += 1) {
6860
+ parts.push('0');
6861
+ }
6862
+ return parts.join('.');
6863
+ }
6864
+ return ver;
6865
+ }
6866
+ var NavigatorUAData = /*#__PURE__*/function () {
6867
+ function NavigatorUAData(navigator) {
6868
+ _classCallCheck(this, NavigatorUAData);
6869
+ this._ch = getClientHints(navigator);
6870
+ Object.defineProperties(this, {
6871
+ _ch: {
6872
+ enumerable: false
6873
+ }
6874
+ });
6875
+ }
6876
+ return _createClass(NavigatorUAData, [{
6877
+ key: "mobile",
6878
+ get: function get() {
6879
+ return this._ch.mobile;
6880
+ }
6881
+ }, {
6882
+ key: "platform",
6883
+ get: function get() {
6884
+ return this._ch.platform;
6885
+ }
6886
+ }, {
6887
+ key: "brands",
6888
+ get: function get() {
6889
+ return this._ch.brands;
6890
+ }
6891
+ }, {
6892
+ key: "getHighEntropyValues",
6893
+ value: function getHighEntropyValues(hints) {
6894
+ var _this = this;
6895
+ return new Promise(function (resolve, reject) {
6896
+ if (!Array.isArray(hints)) {
6897
+ throw new TypeError('argument hints is not an array');
6898
+ }
6899
+ var hintSet = new Set(hints);
6900
+ var data = _this._ch;
6901
+ var obj = {
6902
+ mobile: data.mobile,
6903
+ platform: data.platform,
6904
+ brands: data.brands
6905
+ };
6906
+ if (hintSet.has('architecture')) obj.architecture = data.architecture;
6907
+ if (hintSet.has('bitness')) obj.bitness = data.bitness;
6908
+ if (hintSet.has('model')) obj.model = data.model;
6909
+ if (hintSet.has('platformVersion')) obj.platformVersion = data.platformVersion;
6910
+ if (hintSet.has('uaFullVersion')) obj.uaFullVersion = data.uaFullVersion;
6911
+ if (hintSet.has('fullVersionList')) obj.fullVersionList = data.fullVersionList;
6912
+ resolve(obj);
6913
+ });
6914
+ }
6915
+ }, {
6916
+ key: "toJSON",
6917
+ value: function toJSON() {
6918
+ var data = this._ch;
6919
+ return {
6920
+ mobile: data.mobile,
6921
+ brands: data.brands
6922
+ };
6923
+ }
6924
+ }]);
6925
+ }();
6926
+ Object.defineProperty(NavigatorUAData.prototype, Symbol.toStringTag, {
6927
+ enumerable: false,
6928
+ configurable: true,
6929
+ writable: false,
6930
+ value: 'NavigatorUAData'
6931
+ });
6932
+ function getClientInfo(_x, _x2) {
6933
+ return _getClientInfo.apply(this, arguments);
6934
+ }
6935
+ function _getClientInfo() {
6936
+ _getClientInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(navigator, keys) {
6937
+ var info, customUAData;
6938
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
6939
+ while (1) switch (_context.prev = _context.next) {
6940
+ case 0:
6941
+ info = {};
6942
+ if (!(location.protocol === 'https:')) {
6943
+ _context.next = 13;
6944
+ break;
6945
+ }
6946
+ if (!keys) {
6947
+ keys = ['brands', 'mobile', 'platform', 'platformVersion', 'architecture', 'bitness', 'model', 'fullVersionList'];
6948
+ }
6949
+ if (navigator.userAgentData) {
6950
+ _context.next = 10;
6951
+ break;
6952
+ }
6953
+ customUAData = new NavigatorUAData(navigator);
6954
+ _context.next = 7;
6955
+ return customUAData.getHighEntropyValues(keys);
6956
+ case 7:
6957
+ info = _context.sent;
6958
+ _context.next = 13;
6959
+ break;
6960
+ case 10:
6961
+ _context.next = 12;
6962
+ return navigator.userAgentData.getHighEntropyValues(keys);
6963
+ case 12:
6964
+ info = _context.sent;
6965
+ case 13:
6966
+ return _context.abrupt("return", info);
6967
+ case 14:
6968
+ case "end":
6969
+ return _context.stop();
6970
+ }
6971
+ }, _callee);
6972
+ }));
6973
+ return _getClientInfo.apply(this, arguments);
6974
+ }
6975
+ module.exports = {
6976
+ getClientInfo: getClientInfo
6977
+ };
6978
+
6979
+ },{}],39:[function(require,module,exports){
6980
+ 'use strict';
6981
+
6663
6982
  /**
6664
6983
  * @namespace Flashphoner.constants.SESSION_STATUS
6665
6984
  * @see Session
@@ -7505,16 +7824,20 @@ module.exports = {
7505
7824
  CONTENT_HINT_TYPE: CONTENT_HINT_TYPE
7506
7825
  };
7507
7826
 
7508
- },{}],39:[function(require,module,exports){
7827
+ },{}],40:[function(require,module,exports){
7509
7828
  'use strict';
7510
7829
 
7511
7830
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
7831
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
7832
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
7833
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
7512
7834
  var _require = require('uuid'),
7513
7835
  uuid_v1 = _require.v1;
7514
7836
  var constants = require("./constants");
7515
7837
  var util = require('./util');
7516
7838
  var LoggerObject = require('./util').logger;
7517
- var Promise = require('promise-polyfill');
7839
+ var clientInfo = require('./client-info');
7840
+ var _Promise = require('promise-polyfill');
7518
7841
  var KalmanFilter = require('kalmanjs');
7519
7842
  var browserDetails = require('webrtc-adapter')["default"].browserDetails;
7520
7843
  var LOG_PREFIX = "core";
@@ -7524,6 +7847,7 @@ var loggerConf = {
7524
7847
  severity: "INFO"
7525
7848
  };
7526
7849
  var isUsingTemasysPlugin = false;
7850
+ var clientUAData;
7527
7851
 
7528
7852
  /**
7529
7853
  * @namespace Flashphoner
@@ -7575,136 +7899,167 @@ var disableConnectionQualityCalculation;
7575
7899
  * @throws {Error} Error if none of MediaProviders available
7576
7900
  * @memberof Flashphoner
7577
7901
  */
7578
- var init = function init(options) {
7579
- if (!initialized) {
7580
- if (!options) {
7581
- options = {};
7582
- }
7583
- // init global logger
7584
- coreLogger = createLogger(options.logger);
7585
- var waitingTemasys = false;
7586
- try {
7587
- var audioContext = new (window.AudioContext || window.webkitAudioContext)();
7588
- } catch (e) {
7589
- console.warn("Failed to create audio context");
7590
- }
7591
- disableConnectionQualityCalculation = options.disableConnectionQualityCalculation;
7592
- var webRtcProvider = require("./webrtc-media-provider");
7593
- if (webRtcProvider && webRtcProvider.hasOwnProperty('available') && webRtcProvider.available()) {
7594
- MediaProvider.WebRTC = webRtcProvider;
7595
- // WCS-2996 Fix audio-video out of sync in case of using Samsung browser
7596
- var enableGainNode = util.Browser.isSamsungBrowser() || util.Browser.isAndroidFirefox() ? false : options.createMicGainNode;
7597
- var webRtcConf = {
7598
- constraints: options.constraints || getDefaultMediaConstraints(),
7599
- extensionId: options.screenSharingExtensionId,
7600
- audioContext: audioContext,
7601
- logger: coreLogger,
7602
- createMicGainNode: enableGainNode
7603
- };
7604
- webRtcProvider.configure(webRtcConf);
7605
- } else {
7606
- webRtcProvider = require("./temasys-media-provider");
7607
- if (webRtcProvider && webRtcProvider.hasOwnProperty('available') && AdapterJS) {
7608
- waitingTemasys = true;
7609
- AdapterJS.webRTCReady(function (isUsingPlugin) {
7610
- isUsingTemasysPlugin = isUsingPlugin;
7611
- if (isUsingPlugin || webRtcProvider.available()) {
7902
+ var init = /*#__PURE__*/function () {
7903
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
7904
+ var waitingTemasys, audioContext, webRtcProvider, enableGainNode, webRtcConf, flashProvider, flashConf, mediaSourceMediaProvider, mseConf, websocketProvider, wsConf, _MediaProvider, p, newMediaProvider, i, pMP;
7905
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
7906
+ while (1) switch (_context.prev = _context.next) {
7907
+ case 0:
7908
+ if (initialized) {
7909
+ _context.next = 34;
7910
+ break;
7911
+ }
7912
+ if (!options) {
7913
+ options = {};
7914
+ }
7915
+ // init global logger
7916
+ coreLogger = createLogger(options.logger);
7917
+ waitingTemasys = false;
7918
+ try {
7919
+ audioContext = new (window.AudioContext || window.webkitAudioContext)();
7920
+ } catch (e) {
7921
+ console.warn("Failed to create audio context");
7922
+ }
7923
+ disableConnectionQualityCalculation = options.disableConnectionQualityCalculation;
7924
+ webRtcProvider = require("./webrtc-media-provider");
7925
+ if (webRtcProvider && webRtcProvider.hasOwnProperty('available') && webRtcProvider.available()) {
7612
7926
  MediaProvider.WebRTC = webRtcProvider;
7613
- var webRtcConf = {
7927
+ // WCS-2996 Fix audio-video out of sync in case of using Samsung browser
7928
+ enableGainNode = util.Browser.isSamsungBrowser() || util.Browser.isAndroidFirefox() ? false : options.createMicGainNode;
7929
+ webRtcConf = {
7614
7930
  constraints: options.constraints || getDefaultMediaConstraints(),
7615
7931
  extensionId: options.screenSharingExtensionId,
7616
- logger: coreLogger
7932
+ audioContext: audioContext,
7933
+ logger: coreLogger,
7934
+ createMicGainNode: enableGainNode
7617
7935
  };
7618
7936
  webRtcProvider.configure(webRtcConf);
7619
-
7620
- // Just reorder media provider list
7621
- var _MediaProvider = {};
7622
- _MediaProvider.WebRTC = MediaProvider.WebRTC;
7623
- for (var p in MediaProvider) {
7624
- _MediaProvider[p] = MediaProvider[p];
7937
+ } else {
7938
+ webRtcProvider = require("./temasys-media-provider");
7939
+ if (webRtcProvider && webRtcProvider.hasOwnProperty('available') && AdapterJS) {
7940
+ waitingTemasys = true;
7941
+ AdapterJS.webRTCReady(function (isUsingPlugin) {
7942
+ isUsingTemasysPlugin = isUsingPlugin;
7943
+ if (isUsingPlugin || webRtcProvider.available()) {
7944
+ MediaProvider.WebRTC = webRtcProvider;
7945
+ var webRtcConf = {
7946
+ constraints: options.constraints || getDefaultMediaConstraints(),
7947
+ extensionId: options.screenSharingExtensionId,
7948
+ logger: coreLogger
7949
+ };
7950
+ webRtcProvider.configure(webRtcConf);
7951
+
7952
+ // Just reorder media provider list
7953
+ var _MediaProvider = {};
7954
+ _MediaProvider.WebRTC = MediaProvider.WebRTC;
7955
+ for (var p in MediaProvider) {
7956
+ _MediaProvider[p] = MediaProvider[p];
7957
+ }
7958
+ MediaProvider = _MediaProvider;
7959
+ }
7960
+ if (options.mediaProvidersReadyCallback) {
7961
+ options.mediaProvidersReadyCallback(Object.keys(MediaProvider));
7962
+ }
7963
+ });
7625
7964
  }
7626
- MediaProvider = _MediaProvider;
7627
7965
  }
7628
- if (options.mediaProvidersReadyCallback) {
7629
- options.mediaProvidersReadyCallback(Object.keys(MediaProvider));
7966
+
7967
+ // flashMediaProvider is disables by default due to end of support in the most browsers #WCS-3577
7968
+ flashProvider = null;
7969
+ if (flashProvider && flashProvider.hasOwnProperty('available') && flashProvider.available() && (!MediaProvider.WebRTC || options.preferredMediaProviders && options.preferredMediaProviders.indexOf("Flash") >= 0)) {
7970
+ MediaProvider.Flash = flashProvider;
7971
+ flashConf = {
7972
+ constraints: options.constraints || getDefaultMediaConstraints(),
7973
+ flashMediaProviderSwfLocation: options.flashMediaProviderSwfLocation,
7974
+ logger: coreLogger
7975
+ };
7976
+ flashProvider.configure(flashConf);
7977
+ }
7978
+ mediaSourceMediaProvider = require("./media-source-media-provider");
7979
+ if (mediaSourceMediaProvider && mediaSourceMediaProvider.hasOwnProperty('available') && mediaSourceMediaProvider.available()) {
7980
+ MediaProvider.MSE = mediaSourceMediaProvider;
7981
+ mseConf = {
7982
+ audioContext: audioContext,
7983
+ browserDetails: browserDetails.browser
7984
+ };
7985
+ mediaSourceMediaProvider.configure(mseConf);
7986
+ }
7987
+ websocketProvider = require("./websocket-media-provider");
7988
+ if (websocketProvider && websocketProvider.hasOwnProperty('available') && websocketProvider.available(audioContext)) {
7989
+ MediaProvider.WSPlayer = websocketProvider;
7990
+ wsConf = {
7991
+ receiverLocation: options.receiverLocation,
7992
+ decoderLocation: options.decoderLocation,
7993
+ audioContext: audioContext,
7994
+ logger: coreLogger
7995
+ };
7996
+ websocketProvider.configure(wsConf);
7630
7997
  }
7631
- });
7632
- }
7633
- }
7634
7998
 
7635
- // flashMediaProvider is disables by default due to end of support in the most browsers #WCS-3577
7636
- var flashProvider = null;
7637
- if (flashProvider && flashProvider.hasOwnProperty('available') && flashProvider.available() && (!MediaProvider.WebRTC || options.preferredMediaProviders && options.preferredMediaProviders.indexOf("Flash") >= 0)) {
7638
- MediaProvider.Flash = flashProvider;
7639
- var flashConf = {
7640
- constraints: options.constraints || getDefaultMediaConstraints(),
7641
- flashMediaProviderSwfLocation: options.flashMediaProviderSwfLocation,
7642
- logger: coreLogger
7643
- };
7644
- flashProvider.configure(flashConf);
7645
- }
7646
- var mediaSourceMediaProvider = require("./media-source-media-provider");
7647
- if (mediaSourceMediaProvider && mediaSourceMediaProvider.hasOwnProperty('available') && mediaSourceMediaProvider.available()) {
7648
- MediaProvider.MSE = mediaSourceMediaProvider;
7649
- var mseConf = {
7650
- audioContext: audioContext,
7651
- browserDetails: browserDetails.browser
7652
- };
7653
- mediaSourceMediaProvider.configure(mseConf);
7654
- }
7655
- var websocketProvider = require("./websocket-media-provider");
7656
- if (websocketProvider && websocketProvider.hasOwnProperty('available') && websocketProvider.available(audioContext)) {
7657
- MediaProvider.WSPlayer = websocketProvider;
7658
- var wsConf = {
7659
- receiverLocation: options.receiverLocation,
7660
- decoderLocation: options.decoderLocation,
7661
- audioContext: audioContext,
7662
- logger: coreLogger
7663
- };
7664
- websocketProvider.configure(wsConf);
7665
- }
7666
-
7667
- //check at least 1 provider available
7668
- if (getMediaProviders().length == 0) {
7669
- throw new Error('None of MediaProviders available');
7670
- } else if (options.preferredMediaProvider) {
7671
- if (MediaProvider.hasOwnProperty(options.preferredMediaProvider)) {
7672
- if (getMediaProviders()[0] != options.preferredMediaProvider) {
7673
- // Just reorder media provider list
7674
- var _MediaProvider = {};
7675
- _MediaProvider[options.preferredMediaProvider] = MediaProvider[options.preferredMediaProvider];
7676
- for (var p in MediaProvider) {
7677
- _MediaProvider[p] = MediaProvider[p];
7999
+ //check at least 1 provider available
8000
+ if (!(getMediaProviders().length == 0)) {
8001
+ _context.next = 18;
8002
+ break;
7678
8003
  }
7679
- MediaProvider = _MediaProvider;
7680
- }
7681
- } else {
7682
- corelogger.warn(LOG_PREFIX, "Preferred media provider is not available.");
7683
- }
7684
- }
7685
- if (options.preferredMediaProviders && options.preferredMediaProviders.length > 0) {
7686
- var newMediaProvider = {};
7687
- for (var i in options.preferredMediaProviders) {
7688
- if (options.preferredMediaProviders.hasOwnProperty(i)) {
7689
- var pMP = options.preferredMediaProviders[i];
7690
- if (MediaProvider.hasOwnProperty(pMP)) {
7691
- newMediaProvider[pMP] = MediaProvider[pMP];
8004
+ throw new Error('None of MediaProviders available');
8005
+ case 18:
8006
+ if (options.preferredMediaProvider) {
8007
+ if (MediaProvider.hasOwnProperty(options.preferredMediaProvider)) {
8008
+ if (getMediaProviders()[0] != options.preferredMediaProvider) {
8009
+ // Just reorder media provider list
8010
+ _MediaProvider = {};
8011
+ _MediaProvider[options.preferredMediaProvider] = MediaProvider[options.preferredMediaProvider];
8012
+ for (p in MediaProvider) {
8013
+ _MediaProvider[p] = MediaProvider[p];
8014
+ }
8015
+ MediaProvider = _MediaProvider;
8016
+ }
8017
+ } else {
8018
+ corelogger.warn(LOG_PREFIX, "Preferred media provider is not available.");
8019
+ }
7692
8020
  }
7693
- }
7694
- }
7695
- if (util.isEmptyObject(newMediaProvider)) {
7696
- throw new Error("None of preferred MediaProviders available");
7697
- } else {
7698
- MediaProvider = newMediaProvider;
7699
- }
7700
- }
7701
- if (!waitingTemasys && options.mediaProvidersReadyCallback) {
7702
- options.mediaProvidersReadyCallback(Object.keys(MediaProvider));
7703
- }
7704
- coreLogger.info(LOG_PREFIX, "Initialized");
7705
- initialized = true;
7706
- }
7707
- };
8021
+ case 19:
8022
+ if (!(options.preferredMediaProviders && options.preferredMediaProviders.length > 0)) {
8023
+ _context.next = 27;
8024
+ break;
8025
+ }
8026
+ newMediaProvider = {};
8027
+ for (i in options.preferredMediaProviders) {
8028
+ if (options.preferredMediaProviders.hasOwnProperty(i)) {
8029
+ pMP = options.preferredMediaProviders[i];
8030
+ if (MediaProvider.hasOwnProperty(pMP)) {
8031
+ newMediaProvider[pMP] = MediaProvider[pMP];
8032
+ }
8033
+ }
8034
+ }
8035
+ if (!util.isEmptyObject(newMediaProvider)) {
8036
+ _context.next = 26;
8037
+ break;
8038
+ }
8039
+ throw new Error("None of preferred MediaProviders available");
8040
+ case 26:
8041
+ MediaProvider = newMediaProvider;
8042
+ case 27:
8043
+ if (!waitingTemasys && options.mediaProvidersReadyCallback) {
8044
+ options.mediaProvidersReadyCallback(Object.keys(MediaProvider));
8045
+ }
8046
+ coreLogger.info(LOG_PREFIX, "Initialized");
8047
+ initialized = true;
8048
+ _context.next = 32;
8049
+ return clientInfo.getClientInfo(window.navigator);
8050
+ case 32:
8051
+ clientUAData = _context.sent;
8052
+ coreLogger.info(LOG_PREFIX, "Client system data: " + JSON.stringify(clientUAData));
8053
+ case 34:
8054
+ case "end":
8055
+ return _context.stop();
8056
+ }
8057
+ }, _callee);
8058
+ }));
8059
+ return function init(_x) {
8060
+ return _ref.apply(this, arguments);
8061
+ };
8062
+ }();
7708
8063
 
7709
8064
  /**
7710
8065
  * Get available MediaProviders.
@@ -8090,6 +8445,9 @@ var createSession = function createSession(options) {
8090
8445
  msePacketizationVersion: 2,
8091
8446
  custom: options.custom
8092
8447
  };
8448
+ if (clientUAData) {
8449
+ cConfig.clientInfo = clientUAData;
8450
+ }
8093
8451
  if (sipConfig) {
8094
8452
  util.copyObjectPropsToAnotherObject(sipConfig, cConfig);
8095
8453
  }
@@ -8510,6 +8868,8 @@ var createSession = function createSession(options) {
8510
8868
  stripCodecs: stripCodecs
8511
8869
  });
8512
8870
  }).then(function (offer) {
8871
+ // Get local media info to send in publishStream message
8872
+ var localMediaInfo = collectLocalMediaInfo(MediaProvider[mediaProvider], localDisplay);
8513
8873
  send("call", {
8514
8874
  callId: id_,
8515
8875
  incoming: false,
@@ -8522,7 +8882,8 @@ var createSession = function createSession(options) {
8522
8882
  caller: login,
8523
8883
  callee: callee_,
8524
8884
  custom: options.custom,
8525
- visibleName: visibleName_
8885
+ visibleName: visibleName_,
8886
+ localMediaInfo: localMediaInfo
8526
8887
  });
8527
8888
  });
8528
8889
  })["catch"](function (error) {
@@ -8661,6 +9022,8 @@ var createSession = function createSession(options) {
8661
9022
  });
8662
9023
  }).then(function (sdp) {
8663
9024
  if (status_ != CALL_STATUS.FINISH && status_ != CALL_STATUS.FAILED) {
9025
+ // Get local media info to send in publishStream message
9026
+ var localMediaInfo = collectLocalMediaInfo(MediaProvider[mediaProvider], localDisplay);
8664
9027
  send("answer", {
8665
9028
  callId: id_,
8666
9029
  incoming: true,
@@ -8672,7 +9035,8 @@ var createSession = function createSession(options) {
8672
9035
  sipSDP: sipSDP,
8673
9036
  caller: cConfig.login,
8674
9037
  callee: callee_,
8675
- custom: options.custom
9038
+ custom: options.custom,
9039
+ localMediaInfo: localMediaInfo
8676
9040
  });
8677
9041
  } else {
8678
9042
  hangup();
@@ -9495,6 +9859,7 @@ var createSession = function createSession(options) {
9495
9859
  }
9496
9860
  return;
9497
9861
  }
9862
+
9498
9863
  //create mediaProvider connection
9499
9864
  MediaProvider[mediaProvider].createConnection({
9500
9865
  id: id_,
@@ -9517,6 +9882,8 @@ var createSession = function createSession(options) {
9517
9882
  });
9518
9883
  }).then(function (offer) {
9519
9884
  logger.debug(LOG_PREFIX, "Offer SDP:\n" + offer.sdp);
9885
+ // Get local media info to send in publishStream message
9886
+ var localMediaInfo = collectLocalMediaInfo(MediaProvider[mediaProvider], display);
9520
9887
  //publish stream with offer sdp to server
9521
9888
  send("publishStream", {
9522
9889
  mediaSessionId: id_,
@@ -9535,7 +9902,8 @@ var createSession = function createSession(options) {
9535
9902
  rtmpUrl: rtmpUrl,
9536
9903
  constraints: constraints,
9537
9904
  transport: transportType,
9538
- cvoExtension: cvoExtension
9905
+ cvoExtension: cvoExtension,
9906
+ localMediaInfo: localMediaInfo
9539
9907
  });
9540
9908
  });
9541
9909
  })["catch"](function (error) {
@@ -10072,7 +10440,7 @@ var createSession = function createSession(options) {
10072
10440
  * @inner
10073
10441
  */
10074
10442
  var available = function available() {
10075
- return new Promise(function (resolve, reject) {
10443
+ return new _Promise(function (resolve, reject) {
10076
10444
  send("availableStream", {
10077
10445
  mediaSessionId: id_,
10078
10446
  name: name_
@@ -10294,7 +10662,7 @@ var createSession = function createSession(options) {
10294
10662
  * @inner
10295
10663
  */
10296
10664
  exports.sendData = function (data) {
10297
- return new Promise(function (resolve, reject) {
10665
+ return new _Promise(function (resolve, reject) {
10298
10666
  var obj = {
10299
10667
  operationId: uuid_v1(),
10300
10668
  payload: data
@@ -10343,6 +10711,62 @@ var createSession = function createSession(options) {
10343
10711
  var getLogger = function getLogger() {
10344
10712
  return sessionLogger;
10345
10713
  };
10714
+ var collectLocalMediaInfo = function collectLocalMediaInfo(mediaProvider, display) {
10715
+ // Get devices available
10716
+ var videoCams = mediaProvider.videoCams || [];
10717
+ var mics = mediaProvider.mics || [];
10718
+ if (videoCams.length) {
10719
+ logger.info(LOG_PREFIX, "Video inputs available: " + JSON.stringify(videoCams));
10720
+ }
10721
+ if (mics.length) {
10722
+ logger.info(LOG_PREFIX, "Audio inputs available: " + JSON.stringify(mics));
10723
+ }
10724
+
10725
+ // Get track labels to identify publishing device
10726
+ var audioTracks = [];
10727
+ var videoTracks = [];
10728
+ var localVideo;
10729
+ if (mediaProvider.getCacheInstance) {
10730
+ localVideo = mediaProvider.getCacheInstance(display);
10731
+ }
10732
+ if (!localVideo && mediaProvider.getVideoElement) {
10733
+ localVideo = mediaProvider.getVideoElement(display);
10734
+ }
10735
+ if (localVideo) {
10736
+ localVideo.srcObject.getAudioTracks().forEach(function (track) {
10737
+ var device = track.label;
10738
+ if (device === "MediaStreamAudioDestinationNode" && mediaProvider.getAudioSourceDevice) {
10739
+ device = mediaProvider.getAudioSourceDevice();
10740
+ }
10741
+ audioTracks.push({
10742
+ trackId: track.id,
10743
+ device: device
10744
+ });
10745
+ });
10746
+ localVideo.srcObject.getVideoTracks().forEach(function (track) {
10747
+ videoTracks.push({
10748
+ trackId: track.id,
10749
+ device: track.label
10750
+ });
10751
+ });
10752
+ }
10753
+ if (videoTracks.length) {
10754
+ logger.info(LOG_PREFIX, "Video tracks captured: " + JSON.stringify(videoTracks));
10755
+ }
10756
+ if (audioTracks.length) {
10757
+ logger.info(LOG_PREFIX, "Audio tracks captured: " + JSON.stringify(audioTracks));
10758
+ }
10759
+ return {
10760
+ devices: {
10761
+ video: videoCams,
10762
+ audio: mics
10763
+ },
10764
+ tracks: {
10765
+ video: videoTracks,
10766
+ audio: audioTracks
10767
+ }
10768
+ };
10769
+ };
10346
10770
 
10347
10771
  //export Session
10348
10772
  session.id = id;
@@ -10389,7 +10813,7 @@ module.exports = {
10389
10813
  Browser: util.Browser
10390
10814
  };
10391
10815
 
10392
- },{"./constants":38,"./media-source-media-provider":1,"./temasys-media-provider":1,"./util":40,"./webrtc-media-provider":41,"./websocket-media-provider":1,"kalmanjs":2,"promise-polyfill":4,"uuid":8,"webrtc-adapter":23}],40:[function(require,module,exports){
10816
+ },{"./client-info":38,"./constants":39,"./media-source-media-provider":1,"./temasys-media-provider":1,"./util":41,"./webrtc-media-provider":42,"./websocket-media-provider":1,"kalmanjs":2,"promise-polyfill":4,"uuid":8,"webrtc-adapter":23}],41:[function(require,module,exports){
10393
10817
  'use strict';
10394
10818
 
10395
10819
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
@@ -10885,8 +11309,11 @@ module.exports = {
10885
11309
  setPublishingBitrate: setPublishingBitrate
10886
11310
  };
10887
11311
 
10888
- },{}],41:[function(require,module,exports){
11312
+ },{}],42:[function(require,module,exports){
10889
11313
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
11314
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
11315
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
11316
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
10890
11317
  -'use strict';
10891
11318
  var browserDetails = require('webrtc-adapter')["default"].browserDetails;
10892
11319
  var _require = require('uuid'),
@@ -10908,6 +11335,8 @@ var validBrowsers = ["firefox", "chrome", "safari"];
10908
11335
  var videoCams = [];
10909
11336
  // list of presented audio input devices
10910
11337
  var mics = [];
11338
+ // current audio source device label
11339
+ var audioSourceDevice = "";
10911
11340
  var createConnection = function createConnection(options) {
10912
11341
  return new Promise(function (resolve, reject) {
10913
11342
  // Set connection logger #WCS-2434
@@ -11343,18 +11772,25 @@ var createConnection = function createConnection(options) {
11343
11772
  stat.forEach(function (report) {
11344
11773
  if (!report.isRemote) {
11345
11774
  var mediaType = "";
11346
- if (report.type == 'outbound-rtp') {
11775
+ if (report.type === 'outbound-rtp') {
11347
11776
  mediaType = getReportMediaType(report);
11348
11777
  fillStatObject(result.outboundStream, report, mediaType);
11349
- if (mediaType == 'video') {
11778
+ if (mediaType === 'video') {
11350
11779
  getVideoSize(result.outboundStream[mediaType], report);
11351
11780
  }
11352
- } else if (report.type == 'inbound-rtp') {
11781
+ } else if (report.type === 'inbound-rtp') {
11353
11782
  mediaType = getReportMediaType(report);
11354
11783
  fillStatObject(result.inboundStream, report, mediaType);
11355
- if (mediaType == 'video') {
11784
+ if (mediaType === 'video') {
11356
11785
  getVideoSize(result.inboundStream[mediaType], report);
11357
11786
  }
11787
+ } else if (report.type === 'candidate-pair' && report.state === 'succeeded' && report.nominated) {
11788
+ if (report.availableIncomingBitrate) {
11789
+ result.otherStats.availableIncomingBitrate = report.availableIncomingBitrate;
11790
+ } else if (localVideo && report.availableOutgoingBitrate) {
11791
+ // availableOutgoingBitrate is defined for incoming stream too #WCS-4175
11792
+ result.otherStats.availableOutgoingBitrate = report.availableOutgoingBitrate;
11793
+ }
11358
11794
  }
11359
11795
  }
11360
11796
  });
@@ -11411,12 +11847,19 @@ var createConnection = function createConnection(options) {
11411
11847
  var codec = util.getCurrentCodecAndSampleRate(sdp, mediaType);
11412
11848
  obj[mediaType]["codec"] = codec.name;
11413
11849
  obj[mediaType]["codecRate"] = codec.sampleRate;
11850
+ var qualityLimitationDurations;
11414
11851
  Object.keys(report).forEach(function (key) {
11415
11852
  // Add audioLevel parameter parsing #WCS-3290
11416
- if (key.startsWith("bytes") || key.startsWith("packets") || key.indexOf("Count") != -1 || key.indexOf("audioLevel") != -1 || key == "framesPerSecond") {
11853
+ if (key.startsWith("bytes") || key.startsWith("packets") || key.indexOf("Count") != -1 || key.indexOf("audioLevel") != -1 || key === "framesPerSecond" || key === "qualityLimitationReason") {
11417
11854
  obj[mediaType][key] = report[key];
11418
11855
  }
11856
+ if (key === "qualityLimitationDurations") {
11857
+ qualityLimitationDurations = report[key];
11858
+ }
11419
11859
  });
11860
+ if (qualityLimitationDurations) {
11861
+ obj[mediaType]["qualityLimitationDurations"] = qualityLimitationDurations[obj[mediaType]["qualityLimitationReason"]];
11862
+ }
11420
11863
  };
11421
11864
  var fullScreen = function fullScreen() {
11422
11865
  var video = document.getElementById(id);
@@ -11807,10 +12250,18 @@ var getMediaAccess = function getMediaAccess(constraints, display, disableConstr
11807
12250
  // WCS-2933, fix mobile streaming issues, gather info about available devices before streaming, but not during
11808
12251
  listDevices(false).then(function (devices) {
11809
12252
  devices.video.forEach(function (device) {
11810
- videoCams.push(device);
12253
+ if (!videoCams.find(function (cam) {
12254
+ return device.id === cam.id;
12255
+ })) {
12256
+ videoCams.push(device);
12257
+ }
11811
12258
  });
11812
12259
  devices.audio.forEach(function (device) {
11813
- mics.push(device);
12260
+ if (!mics.find(function (mic) {
12261
+ return device.id === mic.id;
12262
+ })) {
12263
+ mics.push(device);
12264
+ }
11814
12265
  });
11815
12266
  navigator.getUserMedia(constraints, function (stream) {
11816
12267
  loadVideo(display, stream, screenShare, requestAudioConstraints, resolve, constraints, useCanvas);
@@ -12031,6 +12482,7 @@ var createGainNode = function createGainNode(stream) {
12031
12482
  source.connect(gainNode);
12032
12483
  gainNode.connect(destination);
12033
12484
  var sourceAudioTrack = stream.getAudioTracks()[0];
12485
+ audioSourceDevice = sourceAudioTrack.label;
12034
12486
  gainNode.sourceAudioTrack = sourceAudioTrack;
12035
12487
  gainNode.release = function () {
12036
12488
  this.sourceAudioTrack.stop();
@@ -12040,6 +12492,9 @@ var createGainNode = function createGainNode(stream) {
12040
12492
  stream.removeTrack(sourceAudioTrack);
12041
12493
  return gainNode;
12042
12494
  };
12495
+ var getAudioSourceDevice = function getAudioSourceDevice() {
12496
+ return audioSourceDevice;
12497
+ };
12043
12498
 
12044
12499
  //Fix to set screen resolution for screen sharing in Firefox
12045
12500
  var setScreenResolution = function setScreenResolution(video, stream, constraints) {
@@ -12157,6 +12612,30 @@ function getCacheInstance(display) {
12157
12612
  }
12158
12613
  }
12159
12614
  }
12615
+ function getVideoElement(display) {
12616
+ if (display) {
12617
+ var _iterator = _createForOfIteratorHelper(display.children),
12618
+ _step;
12619
+ try {
12620
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
12621
+ var child = _step.value;
12622
+ if (child.tagName.toLowerCase() === "video") {
12623
+ return child;
12624
+ } else {
12625
+ var grandchild = getVideoElement(child);
12626
+ if (grandchild) {
12627
+ return grandchild;
12628
+ }
12629
+ }
12630
+ }
12631
+ } catch (err) {
12632
+ _iterator.e(err);
12633
+ } finally {
12634
+ _iterator.f();
12635
+ }
12636
+ }
12637
+ return null;
12638
+ }
12160
12639
  function createVideoElement() {
12161
12640
  var useControls = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
12162
12641
  var video = document.createElement('video');
@@ -12278,8 +12757,8 @@ var listDevices = function listDevices(labels, kind, deviceConstraints) {
12278
12757
  return;
12279
12758
  }
12280
12759
  navigator.getUserMedia(constraints, function (stream) {
12281
- navigator.mediaDevices.enumerateDevices().then(function (devicesWithLabales) {
12282
- resolve(getList(devicesWithLabales));
12760
+ navigator.mediaDevices.enumerateDevices().then(function (devicesWithLabels) {
12761
+ resolve(getList(devicesWithLabels));
12283
12762
  stream.getTracks().forEach(function (track) {
12284
12763
  track.stop();
12285
12764
  });
@@ -12425,8 +12904,13 @@ module.exports = {
12425
12904
  logger = configuration.logger;
12426
12905
  createMicGainNode = typeof configuration.createMicGainNode !== 'undefined' ? configuration.createMicGainNode : true;
12427
12906
  logger.info(LOG_PREFIX, "Initialized");
12428
- }
12907
+ },
12908
+ videoCams: videoCams,
12909
+ mics: mics,
12910
+ getAudioSourceDevice: getAudioSourceDevice,
12911
+ getCacheInstance: getCacheInstance,
12912
+ getVideoElement: getVideoElement
12429
12913
  };
12430
12914
 
12431
- },{"./constants":38,"./util":40,"uuid":8,"webrtc-adapter":23}]},{},[39])(39)
12915
+ },{"./constants":39,"./util":41,"uuid":8,"webrtc-adapter":23}]},{},[40])(40)
12432
12916
  });