@flashphoner/websdk 2.0.206 → 2.0.210

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.
Files changed (39) hide show
  1. package/docTemplate/README.md +1 -1
  2. package/examples/demo/streaming/2players/2players.js +0 -5
  3. package/examples/demo/streaming/canvas_streaming/canvas_streaming.js +0 -12
  4. package/examples/demo/streaming/embed_player/player.js +127 -198
  5. package/examples/demo/streaming/firewall-traversal-streaming/firewall-traversal-streaming.js +0 -12
  6. package/examples/demo/streaming/mcu_client/mcu_client.js +0 -8
  7. package/examples/demo/streaming/media_devices_manager/manager.js +2 -17
  8. package/examples/demo/streaming/player/player.js +10 -9
  9. package/examples/demo/streaming/screen-sharing/screen-sharing.html +1 -1
  10. package/examples/demo/streaming/screen-sharing/screen-sharing.js +1 -1
  11. package/examples/demo/streaming/stream-auto-restore/stream-auto-restore.css +23 -0
  12. package/examples/demo/streaming/stream-auto-restore/stream-auto-restore.html +152 -0
  13. package/examples/demo/streaming/stream-auto-restore/stream-auto-restore.js +744 -0
  14. package/examples/demo/streaming/stream-diagnostic/stream-diagnostic.js +0 -8
  15. package/examples/demo/streaming/stream-local-snapshot/stream-local-snapshot.js +0 -6
  16. package/examples/demo/streaming/stream-snapshot/stream-snapshot.js +0 -6
  17. package/examples/demo/streaming/stream_recording/recording.js +0 -6
  18. package/examples/demo/streaming/streamer/streamer.js +0 -8
  19. package/examples/demo/streaming/two_way_streaming/two_way_streaming.js +0 -11
  20. package/examples/demo/streaming/webrtc-as-rtmp-republishing/webrtc-as-rtmp-republishing.js +0 -6
  21. package/flashphoner-no-flash.js +131 -29
  22. package/flashphoner-no-flash.min.js +2 -2
  23. package/flashphoner-no-webrtc.js +103 -19
  24. package/flashphoner-no-webrtc.min.js +1 -1
  25. package/flashphoner-no-wsplayer.js +132 -30
  26. package/flashphoner-no-wsplayer.min.js +2 -2
  27. package/flashphoner-room-api.js +105 -12
  28. package/flashphoner-room-api.min.js +2 -2
  29. package/flashphoner-temasys-flash-websocket-without-adapterjs.js +105 -21
  30. package/flashphoner-temasys-flash-websocket.js +105 -21
  31. package/flashphoner-temasys-flash-websocket.min.js +1 -1
  32. package/flashphoner-webrtc-only.js +129 -27
  33. package/flashphoner-webrtc-only.min.js +1 -1
  34. package/flashphoner.js +132 -30
  35. package/flashphoner.min.js +2 -2
  36. package/package.json +1 -1
  37. package/src/flashphoner-core.d.ts +22 -5
  38. package/src/flashphoner-core.js +79 -3
  39. package/src/webrtc-media-provider.js +26 -9
@@ -1,4 +1,4 @@
1
- Web SDK - 2.0.206
1
+ Web SDK - 2.0.210
2
2
 
3
3
  [Download builds](https://docs.flashphoner.com/display/WEBSDK2EN/Web+SDK+release+notes)
4
4
 
@@ -112,11 +112,6 @@ function playBtnClick(index) {
112
112
 
113
113
  if (Flashphoner.getMediaProviders()[0] === "WSPlayer") {
114
114
  Flashphoner.playFirstSound();
115
- } else if (Browser.isSafariWebRTC()) {
116
- Flashphoner.playFirstVideo(display, false, PRELOADER_URL).then(function () {
117
- playStream(index, display);
118
- });
119
- return;
120
115
  }
121
116
  playStream(index, display);
122
117
  }
@@ -39,12 +39,6 @@ function connect() {
39
39
  console.log("Create new session with url " + url);
40
40
  Flashphoner.createSession({urlServer: url}).on(SESSION_STATUS.ESTABLISHED, function (session) {
41
41
  setStatus("#connectStatus", session.status());
42
- if (Browser.isSafariWebRTC()) {
43
- Flashphoner.playFirstVideo(localVideo, true, PRELOADER_URL).then(function() {
44
- startStreaming();
45
- });
46
- return;
47
- }
48
42
  startStreaming();
49
43
  }).on(SESSION_STATUS.DISCONNECTED, function () {
50
44
  setStatus("#connectStatus", SESSION_STATUS.DISCONNECTED);
@@ -107,12 +101,6 @@ function startStreaming() {
107
101
  setStatus("#publishStatus", STREAM_STATUS.PUBLISHING);
108
102
  if (Flashphoner.getMediaProviders()[0] === "WSPlayer") {
109
103
  Flashphoner.playFirstSound();
110
- } else if (Browser.isSafariWebRTC() || Flashphoner.getMediaProviders()[0] === "MSE") {
111
- Flashphoner.playFirstVideo(remoteVideo, false, PRELOADER_URL).then(function() {
112
- playStream();
113
- onPublishing(stream);
114
- });
115
- return;
116
104
  }
117
105
  playStream();
118
106
  onPublishing(stream);
@@ -12,6 +12,12 @@ var resolution = getUrlParam("resolution");
12
12
  var mediaProviders = getUrlParam("mediaProviders") || "";
13
13
  var streamName = getUrlParam("streamName") || "streamName";
14
14
  var urlServer = getUrlParam("urlServer") || setURL();
15
+ const HTML_VOLUME_MUTE='<svg height="100%" version="1.1" viewBox="0 0 36 36" width="100%"><defs><clipPath><path d="m 14.35,-0.14 -5.86,5.86 20.73,20.78 5.86,-5.91 z"></path><path d="M 7.07,6.87 -1.11,15.33 19.61,36.11 27.80,27.60 z"></path><path d="M 9.09,5.20 6.47,7.88 26.82,28.77 29.66,25.99 z" transform="translate(0, 0)"></path></clipPath><clipPath><path d="m -11.45,-15.55 -4.44,4.51 20.45,20.94 4.55,-4.66 z" transform="translate(0, 0)"></path></clipPath></defs><path style="fill: #fff;" clip-path="url(#ytp-svg-volume-animation-mask)" d="M8,21 L12,21 L17,26 L17,10 L12,15 L8,15 L8,21 Z M19,14 L19,22 C20.48,21.32 21.5,19.77 21.5,18 C21.5,16.26 20.48,14.74 19,14 ZM19,11.29 C21.89,12.15 24,14.83 24,18 C24,21.17 21.89,23.85 19,24.71 L19,26.77 C23.01,25.86 26,22.28 26,18 C26,13.72 23.01,10.14 19,9.23 L19,11.29 Z" fill="#fff" id="ytp-svg-12"></path><path clip-path="url(#ytp-svg-volume-animation-slash-mask)" d="M 9.25,9 7.98,10.27 24.71,27 l 1.27,-1.27 Z" fill="#fff" style="fill:#fff;"></path></svg>';
16
+ const HTML_VOLUME_ZERO='<svg height="100%" version="1.1" viewBox="0 0 36 36" width="100%"><defs><clipPath><path d="m 14.35,-0.14 -5.86,5.86 20.73,20.78 5.86,-5.91 z"></path><path d="M 7.07,6.87 -1.11,15.33 19.61,36.11 27.80,27.60 z"></path><path d="M 9.09,5.20 6.47,7.88 26.82,28.77 29.66,25.99 z" transform="translate(0, 0)"></path></clipPath><clipPath><path d="m -11.45,-15.55 -4.44,4.51 20.45,20.94 4.55,-4.66 z" transform="translate(0, 0)"></path></clipPath></defs><path style="fill: #fff;" clip-path="url(#ytp-svg-volume-animation-mask)" d="M8,21 L12,21 L17,26 L17,10 L12,15 L8,15 L8,21 Z M19,14 L19,22 C20.48,21.32 21.5,19.77 21.5,18 C21.5,16.26 20.48,14.74 19,14 ZM19,11.29 C21.89,12.15 24,14.83 24,18 C24,21.17 21.89,23.85 19,24.71 L19,26.77 C23.01,25.86 26,22.28 26,18 C26,13.72 23.01,10.14 19,9.23 L19,11.29 Z" fill="#fff" id="ytp-svg-12"></path><path clip-path="url(#ytp-svg-volume-animation-slash-mask)" d="M 9.25,9 7.98,10.27 24.71,27 l 1.27,-1.27 Z" fill="#fff" style="fill:#fff;"></path></svg>';
17
+ const HTML_VOLUME_LOW='<svg height="100%" version="1.1" viewBox="0 0 36 36" width="100%"><defs><clipPath><path d="m 14.35,-0.14 -5.86,5.86 20.73,20.78 5.86,-5.91 z"></path><path d="M 7.07,6.87 -1.11,15.33 19.61,36.11 27.80,27.60 z"></path><path d="M 9.09,5.20 6.47,7.88 26.82,28.77 29.66,25.99 z" transform="translate(0, 0)"></path></clipPath><clipPath><path d="m -11.45,-15.55 -4.44,4.51 20.45,20.94 4.55,-4.66 z" transform="translate(0, 0)"></path></clipPath></defs><path style="fill: #fff;" clip-path="url(#ytp-svg-volume-animation-mask)" d="M8,21 L12,21 L17,26 L17,10 L12,15 L8,15 L8,21 Z M19,14 L19,22 C20.48,21.32 21.5,19.77 21.5,18 C21.5,16.26 20.48,14.74 19,14 Z" fill="#fff" id="ytp-svg-12"></path></svg>';
18
+ const HTML_VOLUME_HIGH='<svg height="100%" version="1.1" viewBox="0 0 36 36" width="100%"<defs><clipPath><path d="m 14.35,-0.14 -5.86,5.86 20.73,20.78 5.86,-5.91 z"></path><path d="M 7.07,6.87 -1.11,15.33 19.61,36.11 27.80,27.60 z"></path><path d="M 9.09,5.20 6.47,7.88 26.82,28.77 29.66,25.99 z" transform="translate(0, 0)"></path></clipPath><clipPath><path d="m -11.45,-15.55 -4.44,4.51 20.45,20.94 4.55,-4.66 z" transform="translate(0, 0)"></path></clipPath></defs><path style="fill: #fff;" clip-path="url(#ytp-svg-volume-animation-mask)" d="M8,21 L12,21 L17,26 L17,10 L12,15 L8,15 L8,21 Z M19,14 L19,22 C20.48,21.32 21.5,19.77 21.5,18 C21.5,16.26 20.48,14.74 19,14 ZM19,11.29 C21.89,12.15 24,14.83 24,18 C24,21.17 21.89,23.85 19,24.71 L19,26.77 C23.01,25.86 26,22.28 26,18 C26,13.72 23.01,10.14 19,9.23 L19,11.29 Z" fill="#fff" id="ytp-svg-12"></path></svg>';
19
+ const HTML_FULLSCREEN_EXIT='<svg height="100%" version="1.1" viewBox="0 0 36 36" width="100%"><g class="ytp-fullscreen-button-corner-2"><path style="fill: #fff;" d="m 14,14 -4,0 0,2 6,0 0,-6 -2,0 0,4 0,0 z"></path></g><g><path style="fill: #fff;" d="m 22,14 0,-4 -2,0 0,6 6,0 0,-2 -4,0 0,0 z"></path></g><g><path style="fill: #fff;" d="m 20,26 2,0 0,-4 4,0 0,-2 -6,0 0,6 0,0 z"></path></g><g><path style="fill: #fff;" d="m 10,22 4,0 0,4 2,0 0,-6 -6,0 0,2 0,0 z"></path></g></svg>';
20
+ let firstUnmuted = true;
15
21
 
16
22
  function init_page() {
17
23
  //video display
@@ -44,6 +50,11 @@ function init_page() {
44
50
  $('.volume-range-block').hide();
45
51
  }
46
52
  if (autoplay ) {
53
+ // Autoplay will start for muted video tag only, adjust mute button and slider view
54
+ firstUnmuted = false;
55
+ $('.volume').addClass('volume-none');
56
+ $('.volume').html(HTML_VOLUME_MUTE);
57
+ $('#slider').slider( "value", 1 );
47
58
  $(".play-pause").click();
48
59
  }
49
60
  }
@@ -56,12 +67,6 @@ function onStarted(stream) {
56
67
  stream.setVolume(currentVolumeValue);
57
68
  }
58
69
 
59
- function volumeEvent(event) {
60
- stream.unmuteRemoteAudio();
61
- $('.volume').unbind('click',volumeEvent);
62
- $('.volume-range-block').unbind('mousedown',volumeEvent);
63
- }
64
-
65
70
  function onStopped() {
66
71
  stopped = true;
67
72
  $('#play').css('display', 'block');
@@ -137,22 +142,15 @@ function playStream(session) {
137
142
  options.playWidth = resolution.split("x")[0];
138
143
  options.playHeight = resolution.split("x")[1];
139
144
  }
145
+ if (autoplay) {
146
+ options.unmutePlayOnStart = false;
147
+ }
140
148
  stream = session.createStream(options).on(STREAM_STATUS.PENDING, function(stream) {
141
149
  var video = document.getElementById(stream.id());
142
150
  if (!video.hasListeners) {
143
151
  video.hasListeners = true;
144
152
  video.addEventListener('playing', function () {
145
153
  $("#preloader").hide();
146
- if (autoplay && stream.isRemoteAudioMuted()) {
147
- //WCS-1698. if autoplay = true, then set the volume slider to 0. When you first click on the slider or icon, sound turn on. https://goo.gl/7K7WLu
148
- //WCS-2870. The code below was commented out because it break autoplay in latest iOS and macOS Safari
149
- //$('.volume').click();
150
- $('.volume').bind('click', volumeEvent);
151
- $('.volume-range-block').bind('mousedown', volumeEvent);
152
- }
153
- if ($('.volume').hasClass('volume-none') && !stream.isRemoteAudioMuted()) {
154
- $('.volume').click();
155
- }
156
154
  });
157
155
  video.addEventListener('resize', function (event) {
158
156
  var streamResolution = stream.videoResolution();
@@ -218,6 +216,53 @@ function validateForm() {
218
216
  }
219
217
  }
220
218
 
219
+ function setVolume(volume, slider) {
220
+ if (volume < 0) {
221
+ console.error("Bad volume: " + volume);
222
+ return(false);
223
+ }
224
+ if (stream) {
225
+ if (volume > 0) {
226
+ if (!firstUnmuted && slider && Browser.isAndroid()) {
227
+ console.error("User should click volume unmute button to enable audio");
228
+ return(false);
229
+ } else if (stream.isRemoteAudioMuted()) {
230
+ stream.unmuteRemoteAudio();
231
+ firstUnmuted = true;
232
+ }
233
+ }
234
+ stream.setVolume(volume);
235
+ }
236
+ // Save current volume in page element to restore it when mute/unmute
237
+ $('#volume-range').val(volume);
238
+
239
+ //chnage volume control icon
240
+ if ( currentVolumeValue > 0) {
241
+ //volume in range 0-50
242
+ if ( currentVolumeValue <= 50 ) {
243
+ $('.volume').html(HTML_VOLUME_LOW);
244
+ }
245
+
246
+ //volume greater than 50
247
+ if ( currentVolumeValue > 50 ) {
248
+ $('.volume').html(HTML_VOLUME_HIGH);
249
+ }
250
+
251
+ if ($('.volume').hasClass('volume-none')) {
252
+ $('.volume').removeClass('volume-none');
253
+ }
254
+
255
+ } else if ( currentVolumeValue == 0 ) {
256
+ // Zero volume is equal to audio mute
257
+ $('.volume').html(HTML_VOLUME_ZERO);
258
+ if (!$('.volume').hasClass('volume-none')) {
259
+ $('.volume').addClass('volume-none');
260
+ }
261
+ }
262
+
263
+ return(true);
264
+ }
265
+
221
266
  (function ($) {
222
267
  $.fn.videoPlayer = function (options) {
223
268
  var settings = {
@@ -261,7 +306,6 @@ function validateForm() {
261
306
  }
262
307
  $(this).addClass('play').removeClass('pause').prop('disabled', true);
263
308
  $("#preloader").hide();
264
- autoplay = false;
265
309
  }
266
310
  }
267
311
  });
@@ -278,91 +322,20 @@ function validateForm() {
278
322
  };
279
323
  });
280
324
 
281
-
282
- $that.find('.volume-bar-holder').bind('mousedown', function (e) {
283
- $vclicking = true;
284
- y = $that.find('.volume-bar-holder').height() - (e.pageY - $that.find('.volume-bar-holder').offset().top);
285
- if (y < 0 || y > $(this).height()) {
286
- $vclicking = false;
287
- return false;
288
- }
289
- $that.find('.volume-bar').css({'height': y + 'px'});
290
- currentVolumeValue = $that.find('.volume-bar').height() * 100 / $(this).height();
291
- volanim();
292
-
293
- });
294
-
295
- var volanim = function () {
296
- $that.find('.volume-bar').css({'height': (currentVolumeValue) + '%'});
297
- if (stream) {
298
- stream.setVolume(currentVolumeValue);
299
- }
300
- for (var i = 0; i < 1; i += 0.1) {
301
- var fi = parseInt(Math.floor(i * 10)) / 10;
302
- var volid = (fi * 10) + 1;
303
- var $v = currentVolumeValue / 100;
304
- if ($v === 1) {
305
- if ($volhover) {
306
- $that.find('.volume-icon').removeClass().addClass('volume-icon volume-icon-hover v-change-11');
307
- } else {
308
- $that.find('.volume-icon').removeClass().addClass('volume-icon v-change-11');
309
- }
310
- }
311
- else if ($v === 0) {
312
- if ($volhover) {
313
- $that.find('.volume-icon').removeClass().addClass('volume-icon volume-icon-hover v-change-1');
314
- } else {
315
- $that.find('.volume-icon').removeClass().addClass('volume-icon v-change-1');
316
- }
317
- }
318
- else if ($v > (fi - 0.1) && !$that.find('.volume-icon').hasClass('v-change-' + volid)) {
319
- if ($volhover) {
320
- $that.find('.volume-icon').removeClass().addClass('volume-icon volume-icon-hover v-change-' + volid);
321
- } else {
322
- $that.find('.volume-icon').removeClass().addClass('volume-icon v-change-' + volid);
323
- }
324
- }
325
-
326
- }
327
- };
328
- volanim();
329
325
  $that.find('.volume').hover(function () {
330
326
  $volhover = true;
331
327
  }, function () {
332
328
  $volhover = false;
333
329
  });
330
+
334
331
  $('body, html').bind('mousemove', function (e) {
335
- if ( !stopped ) {
336
- $that.hover(function () {
337
- $that.find('.player').stop(true, false).animate({'opacity': '1'}, 0.5);
338
- }, function () {
339
- $that.find('.player').stop(true, false).animate({'opacity': '0'}, 0.5);
340
- });
341
- };
342
- if ($vclicking) {
343
- y = $that.find('.volume-bar-holder').height() - (e.pageY - $that.find('.volume-bar-holder').offset().top);
344
- var volMove = 0;
345
- if ($that.find('.volume-holder').css('display') === 'none') {
346
- $vclicking = false;
347
- return false;
348
- }
349
- if (!$that.find('.volume-icon').hasClass('volume-icon-hover')) {
350
- $that.find('.volume-icon').addClass('volume-icon-hover');
351
- }
352
- if (y < 0 || y === 0) { // If y is less than 0 or equal to 0 then volMove is 0.
353
- currentVolumeValue = 0;
354
- volMove = 0;
355
- $that.find('.volume-icon').removeClass().addClass('volume-icon volume-icon-hover v-change-11');
356
- } else if (y > $(this).find('.volume-bar-holder').height() || (y / $that.find('.volume-bar-holder').height()) === 1) { // If y is more than the height then volMove is equal to the height
357
- currentVolumeValue = 100;
358
- volMove = $that.find('.volume-bar-holder').height();
359
- $that.find('.volume-icon').removeClass().addClass('volume-icon volume-icon-hover v-change-1');
360
- } else { // Otherwise volMove is just y
361
- currentVolumeValue = $that.find('.volume-bar').height() * 100 / $that.find('.volume-bar-holder').height();
362
- volMove = y;
363
- }
364
- volanim();
365
- }
332
+ if ( !stopped ) {
333
+ $that.hover(function () {
334
+ $that.find('.player').stop(true, false).animate({'opacity': '1'}, 0.5);
335
+ }, function () {
336
+ $that.find('.player').stop(true, false).animate({'opacity': '0'}, 0.5);
337
+ });
338
+ }
366
339
  if (!$volhover) {
367
340
  $that.find('.volume-holder').stop(true, false).fadeOut(100);
368
341
  $that.find('.volume-icon').removeClass('volume-icon-hover');
@@ -372,30 +345,13 @@ function validateForm() {
372
345
  $that.find('.volume-holder').fadeIn(100);
373
346
  }
374
347
  });
375
-
376
- $that.find('.volume-icon').bind('mousedown', function () {
377
- if (storedVolume) {
378
- currentVolumeValue = storedVolume;
379
- storedVolume = undefined;
380
- } else {
381
- storedVolume = currentVolumeValue;
382
- currentVolumeValue = 0;
383
- }
384
- volanim();
385
- });
386
-
387
- $('body, html').bind('mouseup', function (e) {
388
- $mclicking = false;
389
- $vclicking = false;
390
- });
391
-
348
+
392
349
  // Requests fullscreen based on browser.
393
350
  $('.fullscreenBtn').click(function () {
394
351
  if ( stream ) {
395
352
  stream.fullScreen();
396
353
  };
397
354
  });
398
- var elem = document.querySelector('#volume-range');
399
355
  var init = $( "#slider" ).slider({
400
356
  value: 50,
401
357
  orientation: "horizontal",
@@ -408,52 +364,31 @@ function validateForm() {
408
364
  }
409
365
  });
410
366
  valueRange();
367
+
368
+ var prevVol=1;
411
369
  function valueRange() {
412
- if (stream) {
413
- currentVolumeValue = $( "#slider" ).slider( "value" );
414
- stream.setVolume(currentVolumeValue);
370
+ currentVolumeValue = $( "#slider" ).slider( "value" );
371
+ if (setVolume(currentVolumeValue, true)) {
372
+ // Save previous volume state to set when stream is unmuted by button
373
+ prevVol = currentVolumeValue ? currentVolumeValue : 1;
374
+
415
375
  }
416
-
417
- //chnage volume control icon
418
- currentVolumeValue = $( "#slider" ).slider( "value" );
419
- //volume in range 0-50
420
- if ( currentVolumeValue > 0 && currentVolumeValue <= 50 ) {
421
- $('.volume').html('<svg height="100%" version="1.1" viewBox="0 0 36 36" width="100%"><defs><clipPath><path d="m 14.35,-0.14 -5.86,5.86 20.73,20.78 5.86,-5.91 z"></path><path d="M 7.07,6.87 -1.11,15.33 19.61,36.11 27.80,27.60 z"></path><path d="M 9.09,5.20 6.47,7.88 26.82,28.77 29.66,25.99 z" transform="translate(0, 0)"></path></clipPath><clipPath><path d="m -11.45,-15.55 -4.44,4.51 20.45,20.94 4.55,-4.66 z" transform="translate(0, 0)"></path></clipPath></defs><path style="fill: #fff;" clip-path="url(#ytp-svg-volume-animation-mask)" d="M8,21 L12,21 L17,26 L17,10 L12,15 L8,15 L8,21 Z M19,14 L19,22 C20.48,21.32 21.5,19.77 21.5,18 C21.5,16.26 20.48,14.74 19,14 Z" fill="#fff" id="ytp-svg-12"></path></svg>');
422
- };
423
-
424
- //volume greater than 50
425
- if ( currentVolumeValue > 50 ) {
426
- $('.volume').html('<svg height="100%" version="1.1" viewBox="0 0 36 36" width="100%"<defs><clipPath><path d="m 14.35,-0.14 -5.86,5.86 20.73,20.78 5.86,-5.91 z"></path><path d="M 7.07,6.87 -1.11,15.33 19.61,36.11 27.80,27.60 z"></path><path d="M 9.09,5.20 6.47,7.88 26.82,28.77 29.66,25.99 z" transform="translate(0, 0)"></path></clipPath><clipPath><path d="m -11.45,-15.55 -4.44,4.51 20.45,20.94 4.55,-4.66 z" transform="translate(0, 0)"></path></clipPath></defs><path style="fill: #fff;" clip-path="url(#ytp-svg-volume-animation-mask)" d="M8,21 L12,21 L17,26 L17,10 L12,15 L8,15 L8,21 Z M19,14 L19,22 C20.48,21.32 21.5,19.77 21.5,18 C21.5,16.26 20.48,14.74 19,14 ZM19,11.29 C21.89,12.15 24,14.83 24,18 C24,21.17 21.89,23.85 19,24.71 L19,26.77 C23.01,25.86 26,22.28 26,18 C26,13.72 23.01,10.14 19,9.23 L19,11.29 Z" fill="#fff" id="ytp-svg-12"></path></svg>');
427
- };
428
-
429
- //volume zero
430
- if ( currentVolumeValue == 0 ) {
431
- $('.volume').html('<svg height="100%" version="1.1" viewBox="0 0 36 36" width="100%"><defs><clipPath><path d="m 14.35,-0.14 -5.86,5.86 20.73,20.78 5.86,-5.91 z"></path><path d="M 7.07,6.87 -1.11,15.33 19.61,36.11 27.80,27.60 z"></path><path d="M 9.09,5.20 6.47,7.88 26.82,28.77 29.66,25.99 z" transform="translate(0, 0)"></path></clipPath><clipPath><path d="m -11.45,-15.55 -4.44,4.51 20.45,20.94 4.55,-4.66 z" transform="translate(0, 0)"></path></clipPath></defs><path style="fill: #fff;" clip-path="url(#ytp-svg-volume-animation-mask)" d="M8,21 L12,21 L17,26 L17,10 L12,15 L8,15 L8,21 Z M19,14 L19,22 C20.48,21.32 21.5,19.77 21.5,18 C21.5,16.26 20.48,14.74 19,14 ZM19,11.29 C21.89,12.15 24,14.83 24,18 C24,21.17 21.89,23.85 19,24.71 L19,26.77 C23.01,25.86 26,22.28 26,18 C26,13.72 23.01,10.14 19,9.23 L19,11.29 Z" fill="#fff" id="ytp-svg-12"></path><path clip-path="url(#ytp-svg-volume-animation-slash-mask)" d="M 9.25,9 7.98,10.27 24.71,27 l 1.27,-1.27 Z" fill="#fff" style="fill:#fff;"></path></svg>');
432
- };
433
376
  }
434
377
 
435
-
436
378
  //mute unmute volume on click
437
- var prevVol, prevLeft, prevHtml;
438
379
  $('.volume').on('click', function () {
439
380
  if ($('.volume').hasClass('volume-none')) {
381
+ // Restore previous volume state
440
382
  $('#slider').slider( "value", prevVol );
441
- $('#volume-range').val(prevVol);
442
- $('.volume').html(prevHtml);
443
383
  currentVolumeValue = prevVol;
444
- if (stream) {
445
- stream.setVolume(currentVolumeValue);
446
- }
384
+ setVolume(currentVolumeValue, false);
447
385
  $('.volume').removeClass('volume-none');
448
386
  } else {
387
+ // Save previous volume state and mute audio
449
388
  prevVol = $('#volume-range').val();
450
- prevHtml = $('.volume').html();
451
- $('.volume').html('<svg height="100%" version="1.1" viewBox="0 0 36 36" width="100%"><defs><clipPath><path d="m 14.35,-0.14 -5.86,5.86 20.73,20.78 5.86,-5.91 z"></path><path d="M 7.07,6.87 -1.11,15.33 19.61,36.11 27.80,27.60 z"></path><path d="M 9.09,5.20 6.47,7.88 26.82,28.77 29.66,25.99 z" transform="translate(0, 0)"></path></clipPath><clipPath><path d="m -11.45,-15.55 -4.44,4.51 20.45,20.94 4.55,-4.66 z" transform="translate(0, 0)"></path></clipPath></defs><path style="fill: #fff;" clip-path="url(#ytp-svg-volume-animation-mask)" d="M8,21 L12,21 L17,26 L17,10 L12,15 L8,15 L8,21 Z M19,14 L19,22 C20.48,21.32 21.5,19.77 21.5,18 C21.5,16.26 20.48,14.74 19,14 ZM19,11.29 C21.89,12.15 24,14.83 24,18 C24,21.17 21.89,23.85 19,24.71 L19,26.77 C23.01,25.86 26,22.28 26,18 C26,13.72 23.01,10.14 19,9.23 L19,11.29 Z" fill="#fff" id="ytp-svg-12"></path><path clip-path="url(https://www.youtube.com/watch?v=FA044r-szpM#ytp-svg-volume-animation-slash-mask)" d="M 9.25,9 7.98,10.27 24.71,27 l 1.27,-1.27 Z" fill="#fff" style="fill:#fff;"></path></svg>');
452
- $('#volume-range').val(0);
453
389
  $('#slider').slider( "value", 0);
454
- if (stream) {
455
- stream.setVolume(0);
456
- };
390
+ currentVolumeValue = 0;
391
+ setVolume(currentVolumeValue, false);
457
392
  $('.volume').addClass('volume-none');
458
393
  };
459
394
  });
@@ -469,38 +404,32 @@ function validateForm() {
469
404
 
470
405
 
471
406
  isMobile = {
472
- Android: function() {
473
- return navigator.userAgent.match(/Android/i);
474
- },
475
- BlackBerry: function() {
476
- return navigator.userAgent.match(/BlackBerry/i);
477
- },
478
- iOS: function() {
479
- return navigator.userAgent.match(/iPhone|iPad|iPod/i);
480
- },
481
- Opera: function() {
482
- return navigator.userAgent.match(/Opera Mini/i);
483
- },
484
- Windows: function() {
485
- return navigator.userAgent.match(/IEMobile/i);
486
- },
487
- any: function() {
488
- return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
489
- }
490
- };
491
- if (isMobile.any()) {
492
- $('.volume-range-block').addClass('open-width-full')
407
+ Android: function() {
408
+ return navigator.userAgent.match(/Android/i);
409
+ },
410
+ BlackBerry: function() {
411
+ return navigator.userAgent.match(/BlackBerry/i);
412
+ },
413
+ iOS: function() {
414
+ return navigator.userAgent.match(/iPhone|iPad|iPod/i);
415
+ },
416
+ Opera: function() {
417
+ return navigator.userAgent.match(/Opera Mini/i);
418
+ },
419
+ Windows: function() {
420
+ return navigator.userAgent.match(/IEMobile/i);
421
+ },
422
+ any: function() {
423
+ return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
493
424
  }
425
+ };
426
+ if (isMobile.any()) {
427
+ $('.volume-range-block').addClass('open-width-full')
428
+ }
494
429
  var prevFull;
495
430
 
496
431
  $(document).on('webkitfullscreenchange mozfullscreenchange fullscreenchange', function(e) {
497
432
  if (stream) {
498
- if ($("#"+stream.id()).prop("muted")) {
499
- currentVolumeValue = 0;
500
- } else {
501
- currentVolumeValue = stream.getVolume();
502
- }
503
- volanim();
504
433
 
505
434
  $('.player').toggleClass('fullscreenon'); //Add class for all controls in full screen mode
506
435
  $('.volume-range-block').toggleClass('fullscreen-vol'); //Add class to volume control for full screen mode
@@ -508,30 +437,30 @@ function validateForm() {
508
437
  if ( $('.player').hasClass('fullscreenon') ) {
509
438
  prevFull = $('.fullscreenBtn').html();
510
439
 
511
- //change full screen button to full screen exit button
512
- $('.fullscreenBtn').html('<svg height="100%" version="1.1" viewBox="0 0 36 36" width="100%"><g class="ytp-fullscreen-button-corner-2"><path style="fill: #fff;" d="m 14,14 -4,0 0,2 6,0 0,-6 -2,0 0,4 0,0 z"></path></g><g><path style="fill: #fff;" d="m 22,14 0,-4 -2,0 0,6 6,0 0,-2 -4,0 0,0 z"></path></g><g><path style="fill: #fff;" d="m 20,26 2,0 0,-4 4,0 0,-2 -6,0 0,6 0,0 z"></path></g><g><path style="fill: #fff;" d="m 10,22 4,0 0,4 2,0 0,-6 -6,0 0,2 0,0 z"></path></g></svg>');
513
-
514
- //activate controls on mouse moving
515
- $that.bind('mousemove touchmove', function () {
516
- if ($clearTimeout) {
517
- clearTimeout($clearTimeout);
518
- }
519
- $that.find('.player').stop(true, false).animate({'opacity': '1'}, 0.1);
520
- $clearTimeout = setTimeout(function() {
521
- $that.find('.player').stop(true, false).animate({'opacity': '0'}, 0.5);
522
- }, 15000);
523
- });
524
- } else {
525
-
526
- $('.fullscreenBtn').html(prevFull);
527
- $('.fullscreenBtn').click(function () {
528
- if ( stream ) {
529
- stream.fullScreen();
530
- };
531
- });
532
- };
533
- };
534
- });
440
+ //change full screen button to full screen exit button
441
+ $('.fullscreenBtn').html(HTML_FULLSCREEN_EXIT);
442
+
443
+ //activate controls on mouse moving
444
+ $that.bind('mousemove touchmove', function () {
445
+ if ($clearTimeout) {
446
+ clearTimeout($clearTimeout);
447
+ }
448
+ $that.find('.player').stop(true, false).animate({'opacity': '1'}, 0.1);
449
+ $clearTimeout = setTimeout(function() {
450
+ $that.find('.player').stop(true, false).animate({'opacity': '0'}, 0.5);
451
+ }, 15000);
452
+ });
453
+ } else {
454
+
455
+ $('.fullscreenBtn').html(prevFull);
456
+ $('.fullscreenBtn').click(function () {
457
+ if ( stream ) {
458
+ stream.fullScreen();
459
+ };
460
+ });
461
+ };
462
+ };
463
+ });
535
464
  });
536
465
  }
537
466
  })(jQuery);
@@ -107,12 +107,6 @@ function publishBtnClick() {
107
107
  if (validateForm("streamerForm")) {
108
108
  $('#publishStream').prop('disabled', true);
109
109
  $(this).prop('disabled', true);
110
- if (Browser.isSafariWebRTC()) {
111
- Flashphoner.playFirstVideo(localVideo, true, PRELOADER_URL).then(function() {
112
- publishStream();
113
- });
114
- return;
115
- }
116
110
  publishStream();
117
111
  }
118
112
  }
@@ -139,12 +133,6 @@ function playBtnClick() {
139
133
  if (validateForm("playerForm")) {
140
134
  $('#playStream').prop('disabled', true);
141
135
  $(this).prop('disabled', true);
142
- if (Browser.isSafariWebRTC()) {
143
- Flashphoner.playFirstVideo(remoteVideo, false, PRELOADER_URL).then(function() {
144
- playStream();
145
- });
146
- return;
147
- }
148
136
  playStream();
149
137
  }
150
138
  }
@@ -77,14 +77,6 @@ function joinBtnClick() {
77
77
  $('#url').prop('disabled', true);
78
78
  $("#room").prop('disabled', true);
79
79
  $("#login").prop('disabled', true);
80
- if (Browser.isSafariWebRTC() || Flashphoner.getMediaProviders()[0] === "MSE") {
81
- Flashphoner.playFirstVideo(localDisplay, true, PRELOADER_URL).then(function () {
82
- Flashphoner.playFirstVideo(remoteVideo, false, PRELOADER_URL).then(function () {
83
- start();
84
- });
85
- });
86
- return;
87
- }
88
80
  start();
89
81
  }
90
82
  }
@@ -62,12 +62,9 @@ function init_page() {
62
62
  localVideo = document.getElementById("localVideo");
63
63
  remoteVideo = document.getElementById("remoteVideo");
64
64
 
65
- if(!Browser.isChrome() && !Browser.isFirefox()) {
65
+ if(Browser.isAndroid() || Browser.isiOS()) {
66
66
  $('#screenShareForm').hide();
67
67
  }
68
- if (!Browser.isFirefox()) {
69
- $('#mediaSourceForm').hide();
70
- }
71
68
 
72
69
  Flashphoner.getMediaDevices(null, true, MEDIA_DEVICE_KIND.OUTPUT).then(function (list) {
73
70
  list.audio.forEach(function (device) {
@@ -176,12 +173,6 @@ function playBtnClick() {
176
173
  if (validateForm("play")) {
177
174
  muteInputs("play");
178
175
  $(this).prop('disabled', true);
179
- if (Browser.isSafariWebRTC()) {
180
- Flashphoner.playFirstVideo(remoteVideo, false, preloaderUrl).then(function() {
181
- play();
182
- });
183
- return;
184
- }
185
176
  play();
186
177
  }
187
178
  }
@@ -210,12 +201,6 @@ function publishBtnClick() {
210
201
  if (validateForm("send")) {
211
202
  muteInputs("send");
212
203
  $(this).prop('disabled', true);
213
- if (Browser.isSafariWebRTC()) {
214
- Flashphoner.playFirstVideo(localVideo, true, preloaderUrl).then(function() {
215
- publish();
216
- });
217
- return;
218
- }
219
204
  publish();
220
205
  }
221
206
  }
@@ -644,7 +629,7 @@ function switchToScreen() {
644
629
  if (publishStream) {
645
630
  $('#switchBtn').prop('disabled', true);
646
631
  $('#videoInput').prop('disabled', true);
647
- publishStream.switchToScreen($('#mediaSource').val()).catch(function () {
632
+ publishStream.switchToScreen($('#mediaSource').val(), true).catch(function () {
648
633
  $("#screenShareToggle").removeAttr("checked");
649
634
  $('#switchBtn').prop('disabled', false);
650
635
  $('#videoInput').prop('disabled', false);
@@ -41,14 +41,19 @@ function init_page() {
41
41
  animate: true,
42
42
  slide: function(event, ui) {
43
43
  //WCS-2375. fixed autoplay in ios safari
44
- stream.unmuteRemoteAudio();
44
+ if (stream.isRemoteAudioMuted()) {
45
+ stream.unmuteRemoteAudio();
46
+ }
45
47
  currentVolumeValue = ui.value;
46
48
  stream.setVolume(currentVolumeValue);
47
49
  }
48
50
  }).slider("disable");
49
51
  onStopped();
50
- if (autoplay)
52
+ if (autoplay) {
53
+ // We can start autoplay with muted audio only, so set volume slider to 0 #WCS-2425
54
+ $("#volumeControl").slider('value', 0);
51
55
  $("#playBtn").click();
56
+ }
52
57
  }
53
58
 
54
59
  function onStarted(stream) {
@@ -141,6 +146,9 @@ function playStream(session) {
141
146
  options.playWidth = resolution.split("x")[0];
142
147
  options.playHeight = resolution.split("x")[1];
143
148
  }
149
+ if (autoplay) {
150
+ options.unmutePlayOnStart = false;
151
+ }
144
152
  stream = session.createStream(options).on(STREAM_STATUS.PENDING, function (stream) {
145
153
  $("#preloader").show();
146
154
  var video = document.getElementById(stream.id());
@@ -160,13 +168,6 @@ function playStream(session) {
160
168
  resizeVideo(event.target, options.playWidth, newHeight);
161
169
  }
162
170
  });
163
- } else {
164
- //WCS-2375. fixed autoplay in ios safari
165
- video.addEventListener('playing', function () {
166
- if (autoplay && stream.isRemoteAudioMuted()) {
167
- $("#volumeControl").slider('value', 0);
168
- }
169
- });
170
171
  }
171
172
  }
172
173
  }).on(STREAM_STATUS.PLAYING, function (stream) {
@@ -29,7 +29,7 @@
29
29
  <h2 class="modal-title text-center text-danger">Warning!</h2>
30
30
  </div>
31
31
  <div class="modal-body text-center">
32
- <h2 class="text-primary">Screen sharing works only in Chrome and Firefox browsers on PC</h2>
32
+ <h2 class="text-primary">Screen sharing works only in desktop browsers</h2>
33
33
  </div>
34
34
  <div class="modal-footer">
35
35
  <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
@@ -16,7 +16,7 @@ function init_page() {
16
16
  }
17
17
 
18
18
  var interval;
19
- if (Browser.isFirefox()) {
19
+ if (Browser.isFirefox() && !Browser.isAndroid() && !Browser.isiOS()) {
20
20
  $("#installExtensionButton").show();
21
21
  interval = setInterval(function() {
22
22
  if (Flashphoner.firefoxScreenSharingExtensionInstalled) {