@flashphoner/websdk 2.0.240 → 2.0.241

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.
@@ -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;
@@ -10935,6 +10951,8 @@ var createConnection = function createConnection(options) {
10935
10951
  var unmutePlayOnStart = options.unmutePlayOnStart !== undefined ? options.unmutePlayOnStart : true;
10936
10952
  // Use a standard HTML5 video controls if needed (to enable fullscreen in Safari 16 for example) #WCS-3606
10937
10953
  var useControls = options.useControls || false;
10954
+ // Stream event handler to rise an event #WCS-4097
10955
+ var unmuteRequiredEvent = options.unmuteRequiredEvent ? options.unmuteRequiredEvent : null;
10938
10956
  if (bidirectional) {
10939
10957
  localVideo = getCacheInstance(localDisplay);
10940
10958
  if (localVideo) {
@@ -11046,6 +11064,9 @@ var createConnection = function createConnection(options) {
11046
11064
  // Automatically unmute video if needed #WCS-2425
11047
11065
  if (unmutePlayOnStart) {
11048
11066
  remoteVideo.muted = false;
11067
+ } else {
11068
+ // Fire UNMUTE_REQUIRED stream event #WCS-4097
11069
+ fireUnmuteEvent();
11049
11070
  }
11050
11071
  })["catch"](function (e) {
11051
11072
  if (validBrowsers.includes(browserDetails.browser)) {
@@ -11054,6 +11075,8 @@ var createConnection = function createConnection(options) {
11054
11075
  logger.info(LOG_PREFIX, "Autoplay detected! Trying to play a video with a muted sound...");
11055
11076
  remoteVideo.muted = true;
11056
11077
  remoteVideo.play();
11078
+ // Fire UNMUTE_REQUIRED stream event #WCS-4097
11079
+ fireUnmuteEvent();
11057
11080
  } else {
11058
11081
  logger.error(LOG_PREFIX, e);
11059
11082
  }
@@ -11644,6 +11667,11 @@ var createConnection = function createConnection(options) {
11644
11667
  }
11645
11668
  });
11646
11669
  };
11670
+ var fireUnmuteEvent = function fireUnmuteEvent() {
11671
+ if (unmuteRequiredEvent && typeof unmuteRequiredEvent === 'function') {
11672
+ unmuteRequiredEvent();
11673
+ }
11674
+ };
11647
11675
  var exports = {};
11648
11676
  exports.state = state;
11649
11677
  exports.createOffer = createOffer;