@flashphoner/websdk 2.0.219 → 2.0.223

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.
@@ -17,7 +17,8 @@ var previewStream;
17
17
  var publishStream;
18
18
  var currentVolumeValue = 50;
19
19
  var currentGainValue = 50;
20
- var statsIntervalID;
20
+ var publishStatsIntervalID;
21
+ var playStatsIntervalID;
21
22
  var speechIntervalID;
22
23
  var extensionId = "nlbaajplpmleofphigmgaifhoikjmbkg";
23
24
  var videoBytesSent = 0;
@@ -157,9 +158,9 @@ function onStopped() {
157
158
  $("#playBtn").prop('disabled', disable);
158
159
  $("#playStream").prop('disabled', disable);
159
160
  clearStatInfo("in");
160
- if (statsIntervalID) {
161
- clearInterval(statsIntervalID);
162
- statsIntervalID = null;
161
+ if (playStatsIntervalID) {
162
+ clearInterval(playStatsIntervalID);
163
+ playStatsIntervalID = null;
163
164
  }
164
165
  if (speechIntervalID) {
165
166
  clearInterval(speechIntervalID);
@@ -190,9 +191,9 @@ function onUnpublished() {
190
191
  $("#publishBtn").prop('disabled', disable);
191
192
  $("#publishStream").prop('disabled', disable);
192
193
  clearStatInfo("out");
193
- if (statsIntervalID) {
194
- clearInterval(statsIntervalID);
195
- statsIntervalID = null;
194
+ if (publishStatsIntervalID) {
195
+ clearInterval(publishStatsIntervalID);
196
+ publishStatsIntervalID = null;
196
197
  }
197
198
  enablePublishToggles(false);
198
199
  }
@@ -206,8 +207,8 @@ function publishBtnClick() {
206
207
  }
207
208
 
208
209
  function onPublishing(stream) {
209
- if (!statsIntervalID) {
210
- statsIntervalID = setInterval(loadStats, STAT_INTERVAL);
210
+ if (!publishStatsIntervalID) {
211
+ publishStatsIntervalID = setInterval(loadPublishStats, STAT_INTERVAL);
211
212
  }
212
213
  $('input:radio').attr("disabled", true);
213
214
  $("#publishBtn").text("Stop").off('click').click(function () {
@@ -234,8 +235,8 @@ function onPublishing(stream) {
234
235
  }
235
236
 
236
237
  function onPlaying(stream) {
237
- if (!statsIntervalID) {
238
- statsIntervalID = setInterval(loadStats, STAT_INTERVAL);
238
+ if (!playStatsIntervalID) {
239
+ playStatsIntervalID = setInterval(loadPlayStats, STAT_INTERVAL);
239
240
  }
240
241
  $("#playBtn").text("Stop").off('click').click(function () {
241
242
  $(this).prop('disabled', true);
@@ -293,6 +294,7 @@ function play() {
293
294
  var streamName = $('#playStream').val();
294
295
  var session = Flashphoner.getSessions()[0];
295
296
  var transportOutput = $('#transportOutput').val();
297
+ var mutedName="";
296
298
  var constraints = {
297
299
  audio: $("#playAudio").is(':checked'),
298
300
  video: $("#playVideo").is(':checked')
@@ -351,18 +353,25 @@ function play() {
351
353
  }).on(CONNECTION_QUALITY.UPDATE, function (quality, clientFiltered, serverFiltered) {
352
354
  updateChart(quality, clientFiltered, serverFiltered, playConnectionQualityStat);
353
355
  }).on(STREAM_EVENT, function(streamEvent) {
356
+ if(streamEvent.payload !== undefined) {
357
+ mutedName=streamEvent.payload.streamName;
358
+ }
354
359
  switch (streamEvent.type) {
355
360
  case STREAM_EVENT_TYPE.AUDIO_MUTED:
356
361
  $("#audioMuted").text(true);
362
+ $("#audioMutedStream").text(mutedName);
357
363
  break;
358
364
  case STREAM_EVENT_TYPE.AUDIO_UNMUTED:
359
365
  $("#audioMuted").text(false);
366
+ $("#audioMutedStream").text(mutedName);
360
367
  break;
361
368
  case STREAM_EVENT_TYPE.VIDEO_MUTED:
362
369
  $("#videoMuted").text(true);
370
+ $("#videoMutedStream").text(mutedName);
363
371
  break;
364
372
  case STREAM_EVENT_TYPE.VIDEO_UNMUTED:
365
373
  $("#videoMuted").text(false);
374
+ $("#videoMutedStream").text(mutedName);
366
375
  break;
367
376
 
368
377
  }
@@ -503,6 +512,7 @@ function rewriteSdp(sdp) {
503
512
  }
504
513
  return sdp.sdpString;
505
514
  }
515
+
506
516
  // UI helpers
507
517
  // show connection, or local, or remote stream status
508
518
  function setStatus(selector, status, stream) {
@@ -543,6 +553,8 @@ function unmuteInputs(selector) {
543
553
  });
544
554
  }
545
555
 
556
+
557
+
546
558
  function resizeLocalVideo(event) {
547
559
  var requested = constraints.video;
548
560
  if (requested.width != event.target.videoWidth || requested.height != event.target.videoHeight) {
@@ -875,8 +887,8 @@ function readyControls() {
875
887
  }
876
888
  }
877
889
 
878
- // Stat
879
- function loadStats() {
890
+ // Get WebRTC publishing stats
891
+ function loadPublishStats() {
880
892
  if (publishStream) {
881
893
  publishStream.getStats(function (stats) {
882
894
  if (stats && stats.outboundStream) {
@@ -913,6 +925,10 @@ function loadStats() {
913
925
  }
914
926
  });
915
927
  }
928
+ }
929
+
930
+ // Get WebRTC playback stats
931
+ function loadPlayStats() {
916
932
  if (previewStream) {
917
933
  previewStream.getStats(function (stats) {
918
934
  if (stats && stats.inboundStream) {
@@ -953,26 +969,29 @@ function loadStats() {
953
969
  }
954
970
  });
955
971
  }
956
- function showStat(stat, type) {
957
- Object.keys(stat).forEach(function(key) {
958
- if (typeof stat[key] !== 'object') {
959
- let k = key.split(/(?=[A-Z])/);
960
- let metric = "";
961
- for (let i = 0; i < k.length; i++) {
962
- metric += k[i][0].toUpperCase() + k[i].substring(1) + " ";
963
- }
964
- if ($("#" + key + "-" + type).length == 0) {
965
- let html = "<div style='font-weight: bold'>" + metric.trim() + ": <span id='" + key + "-" + type + "' style='font-weight: normal'></span>" + "</div>";
966
- // $(html).insertAfter("#" + type);
967
- $("#" + type).append(html);
968
- } else {
969
- $("#" + key + "-" + type).text(stat[key]);
970
- }
972
+ }
973
+
974
+ // Helper funcltion to display stats
975
+ function showStat(stat, type) {
976
+ Object.keys(stat).forEach(function(key) {
977
+ if (typeof stat[key] !== 'object') {
978
+ let k = key.split(/(?=[A-Z])/);
979
+ let metric = "";
980
+ for (let i = 0; i < k.length; i++) {
981
+ metric += k[i][0].toUpperCase() + k[i].substring(1) + " ";
971
982
  }
972
- });
973
- }
983
+ if ($("#" + key + "-" + type).length == 0) {
984
+ let html = "<div style='font-weight: bold'>" + metric.trim() + ": <span id='" + key + "-" + type + "' style='font-weight: normal'></span>" + "</div>";
985
+ // $(html).insertAfter("#" + type);
986
+ $("#" + type).append(html);
987
+ } else {
988
+ $("#" + key + "-" + type).text(stat[key]);
989
+ }
990
+ }
991
+ });
974
992
  }
975
993
 
994
+
976
995
  //Test
977
996
  var micLevelInterval;
978
997
  var testStarted;