@flashphoner/websdk 2.0.247 → 2.0.249

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.247
1
+ Web SDK - 2.0.249
2
2
 
3
3
  [Download builds](https://docs.flashphoner.com/display/WEBSDK2EN/Web+SDK+release+notes)
4
4
 
@@ -140,6 +140,12 @@ function init_page() {
140
140
  $("#notifyFlash").text("Failed to get media devices");
141
141
  });
142
142
 
143
+ if (Browser.isiOS() && Browser.isSafariWebRTC()) {
144
+ document.addEventListener('visibilitychange', () => {
145
+ onVisibilityChanged();
146
+ });
147
+ }
148
+
143
149
  $("#urlServer").val(setURL());
144
150
  var streamName = createUUID(4);
145
151
  $("#publishStream").val(streamName);
@@ -217,6 +223,7 @@ function onPublishing(stream) {
217
223
  }).prop('disabled', false);
218
224
  $("#switchBtn").text("Switch").off('click').click(function () {
219
225
  stream.switchCam().then(function(id) {
226
+ console.log("Switched by button to camera " + id);
220
227
  $('#videoInput option:selected').prop('selected', false);
221
228
  $("#videoInput option[value='"+ id +"']").prop('selected', true);
222
229
  }).catch(function(e) {
@@ -272,6 +279,21 @@ function onDisconnected() {
272
279
  onStopped();
273
280
  }
274
281
 
282
+ function onVisibilityChanged() {
283
+ if (Browser.isiOS() && Browser.isSafariWebRTC() && document.hidden !== undefined) {
284
+ // iOS Safari may change camera when rising from the background, use chosen one explicitly
285
+ if (publishStream && !document.hidden) {
286
+ publishStream.switchCam($('#videoInput').val()).then(function(id) {
287
+ console.log("Switched explicitly to camera " + id);
288
+ $('#videoInput option:selected').prop('selected', false);
289
+ $("#videoInput option[value='"+ id +"']").prop('selected', true);
290
+ }).catch(function(e) {
291
+ console.log("Error " + e);
292
+ });
293
+ }
294
+ }
295
+ }
296
+
275
297
  function connect() {
276
298
  var url = $('#urlServer').val();
277
299
  var tm = parseInt($('#timeout').val());