@flashphoner/websdk 2.0.248 → 2.0.250

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.
@@ -7896,6 +7896,7 @@ var disableConnectionQualityCalculation;
7896
7896
  * @param {String=} options.screenSharingExtensionId Chrome screen sharing extension id
7897
7897
  * @param {Object=} options.constraints Default local media constraints
7898
7898
  * @param {Object=} options.logger Core logger options
7899
+ * @param {Boolean=} options.collectClientInfo Collect client OS and system data available for debugging purposes
7899
7900
  * @throws {Error} Error if none of MediaProviders available
7900
7901
  * @memberof Flashphoner
7901
7902
  */
@@ -7906,7 +7907,7 @@ var init = /*#__PURE__*/function () {
7906
7907
  while (1) switch (_context.prev = _context.next) {
7907
7908
  case 0:
7908
7909
  if (initialized) {
7909
- _context.next = 34;
7910
+ _context.next = 35;
7910
7911
  break;
7911
7912
  }
7912
7913
  if (!options) {
@@ -8045,12 +8046,16 @@ var init = /*#__PURE__*/function () {
8045
8046
  }
8046
8047
  coreLogger.info(LOG_PREFIX, "Initialized");
8047
8048
  initialized = true;
8048
- _context.next = 32;
8049
+ if (!(options.collectClientInfo === undefined || options.collectClientInfo)) {
8050
+ _context.next = 35;
8051
+ break;
8052
+ }
8053
+ _context.next = 33;
8049
8054
  return clientInfo.getClientInfo(window.navigator);
8050
- case 32:
8055
+ case 33:
8051
8056
  clientUAData = _context.sent;
8052
8057
  coreLogger.info(LOG_PREFIX, "Client system data: " + JSON.stringify(clientUAData));
8053
- case 34:
8058
+ case 35:
8054
8059
  case "end":
8055
8060
  return _context.stop();
8056
8061
  }
@@ -8306,6 +8311,7 @@ var createLogger = function createLogger(loggerOptions) {
8306
8311
  * @param {Integer=} options.receiveProbes A maximum subsequental pings received missing count [0]
8307
8312
  * @param {Integer=} options.probesInterval Interval to check subsequental pings received [0]
8308
8313
  * @param {Object=} options.logger Session logger options
8314
+ * @param {Boolean=} options.sendClientInfo Send client system info for debugging purposes
8309
8315
  * @returns {Session} Created session
8310
8316
  * @throws {Error} Error if API is not initialized
8311
8317
  * @throws {TypeError} Error if options.urlServer is not specified
@@ -8333,6 +8339,7 @@ var createSession = function createSession(options) {
8333
8339
  var mediaOptions = options.mediaOptions;
8334
8340
  var keepAlive = options.keepAlive;
8335
8341
  var timeout = options.timeout;
8342
+ var sendClientInfo = options.sendClientInfo !== undefined ? options.sendClientInfo : true;
8336
8343
  var wsPingSender = new WSPingSender(options.pingInterval || 0);
8337
8344
  var wsPingReceiver = new WSPingReceiver(options.receiveProbes || 0, options.probesInterval || 0);
8338
8345
  var connectionTimeout;
@@ -8445,7 +8452,7 @@ var createSession = function createSession(options) {
8445
8452
  msePacketizationVersion: 2,
8446
8453
  custom: options.custom
8447
8454
  };
8448
- if (clientUAData) {
8455
+ if (sendClientInfo && clientUAData) {
8449
8456
  cConfig.clientInfo = clientUAData;
8450
8457
  }
8451
8458
  if (sipConfig) {
@@ -8700,6 +8707,7 @@ var createSession = function createSession(options) {
8700
8707
  * @param {string=} options.videoContentHint Video content hint for browser ('motion' by default to maintain bitrate and fps), {@link Flashphoner.constants.CONTENT_HINT_TYPE}
8701
8708
  * @param {Boolean=} options.useControls Use a standard HTML5 video controls (play, pause, fullscreen). May be a workaround for fullscreen mode to work in Safari 16
8702
8709
  * @param {Object=} options.logger Call logger options
8710
+ * @param {Boolean=} options.collectDeviceInfo Collect a media devices info when publishing a WebRTC stream
8703
8711
  * @param {sdpHook} sdpHook The callback that handles sdp from the server
8704
8712
  * @returns {Call} Call
8705
8713
  * @throws {TypeError} Error if no options provided
@@ -8758,6 +8766,7 @@ var createSession = function createSession(options) {
8758
8766
  var sipHeaders = options.sipHeaders;
8759
8767
  var videoContentHint = options.videoContentHint;
8760
8768
  var useControls = options.useControls;
8769
+ var collectDeviceInfo = options.collectDeviceInfo !== undefined ? options.collectDeviceInfo : true;
8761
8770
  var minBitrate = getConstraintsProperty(constraints, CONSTRAINT_VIDEO_MIN_BITRATE, 0);
8762
8771
  var maxBitrate = getConstraintsProperty(constraints, CONSTRAINT_VIDEO_MAX_BITRATE, 0);
8763
8772
 
@@ -8868,9 +8877,7 @@ var createSession = function createSession(options) {
8868
8877
  stripCodecs: stripCodecs
8869
8878
  });
8870
8879
  }).then(function (offer) {
8871
- // Get local media info to send in publishStream message
8872
- var localMediaInfo = collectLocalMediaInfo(MediaProvider[mediaProvider], localDisplay);
8873
- send("call", {
8880
+ var callData = {
8874
8881
  callId: id_,
8875
8882
  incoming: false,
8876
8883
  hasVideo: offer.hasVideo,
@@ -8882,9 +8889,13 @@ var createSession = function createSession(options) {
8882
8889
  caller: login,
8883
8890
  callee: callee_,
8884
8891
  custom: options.custom,
8885
- visibleName: visibleName_,
8886
- localMediaInfo: localMediaInfo
8887
- });
8892
+ visibleName: visibleName_
8893
+ };
8894
+ // Get local media info to send in publishStream message
8895
+ if (collectDeviceInfo) {
8896
+ callData.localMediaInfo = collectLocalMediaInfo(MediaProvider[mediaProvider], localDisplay);
8897
+ }
8898
+ send("call", callData);
8888
8899
  });
8889
8900
  })["catch"](function (error) {
8890
8901
  logger.error(LOG_PREFIX, error);
@@ -9022,9 +9033,7 @@ var createSession = function createSession(options) {
9022
9033
  });
9023
9034
  }).then(function (sdp) {
9024
9035
  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);
9027
- send("answer", {
9036
+ var callData = {
9028
9037
  callId: id_,
9029
9038
  incoming: true,
9030
9039
  hasVideo: true,
@@ -9035,9 +9044,13 @@ var createSession = function createSession(options) {
9035
9044
  sipSDP: sipSDP,
9036
9045
  caller: cConfig.login,
9037
9046
  callee: callee_,
9038
- custom: options.custom,
9039
- localMediaInfo: localMediaInfo
9040
- });
9047
+ custom: options.custom
9048
+ };
9049
+ // Get local media info to send in publishStream message
9050
+ if (collectDeviceInfo) {
9051
+ callData.localMediaInfo = collectLocalMediaInfo(MediaProvider[mediaProvider], localDisplay);
9052
+ }
9053
+ send("answer", callData);
9041
9054
  } else {
9042
9055
  hangup();
9043
9056
  }
@@ -9504,6 +9517,7 @@ var createSession = function createSession(options) {
9504
9517
  * @param {Boolean=} options.unmutePlayOnStart Unmute playback on start. May be used after user gesture only, so set 'unmutePlayOnStart: false' for autoplay
9505
9518
  * @param {Boolean=} options.useControls Use a standard HTML5 video controls (play, pause, fullscreen). May be a workaround for fullscreen mode to work in Safari 16
9506
9519
  * @param {Object=} options.logger Stream logger options
9520
+ * @param {Boolean=} options.collectDeviceInfo Collect a media devices info when publishing a WebRTC stream
9507
9521
  * @param {sdpHook} sdpHook The callback that handles sdp from the server
9508
9522
  * @returns {Stream} Stream
9509
9523
  * @throws {TypeError} Error if no options provided
@@ -9609,6 +9623,7 @@ var createSession = function createSession(options) {
9609
9623
  var videoContentHint = options.videoContentHint;
9610
9624
  var unmutePlayOnStart = options.unmutePlayOnStart;
9611
9625
  var useControls = options.useControls;
9626
+ var collectDeviceInfo = options.collectDeviceInfo !== undefined ? options.collectDeviceInfo : true;
9612
9627
  var audioState_;
9613
9628
  var videoState_;
9614
9629
  var connectionQuality;
@@ -9882,10 +9897,7 @@ var createSession = function createSession(options) {
9882
9897
  });
9883
9898
  }).then(function (offer) {
9884
9899
  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);
9887
- //publish stream with offer sdp to server
9888
- send("publishStream", {
9900
+ var publishStreamData = {
9889
9901
  mediaSessionId: id_,
9890
9902
  name: name_,
9891
9903
  published: published_,
@@ -9902,9 +9914,14 @@ var createSession = function createSession(options) {
9902
9914
  rtmpUrl: rtmpUrl,
9903
9915
  constraints: constraints,
9904
9916
  transport: transportType,
9905
- cvoExtension: cvoExtension,
9906
- localMediaInfo: localMediaInfo
9907
- });
9917
+ cvoExtension: cvoExtension
9918
+ };
9919
+ // Get local media info to send in publishStream message
9920
+ if (collectDeviceInfo) {
9921
+ publishStreamData.localMediaInfo = collectLocalMediaInfo(MediaProvider[mediaProvider], display);
9922
+ }
9923
+ //publish stream with offer sdp to server
9924
+ send("publishStream", publishStreamData);
9908
9925
  });
9909
9926
  })["catch"](function (error) {
9910
9927
  logger.warn(LOG_PREFIX, error);
@@ -10713,8 +10730,26 @@ var createSession = function createSession(options) {
10713
10730
  };
10714
10731
  var collectLocalMediaInfo = function collectLocalMediaInfo(mediaProvider, display) {
10715
10732
  // Get devices available
10716
- var videoCams = mediaProvider.videoCams || [];
10717
- var mics = mediaProvider.mics || [];
10733
+ var videoCams = [];
10734
+ var mics = [];
10735
+ if (mediaProvider.videoCams) {
10736
+ mediaProvider.videoCams.forEach(function (device) {
10737
+ videoCams.push({
10738
+ id: device.id,
10739
+ label: encodeURI(device.label),
10740
+ type: device.type
10741
+ });
10742
+ });
10743
+ }
10744
+ if (mediaProvider.mics) {
10745
+ mediaProvider.mics.forEach(function (device) {
10746
+ mics.push({
10747
+ id: device.id,
10748
+ label: encodeURI(device.label),
10749
+ type: device.type
10750
+ });
10751
+ });
10752
+ }
10718
10753
  if (videoCams.length) {
10719
10754
  logger.info(LOG_PREFIX, "Video inputs available: " + JSON.stringify(videoCams));
10720
10755
  }
@@ -10732,7 +10767,8 @@ var createSession = function createSession(options) {
10732
10767
  if (!localVideo && mediaProvider.getVideoElement) {
10733
10768
  localVideo = mediaProvider.getVideoElement(display);
10734
10769
  }
10735
- if (localVideo) {
10770
+ // PR #19 from GitHub to prevent Sentry issue #WCS-4239
10771
+ if (localVideo && localVideo.srcObject) {
10736
10772
  localVideo.srcObject.getAudioTracks().forEach(function (track) {
10737
10773
  var device = track.label;
10738
10774
  if (device === "MediaStreamAudioDestinationNode" && mediaProvider.getAudioSourceDevice) {
@@ -10740,13 +10776,13 @@ var createSession = function createSession(options) {
10740
10776
  }
10741
10777
  audioTracks.push({
10742
10778
  trackId: track.id,
10743
- device: device
10779
+ device: encodeURI(device)
10744
10780
  });
10745
10781
  });
10746
10782
  localVideo.srcObject.getVideoTracks().forEach(function (track) {
10747
10783
  videoTracks.push({
10748
10784
  trackId: track.id,
10749
- device: track.label
10785
+ device: encodeURI(track.label)
10750
10786
  });
10751
10787
  });
10752
10788
  }