@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.
@@ -1,4 +1,4 @@
1
- Web SDK - 2.0.240
1
+ Web SDK - 2.0.241
2
2
 
3
3
  [Download builds](https://docs.flashphoner.com/display/WEBSDK2EN/Web+SDK+release+notes)
4
4
 
@@ -167,6 +167,8 @@ function playStream(session) {
167
167
  console.log("Not enough bandwidth, consider using lower video resolution or bitrate. Bandwidth " + (Math.round(networkBandwidth / 1000)) + " bitrate " + (Math.round(remoteBitrate / 1000)));
168
168
  } else if (STREAM_EVENT_TYPE.RESIZE === streamEvent.type) {
169
169
  console.log("New video size: " + streamEvent.payload.streamerVideoWidth + "x" + streamEvent.payload.streamerVideoHeight);
170
+ } else if (STREAM_EVENT_TYPE.UNMUTE_REQUIRED === streamEvent.type) {
171
+ console.log("Stream is muted by autoplay policy, user action required to unmute");
170
172
  }
171
173
  });
172
174
  playingStream.play();
@@ -54,6 +54,14 @@
54
54
  <div id="volumeControl" style="margin-top: 12px"></div>
55
55
  </div>
56
56
  </div>
57
+ <div id="unmute" class="form-group">
58
+ <label class="col-sm-2 control-label">Unmute</label>
59
+ <div class="col-sm-1">
60
+ <button type="button" class="btn btn-default btn-sm" id="unmuteBtn">
61
+ <span class="glyphicon glyphicon-volume-off"></span>
62
+ </button>
63
+ </div>
64
+ </div>
57
65
  <div id="fullScreen" class="form-group">
58
66
  <label class="col-sm-2 control-label">Full Screen</label>
59
67
  <div class="col-sm-1" >
@@ -44,12 +44,8 @@ function init_page() {
44
44
  step: 10,
45
45
  animate: true,
46
46
  slide: function(event, ui) {
47
- //WCS-2375. fixed autoplay in ios safari
48
- if (stream.isRemoteAudioMuted()) {
49
- stream.unmuteRemoteAudio();
50
- }
51
47
  currentVolumeValue = ui.value;
52
- stream.setVolume(currentVolumeValue);
48
+ setStreamVolume(stream, currentVolumeValue);
53
49
  }
54
50
  }).slider("disable");
55
51
  onStopped();
@@ -87,6 +83,8 @@ function onStopped() {
87
83
  $("#volumeControl").slider("disable");
88
84
  $("#fullScreenBtn").prop('disabled', true);
89
85
  $("#preloader").hide();
86
+ $("#unmuteBtn").off('click').click(unmuteBtnClick);
87
+ $("#unmute").hide();
90
88
  }
91
89
 
92
90
  function playBtnClick() {
@@ -108,6 +106,11 @@ function playBtnClick() {
108
106
  }
109
107
  }
110
108
 
109
+ function unmuteBtnClick() {
110
+ setStreamVolume(stream, currentVolumeValue)
111
+ $("#volumeControl").slider('value', currentVolumeValue);
112
+ }
113
+
111
114
  function start() {
112
115
  var url = $('#url').val();
113
116
  //check if we already have session
@@ -200,6 +203,14 @@ function playStream(session) {
200
203
  video.addEventListener("playing", function () {
201
204
  $("#preloader").hide();
202
205
  });
206
+ // Hide unmute button
207
+ video.addEventListener("volumechange", function () {
208
+ if (video.muted) {
209
+ $("#unmute").show();
210
+ } else {
211
+ $("#unmute").hide();
212
+ }
213
+ });
203
214
  }
204
215
  }).on(STREAM_STATUS.PLAYING, function (stream) {
205
216
  // Android Firefox may pause stream playback via MSE even if video element is muted
@@ -225,8 +236,10 @@ function playStream(session) {
225
236
  console.log("Not enough bandwidth, consider using lower video resolution or bitrate. Bandwidth " + (Math.round(networkBandwidth / 1000)) + " bitrate " + (Math.round(remoteBitrate / 1000)));
226
237
  } else if (STREAM_EVENT_TYPE.RESIZE === streamEvent.type) {
227
238
  console.log("New video size: " + streamEvent.payload.streamerVideoWidth + "x" + streamEvent.payload.streamerVideoHeight);
239
+ } else if (STREAM_EVENT_TYPE.UNMUTE_REQUIRED === streamEvent.type) {
240
+ console.log("Stream is muted by autoplay policy, user action required to unmute");
241
+ $("#unmute").show();
228
242
  }
229
-
230
243
  });
231
244
  stream.play();
232
245
  }
@@ -249,6 +262,15 @@ function setStatus(status, stream) {
249
262
  }
250
263
  }
251
264
 
265
+ function setStreamVolume(stream, currentVolumeValue) {
266
+ if (stream) {
267
+ if (stream.isRemoteAudioMuted()) {
268
+ stream.unmuteRemoteAudio();
269
+ }
270
+ stream.setVolume(currentVolumeValue);
271
+ }
272
+ }
273
+
252
274
  function validateForm() {
253
275
  var valid = true;
254
276
  $('#form :text').each(function(){