@flashphoner/websdk 2.0.205 → 2.0.209

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.
@@ -371,7 +371,7 @@ process.umask = function () {
371
371
 
372
372
  },{}],4:[function(require,module,exports){
373
373
  (function (setImmediate){(function (){
374
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
374
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
375
375
 
376
376
  (function (root) {
377
377
  // Store setTimeout reference so promise-polyfill will be unaffected by
@@ -2434,7 +2434,7 @@ module.exports = function (window, edgeVersion) {
2434
2434
  /* eslint-env node */
2435
2435
  'use strict'; // SDP helpers.
2436
2436
 
2437
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2437
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2438
2438
 
2439
2439
  var SDPUtils = {}; // Generate an alphanumeric identifier for cname or mids.
2440
2440
  // TODO: use UUIDs instead? https://gist.github.com/jed/982883
@@ -4467,7 +4467,7 @@ function adapterFactory() {
4467
4467
  /* eslint-env node */
4468
4468
  'use strict';
4469
4469
 
4470
- function _typeof2(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); }
4470
+ function _typeof2(obj) { "@babel/helpers - typeof"; return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof2(obj); }
4471
4471
 
4472
4472
  Object.defineProperty(exports, "__esModule", {
4473
4473
  value: true
@@ -5392,7 +5392,7 @@ function shimGetDisplayMedia(window, getSourceId) {
5392
5392
  /* eslint-env node */
5393
5393
  'use strict';
5394
5394
 
5395
- function _typeof2(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); }
5395
+ function _typeof2(obj) { "@babel/helpers - typeof"; return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof2(obj); }
5396
5396
 
5397
5397
  Object.defineProperty(exports, "__esModule", {
5398
5398
  value: true
@@ -5651,7 +5651,7 @@ function shimGetUserMedia(window, browserDetails) {
5651
5651
  /* eslint-env node */
5652
5652
  'use strict';
5653
5653
 
5654
- function _typeof2(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); }
5654
+ function _typeof2(obj) { "@babel/helpers - typeof"; return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof2(obj); }
5655
5655
 
5656
5656
  Object.defineProperty(exports, "__esModule", {
5657
5657
  value: true
@@ -6400,7 +6400,7 @@ function shimGetUserMedia(window) {
6400
6400
  /* eslint-env node */
6401
6401
  'use strict';
6402
6402
 
6403
- function _typeof2(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); }
6403
+ function _typeof2(obj) { "@babel/helpers - typeof"; return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof2(obj); }
6404
6404
 
6405
6405
  Object.defineProperty(exports, "__esModule", {
6406
6406
  value: true
@@ -6853,7 +6853,7 @@ function shimGetDisplayMedia(window, preferredMediaSource) {
6853
6853
  /* eslint-env node */
6854
6854
  'use strict';
6855
6855
 
6856
- function _typeof2(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); }
6856
+ function _typeof2(obj) { "@babel/helpers - typeof"; return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof2(obj); }
6857
6857
 
6858
6858
  Object.defineProperty(exports, "__esModule", {
6859
6859
  value: true
@@ -6955,7 +6955,7 @@ function shimGetUserMedia(window, browserDetails) {
6955
6955
  */
6956
6956
  'use strict';
6957
6957
 
6958
- function _typeof2(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); }
6958
+ function _typeof2(obj) { "@babel/helpers - typeof"; return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof2(obj); }
6959
6959
 
6960
6960
  Object.defineProperty(exports, "__esModule", {
6961
6961
  value: true
@@ -7406,7 +7406,7 @@ function shimAudioContext(window) {
7406
7406
  /* eslint-env node */
7407
7407
  'use strict';
7408
7408
 
7409
- function _typeof2(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); }
7409
+ function _typeof2(obj) { "@babel/helpers - typeof"; return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof2(obj); }
7410
7410
 
7411
7411
  Object.defineProperty(exports, "__esModule", {
7412
7412
  value: true
@@ -8443,7 +8443,7 @@ module.exports = constants;
8443
8443
  },{}],39:[function(require,module,exports){
8444
8444
  'use strict';
8445
8445
 
8446
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
8446
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
8447
8447
 
8448
8448
  var _require = require('uuid'),
8449
8449
  uuid_v1 = _require.v1;
@@ -8898,6 +8898,9 @@ var getSession = function getSession(id) {
8898
8898
  * @param {Object=} options.sipOptions Sip configuration
8899
8899
  * @param {Object=} options.mediaOptions Media connection configuration
8900
8900
  * @param {Integer=} options.timeout Connection timeout in milliseconds
8901
+ * @param {Integer=} options.pingInterval Server ping interval in milliseconds [0]
8902
+ * @param {Integer=} options.receiveProbes A maximum subsequental pings received missing count [0]
8903
+ * @param {Integer=} options.probesInterval Interval to check subsequental pings received [0]
8901
8904
  * @returns {Session} Created session
8902
8905
  * @throws {Error} Error if API is not initialized
8903
8906
  * @throws {TypeError} Error if options.urlServer is not specified
@@ -8924,6 +8927,8 @@ var createSession = function createSession(options) {
8924
8927
  var mediaOptions = options.mediaOptions;
8925
8928
  var keepAlive = options.keepAlive;
8926
8929
  var timeout = options.timeout;
8930
+ var wsPingSender = new WSPingSender(options.pingInterval || 0);
8931
+ var wsPingReceiver = new WSPingReceiver(options.receiveProbes || 0, options.probesInterval || 0);
8927
8932
  var connectionTimeout;
8928
8933
  var cConfig; //SIP config
8929
8934
 
@@ -9041,7 +9046,7 @@ var createSession = function createSession(options) {
9041
9046
  mediaProviders: Object.keys(MediaProvider),
9042
9047
  keepAlive: keepAlive,
9043
9048
  authToken: authToken,
9044
- clientVersion: "2.0.205",
9049
+ clientVersion: "2.0.209",
9045
9050
  clientOSVersion: window.navigator.appVersion,
9046
9051
  clientBrowserVersion: window.navigator.userAgent,
9047
9052
  msePacketizationVersion: 2,
@@ -9054,7 +9059,11 @@ var createSession = function createSession(options) {
9054
9059
 
9055
9060
 
9056
9061
  send("connection", cConfig);
9057
- logger.setConnection(wsConnection);
9062
+ logger.setConnection(wsConnection); // Send ping messages to server to check if connection is still alive #WCS-3410
9063
+
9064
+ wsPingSender.start(); // Check subsequintel pings received from server to check if connection is still alive #WCS-3410
9065
+
9066
+ wsPingReceiver.start();
9058
9067
  };
9059
9068
 
9060
9069
  wsConnection.onmessage = function (event) {
@@ -9070,6 +9079,7 @@ var createSession = function createSession(options) {
9070
9079
  switch (data.message) {
9071
9080
  case 'ping':
9072
9081
  send("pong", null);
9082
+ wsPingReceiver.success();
9073
9083
  break;
9074
9084
 
9075
9085
  case 'getUserData':
@@ -9229,7 +9239,11 @@ var createSession = function createSession(options) {
9229
9239
  sessionStatus = newStatus;
9230
9240
 
9231
9241
  if (sessionStatus == SESSION_STATUS.DISCONNECTED || sessionStatus == SESSION_STATUS.FAILED) {
9232
- //remove streams
9242
+ // Stop pinging server #WCS-3410
9243
+ wsPingSender.stop(); // Stop checking pings received #WCS-3410
9244
+
9245
+ wsPingReceiver.stop(); //remove streams
9246
+
9233
9247
  for (var prop in streamRefreshHandlers) {
9234
9248
  if (streamRefreshHandlers.hasOwnProperty(prop) && typeof streamRefreshHandlers[prop] === 'function') {
9235
9249
  streamRefreshHandlers[prop]({
@@ -9245,6 +9259,73 @@ var createSession = function createSession(options) {
9245
9259
  if (callbacks[sessionStatus]) {
9246
9260
  callbacks[sessionStatus](session, obj);
9247
9261
  }
9262
+ } // Websocket periodic ping sender
9263
+
9264
+
9265
+ function WSPingSender(interval) {
9266
+ this.interval = interval || 0;
9267
+ this.intervalId = null;
9268
+
9269
+ this.start = function () {
9270
+ if (this.interval > 0) {
9271
+ this.intervalId = setInterval(function () {
9272
+ send("ping", null);
9273
+ }, this.interval);
9274
+ }
9275
+ };
9276
+
9277
+ this.stop = function () {
9278
+ if (this.intervalId) {
9279
+ clearInterval(this.intervalId);
9280
+ }
9281
+ };
9282
+
9283
+ return this;
9284
+ } // Websocket ping receive prober
9285
+
9286
+
9287
+ function WSPingReceiver(receiveProbes, probesInterval) {
9288
+ this.maxPings = receiveProbes || 0;
9289
+ this.interval = probesInterval || 0;
9290
+ this.intervalId = null;
9291
+ this.pingsMissing = 0;
9292
+
9293
+ this.start = function () {
9294
+ if (this.maxPings > 0 && this.interval > 0) {
9295
+ var receiver = this;
9296
+ this.intervalId = setInterval(function () {
9297
+ receiver.checkPingsReceived();
9298
+ }, this.interval);
9299
+ }
9300
+ };
9301
+
9302
+ this.stop = function () {
9303
+ if (this.intervalId) {
9304
+ clearInterval(this.intervalId);
9305
+ }
9306
+
9307
+ this.pingsMissing = 0;
9308
+ };
9309
+
9310
+ this.checkPingsReceived = function () {
9311
+ this.pingsMissing++;
9312
+
9313
+ if (this.pingsMissing >= this.maxPings) {
9314
+ this.failure();
9315
+ }
9316
+ };
9317
+
9318
+ this.success = function () {
9319
+ this.pingsMissing = 0;
9320
+ };
9321
+
9322
+ this.failure = function () {
9323
+ logger.info(LOG_PREFIX, "Missing " + this.pingsMissing + " pings from server, connection seems to be down");
9324
+ onSessionStatusChange(SESSION_STATUS.FAILED);
9325
+ wsConnection.close();
9326
+ };
9327
+
9328
+ return this;
9248
9329
  }
9249
9330
  /**
9250
9331
  * @callback sdpHook
@@ -11859,7 +11940,7 @@ module.exports = {
11859
11940
  },{}],41:[function(require,module,exports){
11860
11941
  'use strict';
11861
11942
 
11862
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
11943
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
11863
11944
 
11864
11945
  var browserDetails = require('webrtc-adapter')["default"].browserDetails;
11865
11946
 
@@ -12346,7 +12427,7 @@ var createConnection = function createConnection(options) {
12346
12427
  if (report.type == 'outbound-rtp') {
12347
12428
  fillStatObject(result.outboundStream, report);
12348
12429
 
12349
- if (report.mediaType == 'video') {
12430
+ if (report.mediaType == 'video' && localVideo != undefined && localVideo != null) {
12350
12431
  var vSettings = localVideo.srcObject.getVideoTracks()[0].getSettings();
12351
12432
  result.outboundStream[report.mediaType].height = vSettings.height;
12352
12433
  result.outboundStream[report.mediaType].width = vSettings.width;
@@ -12354,7 +12435,7 @@ var createConnection = function createConnection(options) {
12354
12435
  } else if (report.type == 'inbound-rtp') {
12355
12436
  fillStatObject(result.inboundStream, report);
12356
12437
 
12357
- if (report.mediaType == 'video' && remoteVideo != undefined) {
12438
+ if (report.mediaType == 'video' && remoteVideo != undefined && remoteVideo != null) {
12358
12439
  result.inboundStream[report.mediaType].height = remoteVideo.videoHeight;
12359
12440
  result.inboundStream[report.mediaType].width = remoteVideo.videoWidth;
12360
12441
  }
@@ -12527,7 +12608,7 @@ var createConnection = function createConnection(options) {
12527
12608
  clonedConstraints.video.mediaSource = source;
12528
12609
  }
12529
12610
 
12530
- if (window.chrome && woExtension) {
12611
+ if (woExtension) {
12531
12612
  getScreenDeviceIdWoExtension(clonedConstraints).then(function (screenSharingConstraints) {
12532
12613
  navigator.mediaDevices.getDisplayMedia(screenSharingConstraints).then(function (stream) {
12533
12614
  processScreenStream(stream, resolve);