@flashphoner/websdk 2.0.240 → 2.0.242

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.
@@ -8339,7 +8339,7 @@ var createSession = function createSession(options) {
8339
8339
  * @param {string=} options.stripCodecs Comma separated strings of codecs which should be stripped from WebRTC SDP (ex. "SILK,G722")
8340
8340
  * @param {Array<string>=} options.sipSDP Array of custom SDP params (ex. bandwidth (b=))
8341
8341
  * @param {Array<string>=} options.sipHeaders Array of custom SIP headers
8342
- * @param {string=} options.videoContentHint Video content hint for browser ('detail' by default to maintain resolution), {@link Flashphoner.constants.CONTENT_HINT_TYPE}
8342
+ * @param {string=} options.videoContentHint Video content hint for browser ('motion' by default to maintain bitrate and fps), {@link Flashphoner.constants.CONTENT_HINT_TYPE}
8343
8343
  * @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
8344
8344
  * @param {Object=} options.logger Call logger options
8345
8345
  * @param {sdpHook} sdpHook The callback that handles sdp from the server
@@ -9136,7 +9136,7 @@ var createSession = function createSession(options) {
9136
9136
  * @param {Boolean=} options.cvoExtension Enable rtp video orientation extension
9137
9137
  * @param {Integer=} options.playoutDelay Time delay between network reception of media and playout
9138
9138
  * @param {string=} options.useCanvasMediaStream EXPERIMENTAL: when publish bind browser's media stream to the canvas. It can be useful for image filtering
9139
- * @param {string=} options.videoContentHint Video content hint for browser ('detail' by default to maintain resolution), {@link Flashphoner.constants.CONTENT_HINT_TYPE}
9139
+ * @param {string=} options.videoContentHint Video content hint for browser ('motion' by default to maintain bitrate and fps), {@link Flashphoner.constants.CONTENT_HINT_TYPE}
9140
9140
  * @param {Boolean=} options.unmutePlayOnStart Unmute playback on start. May be used after user gesture only, so set 'unmutePlayOnStart: false' for autoplay
9141
9141
  * @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
9142
9142
  * @param {Object=} options.logger Stream logger options
@@ -9294,28 +9294,33 @@ var createSession = function createSession(options) {
9294
9294
  return;
9295
9295
  }
9296
9296
  var event = streamInfo.status;
9297
- if (event == INBOUND_VIDEO_RATE || event == OUTBOUND_VIDEO_RATE) {
9297
+ if (event === INBOUND_VIDEO_RATE || event === OUTBOUND_VIDEO_RATE) {
9298
9298
  detectConnectionQuality(event, streamInfo);
9299
9299
  return;
9300
9300
  }
9301
+ if (event === STREAM_EVENT) {
9302
+ if (!streamInfo.mediaSessionId) streamInfo.mediaSessionId = id_;
9303
+ streamEventRefreshHandlers[id_](streamInfo);
9304
+ return;
9305
+ }
9301
9306
 
9302
- //Depricated. WCS-3228: RESIZE, SNAPSHOT_COMPLETE and NOT_ENOUGH_BANDWIDTH moved to STREAM_EVENT
9303
- if (event == STREAM_STATUS.RESIZE) {
9307
+ //Deprecated. WCS-3228: RESIZE, SNAPSHOT_COMPLETE and NOT_ENOUGH_BANDWIDTH moved to STREAM_EVENT
9308
+ if (event === STREAM_STATUS.RESIZE) {
9304
9309
  resolution.width = streamInfo.streamerVideoWidth;
9305
9310
  resolution.height = streamInfo.streamerVideoHeight;
9306
- } else if (event == STREAM_STATUS.SNAPSHOT_COMPLETE) {} else if (event == STREAM_STATUS.NOT_ENOUGH_BANDWIDTH) {
9311
+ } else if (event === STREAM_STATUS.SNAPSHOT_COMPLETE) {} else if (event === STREAM_STATUS.NOT_ENOUGH_BANDWIDTH) {
9307
9312
  var info = streamInfo.info.split("/");
9308
9313
  remoteBitrate = info[0];
9309
9314
  networkBandwidth = info[1];
9310
9315
  } else {
9311
9316
  status_ = event;
9312
9317
  }
9313
- audioState_ = streamInfo.audioState;
9314
- videoState_ = streamInfo.videoState;
9318
+ if (streamInfo.audioState) audioState_ = streamInfo.audioState;
9319
+ if (streamInfo.videoState) videoState_ = streamInfo.videoState;
9315
9320
  if (streamInfo.info) info_ = streamInfo.info;
9316
9321
 
9317
9322
  //release stream
9318
- if (event == STREAM_STATUS.FAILED || event == STREAM_STATUS.STOPPED || event == STREAM_STATUS.UNPUBLISHED) {
9323
+ if (event === STREAM_STATUS.FAILED || event === STREAM_STATUS.STOPPED || event === STREAM_STATUS.UNPUBLISHED) {
9319
9324
  delete streams[id_];
9320
9325
  delete streamRefreshHandlers[id_];
9321
9326
  delete streamEventRefreshHandlers[id_];
@@ -9412,7 +9417,8 @@ var createSession = function createSession(options) {
9412
9417
  playoutDelay: playoutDelay,
9413
9418
  unmutePlayOnStart: unmutePlayOnStart,
9414
9419
  useControls: useControls,
9415
- logger: logger
9420
+ logger: logger,
9421
+ unmuteRequiredEvent: fireUnmuteEvent
9416
9422
  }, streamRefreshHandlers[id_]).then(function (newConnection) {
9417
9423
  mediaConnection = newConnection;
9418
9424
  try {
@@ -10087,6 +10093,16 @@ var createSession = function createSession(options) {
10087
10093
  var getLogger = function getLogger() {
10088
10094
  return streamLogger;
10089
10095
  };
10096
+ var fireUnmuteEvent = function fireUnmuteEvent() {
10097
+ if (isRemoteAudioMuted()) {
10098
+ if (streamRefreshHandlers[id_] && typeof streamRefreshHandlers[id_] === 'function') {
10099
+ streamRefreshHandlers[id_]({
10100
+ status: STREAM_EVENT,
10101
+ type: STREAM_EVENT_TYPE.UNMUTE_REQUIRED
10102
+ });
10103
+ }
10104
+ }
10105
+ };
10090
10106
  stream.play = play;
10091
10107
  stream.publish = publish;
10092
10108
  stream.stop = stop;
@@ -10930,11 +10946,14 @@ var createConnection = function createConnection(options) {
10930
10946
  var screenShare = false;
10931
10947
  var playoutDelay = options.playoutDelay;
10932
10948
  // Set video track contentHint to `detail` by default to workaround Chromium 91 bug #WCS-3257
10933
- var videoContentHint = options.videoContentHint ? options.videoContentHint : 'detail';
10949
+ // Set video track contentHint to `motion` by default to keep bitrate and fps for better camera stream quality #WCS-4109
10950
+ var videoContentHint = options.videoContentHint ? options.videoContentHint : 'motion';
10934
10951
  // Pass the option to unmute automatically (true by default) #WCS-2425
10935
10952
  var unmutePlayOnStart = options.unmutePlayOnStart !== undefined ? options.unmutePlayOnStart : true;
10936
10953
  // Use a standard HTML5 video controls if needed (to enable fullscreen in Safari 16 for example) #WCS-3606
10937
10954
  var useControls = options.useControls || false;
10955
+ // Stream event handler to rise an event #WCS-4097
10956
+ var unmuteRequiredEvent = options.unmuteRequiredEvent ? options.unmuteRequiredEvent : null;
10938
10957
  if (bidirectional) {
10939
10958
  localVideo = getCacheInstance(localDisplay);
10940
10959
  if (localVideo) {
@@ -11046,6 +11065,9 @@ var createConnection = function createConnection(options) {
11046
11065
  // Automatically unmute video if needed #WCS-2425
11047
11066
  if (unmutePlayOnStart) {
11048
11067
  remoteVideo.muted = false;
11068
+ } else {
11069
+ // Fire UNMUTE_REQUIRED stream event #WCS-4097
11070
+ fireUnmuteEvent();
11049
11071
  }
11050
11072
  })["catch"](function (e) {
11051
11073
  if (validBrowsers.includes(browserDetails.browser)) {
@@ -11054,6 +11076,8 @@ var createConnection = function createConnection(options) {
11054
11076
  logger.info(LOG_PREFIX, "Autoplay detected! Trying to play a video with a muted sound...");
11055
11077
  remoteVideo.muted = true;
11056
11078
  remoteVideo.play();
11079
+ // Fire UNMUTE_REQUIRED stream event #WCS-4097
11080
+ fireUnmuteEvent();
11057
11081
  } else {
11058
11082
  logger.error(LOG_PREFIX, e);
11059
11083
  }
@@ -11644,6 +11668,11 @@ var createConnection = function createConnection(options) {
11644
11668
  }
11645
11669
  });
11646
11670
  };
11671
+ var fireUnmuteEvent = function fireUnmuteEvent() {
11672
+ if (unmuteRequiredEvent && typeof unmuteRequiredEvent === 'function') {
11673
+ unmuteRequiredEvent();
11674
+ }
11675
+ };
11647
11676
  var exports = {};
11648
11677
  exports.state = state;
11649
11678
  exports.createOffer = createOffer;