@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.
@@ -61,6 +61,8 @@ var createConnection = function (options) {
61
61
  var unmutePlayOnStart = options.unmutePlayOnStart !== undefined ? options.unmutePlayOnStart : true;
62
62
  // Use a standard HTML5 video controls if needed (to enable fullscreen in Safari 16 for example) #WCS-3606
63
63
  var useControls = options.useControls || false;
64
+ // Stream event handler to rise an event #WCS-4097
65
+ var unmuteRequiredEvent = options.unmuteRequiredEvent ? options.unmuteRequiredEvent : null;
64
66
 
65
67
  if (bidirectional) {
66
68
  localVideo = getCacheInstance(localDisplay);
@@ -174,6 +176,9 @@ var createConnection = function (options) {
174
176
  // Automatically unmute video if needed #WCS-2425
175
177
  if (unmutePlayOnStart) {
176
178
  remoteVideo.muted = false;
179
+ } else {
180
+ // Fire UNMUTE_REQUIRED stream event #WCS-4097
181
+ fireUnmuteEvent();
177
182
  }
178
183
  }).catch(function (e) {
179
184
  if (validBrowsers.includes(browserDetails.browser)) {
@@ -182,6 +187,8 @@ var createConnection = function (options) {
182
187
  logger.info(LOG_PREFIX, "Autoplay detected! Trying to play a video with a muted sound...");
183
188
  remoteVideo.muted = true;
184
189
  remoteVideo.play();
190
+ // Fire UNMUTE_REQUIRED stream event #WCS-4097
191
+ fireUnmuteEvent();
185
192
  } else {
186
193
  logger.error(LOG_PREFIX, e);
187
194
  }
@@ -793,6 +800,12 @@ var createConnection = function (options) {
793
800
  });
794
801
  };
795
802
 
803
+ var fireUnmuteEvent = function() {
804
+ if (unmuteRequiredEvent && typeof unmuteRequiredEvent === 'function') {
805
+ unmuteRequiredEvent();
806
+ }
807
+ };
808
+
796
809
  var exports = {};
797
810
  exports.state = state;
798
811
  exports.createOffer = createOffer;