@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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flashphoner/websdk",
3
- "version": "2.0.248",
3
+ "version": "2.0.250",
4
4
  "description": "Official Flashphoner WebCallServer WebSDK package",
5
5
  "main": "./src/flashphoner-core.js",
6
6
  "types": "./src/flashphoner-core.d.ts",
@@ -61,6 +61,7 @@ var disableConnectionQualityCalculation;
61
61
  * @param {String=} options.screenSharingExtensionId Chrome screen sharing extension id
62
62
  * @param {Object=} options.constraints Default local media constraints
63
63
  * @param {Object=} options.logger Core logger options
64
+ * @param {Boolean=} options.collectClientInfo Collect client OS and system data available for debugging purposes
64
65
  * @throws {Error} Error if none of MediaProviders available
65
66
  * @memberof Flashphoner
66
67
  */
@@ -196,8 +197,10 @@ var init = async function (options) {
196
197
  coreLogger.info(LOG_PREFIX, "Initialized");
197
198
  initialized = true;
198
199
 
199
- clientUAData = await clientInfo.getClientInfo(window.navigator);
200
- coreLogger.info(LOG_PREFIX, "Client system data: " + JSON.stringify(clientUAData));
200
+ if (options.collectClientInfo === undefined || options.collectClientInfo) {
201
+ clientUAData = await clientInfo.getClientInfo(window.navigator);
202
+ coreLogger.info(LOG_PREFIX, "Client system data: " + JSON.stringify(clientUAData));
203
+ }
201
204
  }
202
205
  };
203
206
 
@@ -441,6 +444,7 @@ var createLogger = function(loggerOptions, parentLogger = coreLogger) {
441
444
  * @param {Integer=} options.receiveProbes A maximum subsequental pings received missing count [0]
442
445
  * @param {Integer=} options.probesInterval Interval to check subsequental pings received [0]
443
446
  * @param {Object=} options.logger Session logger options
447
+ * @param {Boolean=} options.sendClientInfo Send client system info for debugging purposes
444
448
  * @returns {Session} Created session
445
449
  * @throws {Error} Error if API is not initialized
446
450
  * @throws {TypeError} Error if options.urlServer is not specified
@@ -470,6 +474,7 @@ var createSession = function (options) {
470
474
  var mediaOptions = options.mediaOptions;
471
475
  var keepAlive = options.keepAlive;
472
476
  var timeout = options.timeout;
477
+ var sendClientInfo = options.sendClientInfo !== undefined ? options.sendClientInfo : true;
473
478
  var wsPingSender = new WSPingSender(options.pingInterval || 0);
474
479
  var wsPingReceiver = new WSPingReceiver(options.receiveProbes || 0, options.probesInterval || 0);
475
480
  var connectionTimeout;
@@ -585,7 +590,7 @@ var createSession = function (options) {
585
590
  msePacketizationVersion: 2,
586
591
  custom: options.custom
587
592
  };
588
- if (clientUAData) {
593
+ if (sendClientInfo && clientUAData) {
589
594
  cConfig.clientInfo = clientUAData;
590
595
  }
591
596
  if (sipConfig) {
@@ -841,6 +846,7 @@ var createSession = function (options) {
841
846
  * @param {string=} options.videoContentHint Video content hint for browser ('motion' by default to maintain bitrate and fps), {@link Flashphoner.constants.CONTENT_HINT_TYPE}
842
847
  * @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
843
848
  * @param {Object=} options.logger Call logger options
849
+ * @param {Boolean=} options.collectDeviceInfo Collect a media devices info when publishing a WebRTC stream
844
850
  * @param {sdpHook} sdpHook The callback that handles sdp from the server
845
851
  * @returns {Call} Call
846
852
  * @throws {TypeError} Error if no options provided
@@ -905,6 +911,7 @@ var createSession = function (options) {
905
911
  var sipHeaders = options.sipHeaders;
906
912
  var videoContentHint = options.videoContentHint;
907
913
  var useControls = options.useControls;
914
+ var collectDeviceInfo = options.collectDeviceInfo !== undefined ? options.collectDeviceInfo : true;
908
915
 
909
916
  var minBitrate = getConstraintsProperty(constraints, CONSTRAINT_VIDEO_MIN_BITRATE, 0);
910
917
  var maxBitrate = getConstraintsProperty(constraints, CONSTRAINT_VIDEO_MAX_BITRATE, 0);
@@ -1018,9 +1025,7 @@ var createSession = function (options) {
1018
1025
  stripCodecs: stripCodecs
1019
1026
  });
1020
1027
  }).then(function (offer) {
1021
- // Get local media info to send in publishStream message
1022
- let localMediaInfo = collectLocalMediaInfo(MediaProvider[mediaProvider], localDisplay);
1023
- send("call", {
1028
+ let callData = {
1024
1029
  callId: id_,
1025
1030
  incoming: false,
1026
1031
  hasVideo: offer.hasVideo,
@@ -1032,9 +1037,13 @@ var createSession = function (options) {
1032
1037
  caller: login,
1033
1038
  callee: callee_,
1034
1039
  custom: options.custom,
1035
- visibleName: visibleName_,
1036
- localMediaInfo: localMediaInfo
1037
- });
1040
+ visibleName: visibleName_
1041
+ };
1042
+ // Get local media info to send in publishStream message
1043
+ if (collectDeviceInfo) {
1044
+ callData.localMediaInfo = collectLocalMediaInfo(MediaProvider[mediaProvider], localDisplay);
1045
+ }
1046
+ send("call", callData);
1038
1047
  });
1039
1048
  }).catch(function (error) {
1040
1049
  logger.error(LOG_PREFIX, error);
@@ -1167,9 +1176,7 @@ var createSession = function (options) {
1167
1176
  });
1168
1177
  }).then(function (sdp) {
1169
1178
  if (status_ != CALL_STATUS.FINISH && status_ != CALL_STATUS.FAILED) {
1170
- // Get local media info to send in publishStream message
1171
- let localMediaInfo = collectLocalMediaInfo(MediaProvider[mediaProvider], localDisplay);
1172
- send("answer", {
1179
+ let callData = {
1173
1180
  callId: id_,
1174
1181
  incoming: true,
1175
1182
  hasVideo: true,
@@ -1180,9 +1187,13 @@ var createSession = function (options) {
1180
1187
  sipSDP: sipSDP,
1181
1188
  caller: cConfig.login,
1182
1189
  callee: callee_,
1183
- custom: options.custom,
1184
- localMediaInfo: localMediaInfo
1185
- });
1190
+ custom: options.custom
1191
+ };
1192
+ // Get local media info to send in publishStream message
1193
+ if (collectDeviceInfo) {
1194
+ callData.localMediaInfo = collectLocalMediaInfo(MediaProvider[mediaProvider], localDisplay);
1195
+ }
1196
+ send("answer", callData);
1186
1197
  } else {
1187
1198
  hangup();
1188
1199
  }
@@ -1638,6 +1649,7 @@ var createSession = function (options) {
1638
1649
  * @param {Boolean=} options.unmutePlayOnStart Unmute playback on start. May be used after user gesture only, so set 'unmutePlayOnStart: false' for autoplay
1639
1650
  * @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
1640
1651
  * @param {Object=} options.logger Stream logger options
1652
+ * @param {Boolean=} options.collectDeviceInfo Collect a media devices info when publishing a WebRTC stream
1641
1653
  * @param {sdpHook} sdpHook The callback that handles sdp from the server
1642
1654
  * @returns {Stream} Stream
1643
1655
  * @throws {TypeError} Error if no options provided
@@ -1748,6 +1760,7 @@ var createSession = function (options) {
1748
1760
  var videoContentHint = options.videoContentHint;
1749
1761
  var unmutePlayOnStart = options.unmutePlayOnStart;
1750
1762
  var useControls = options.useControls;
1763
+ var collectDeviceInfo = options.collectDeviceInfo !== undefined ? options.collectDeviceInfo : true;
1751
1764
 
1752
1765
  var audioState_;
1753
1766
  var videoState_;
@@ -2044,10 +2057,7 @@ var createSession = function (options) {
2044
2057
  });
2045
2058
  }).then(function (offer) {
2046
2059
  logger.debug(LOG_PREFIX, "Offer SDP:\n" + offer.sdp);
2047
- // Get local media info to send in publishStream message
2048
- let localMediaInfo = collectLocalMediaInfo(MediaProvider[mediaProvider], display);
2049
- //publish stream with offer sdp to server
2050
- send("publishStream", {
2060
+ let publishStreamData = {
2051
2061
  mediaSessionId: id_,
2052
2062
  name: name_,
2053
2063
  published: published_,
@@ -2064,9 +2074,14 @@ var createSession = function (options) {
2064
2074
  rtmpUrl: rtmpUrl,
2065
2075
  constraints: constraints,
2066
2076
  transport: transportType,
2067
- cvoExtension: cvoExtension,
2068
- localMediaInfo: localMediaInfo
2069
- });
2077
+ cvoExtension: cvoExtension
2078
+ };
2079
+ // Get local media info to send in publishStream message
2080
+ if (collectDeviceInfo) {
2081
+ publishStreamData.localMediaInfo = collectLocalMediaInfo(MediaProvider[mediaProvider], display);
2082
+ }
2083
+ //publish stream with offer sdp to server
2084
+ send("publishStream", publishStreamData);
2070
2085
  });
2071
2086
  }).catch(function (error) {
2072
2087
  logger.warn(LOG_PREFIX, error);
@@ -2877,8 +2892,28 @@ var createSession = function (options) {
2877
2892
 
2878
2893
  const collectLocalMediaInfo = function (mediaProvider, display) {
2879
2894
  // Get devices available
2880
- let videoCams = mediaProvider.videoCams || [];
2881
- let mics = mediaProvider.mics || [];
2895
+ let videoCams = [];
2896
+ let mics = [];
2897
+
2898
+ if (mediaProvider.videoCams) {
2899
+ mediaProvider.videoCams.forEach((device) => {
2900
+ videoCams.push({
2901
+ id: device.id,
2902
+ label: encodeURI(device.label),
2903
+ type: device.type
2904
+ });
2905
+ });
2906
+ }
2907
+
2908
+ if (mediaProvider.mics) {
2909
+ mediaProvider.mics.forEach((device) => {
2910
+ mics.push({
2911
+ id: device.id,
2912
+ label: encodeURI(device.label),
2913
+ type: device.type
2914
+ });
2915
+ });
2916
+ }
2882
2917
 
2883
2918
  if (videoCams.length) {
2884
2919
  logger.info(LOG_PREFIX, "Video inputs available: " + JSON.stringify(videoCams));
@@ -2897,7 +2932,8 @@ var createSession = function (options) {
2897
2932
  if (!localVideo && mediaProvider.getVideoElement) {
2898
2933
  localVideo = mediaProvider.getVideoElement(display);
2899
2934
  }
2900
- if (localVideo) {
2935
+ // PR #19 from GitHub to prevent Sentry issue #WCS-4239
2936
+ if (localVideo && localVideo.srcObject) {
2901
2937
  localVideo.srcObject.getAudioTracks().forEach((track) => {
2902
2938
  let device = track.label;
2903
2939
  if (device === "MediaStreamAudioDestinationNode" && mediaProvider.getAudioSourceDevice) {
@@ -2905,13 +2941,13 @@ var createSession = function (options) {
2905
2941
  }
2906
2942
  audioTracks.push({
2907
2943
  trackId: track.id,
2908
- device: device
2944
+ device: encodeURI(device)
2909
2945
  });
2910
2946
  });
2911
2947
  localVideo.srcObject.getVideoTracks().forEach((track) => {
2912
2948
  videoTracks.push({
2913
2949
  trackId: track.id,
2914
- device: track.label
2950
+ device: encodeURI(track.label)
2915
2951
  });
2916
2952
  });
2917
2953
  }