@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.
@@ -6933,7 +6933,7 @@ function getClientInfo(_x, _x2) {
6933
6933
  return _getClientInfo.apply(this, arguments);
6934
6934
  }
6935
6935
  function _getClientInfo() {
6936
- _getClientInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(navigator, keys) {
6936
+ _getClientInfo = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(navigator, keys) {
6937
6937
  var info, customUAData;
6938
6938
  return _regeneratorRuntime().wrap(function _callee$(_context) {
6939
6939
  while (1) switch (_context.prev = _context.next) {
@@ -7900,7 +7900,7 @@ var disableConnectionQualityCalculation;
7900
7900
  * @memberof Flashphoner
7901
7901
  */
7902
7902
  var init = /*#__PURE__*/function () {
7903
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
7903
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
7904
7904
  var waitingTemasys, audioContext, webRtcProvider, enableGainNode, webRtcConf, flashProvider, flashConf, mediaSourceMediaProvider, mseConf, websocketProvider, wsConf, _MediaProvider, p, newMediaProvider, i, pMP;
7905
7905
  return _regeneratorRuntime().wrap(function _callee$(_context) {
7906
7906
  while (1) switch (_context.prev = _context.next) {
@@ -10052,7 +10052,7 @@ var createSession = function createSession(options) {
10052
10052
  * @memberof Stream
10053
10053
  * @inner
10054
10054
  */
10055
- var stop = function stop() {
10055
+ var _stop = function stop() {
10056
10056
  logger.debug(LOG_PREFIX, "Stop stream " + name_);
10057
10057
  if (status_ == STREAM_STATUS.NEW) {
10058
10058
  //trigger FAILED status
@@ -10062,7 +10062,7 @@ var createSession = function createSession(options) {
10062
10062
  return;
10063
10063
  } else if (status_ == STREAM_STATUS.PENDING) {
10064
10064
  logger.warn(LOG_PREFIX, "Stopping stream before server response " + id_);
10065
- setTimeout(stop, 200);
10065
+ setTimeout(_stop, 200);
10066
10066
  return;
10067
10067
  } else if (status_ == STREAM_STATUS.FAILED) {
10068
10068
  logger.warn(LOG_PREFIX, "Stream status FAILED");
@@ -10473,7 +10473,7 @@ var createSession = function createSession(options) {
10473
10473
  };
10474
10474
  stream.play = play;
10475
10475
  stream.publish = publish;
10476
- stream.stop = stop;
10476
+ stream.stop = _stop;
10477
10477
  stream.id = id;
10478
10478
  stream.status = status;
10479
10479
  stream.name = name;
@@ -10732,7 +10732,8 @@ var createSession = function createSession(options) {
10732
10732
  if (!localVideo && mediaProvider.getVideoElement) {
10733
10733
  localVideo = mediaProvider.getVideoElement(display);
10734
10734
  }
10735
- if (localVideo) {
10735
+ // PR #19 from GitHub to prevent Sentry issue #WCS-4239
10736
+ if (localVideo && localVideo.srcObject) {
10736
10737
  localVideo.srcObject.getAudioTracks().forEach(function (track) {
10737
10738
  var device = track.label;
10738
10739
  if (device === "MediaStreamAudioDestinationNode" && mediaProvider.getAudioSourceDevice) {
@@ -11365,7 +11366,7 @@ var createConnection = function createConnection(options) {
11365
11366
  var localVideo;
11366
11367
  //tweak for custom video players #WCS-1511
11367
11368
  var remoteVideo = options.remoteVideo;
11368
- var switchCamCount = 0;
11369
+ var switchCamIndex = 0;
11369
11370
  var switchMicCount = 0;
11370
11371
  var customStream = options.customStream;
11371
11372
  var currentAudioTrack;
@@ -11451,7 +11452,7 @@ var createConnection = function createConnection(options) {
11451
11452
  if (videoTrack) {
11452
11453
  videoCams.forEach(function (cam, index) {
11453
11454
  if (videoTrack.label === cam.label) {
11454
- switchCamCount = index;
11455
+ switchCamIndex = index;
11455
11456
  }
11456
11457
  });
11457
11458
  }
@@ -11912,13 +11913,27 @@ var createConnection = function createConnection(options) {
11912
11913
  if (localVideo && localVideo.srcObject && videoCams.length > 1 && !customStream && !screenShare) {
11913
11914
  connection.getSenders().forEach(function (sender) {
11914
11915
  if (sender.track.kind === 'audio') return;
11915
- switchCamCount = (switchCamCount + 1) % videoCams.length;
11916
11916
  sender.track.stop();
11917
- var cam = typeof deviceId !== "undefined" ? deviceId : videoCams[switchCamCount].id;
11917
+ var cameraId;
11918
+ if (typeof deviceId !== "undefined") {
11919
+ videoCams.forEach(function (cam, index) {
11920
+ if (deviceId === cam.id) {
11921
+ switchCamIndex = index;
11922
+ }
11923
+ });
11924
+ cameraId = deviceId;
11925
+ } else {
11926
+ switchCamIndex = (switchCamIndex + 1) % videoCams.length;
11927
+ cameraId = videoCams[switchCamIndex].id;
11928
+ }
11929
+ if (!cameraId) {
11930
+ logger.error(LOG_PREFIX, "Can't detect camera to switch to");
11931
+ reject(constants.ERROR_INFO.CAN_NOT_SWITCH_CAM);
11932
+ }
11918
11933
  //use the settings that were set during connection initiation
11919
11934
  var clonedConstraints = Object.assign({}, constraints);
11920
11935
  clonedConstraints.video.deviceId = {
11921
- exact: cam
11936
+ exact: cameraId
11922
11937
  };
11923
11938
  clonedConstraints.audio = false;
11924
11939
  navigator.mediaDevices.getUserMedia(clonedConstraints).then(function (newStream) {
@@ -11931,8 +11946,8 @@ var createConnection = function createConnection(options) {
11931
11946
  if (localVideo.srcObject.getAudioTracks().length == 0 && audioTrack) {
11932
11947
  localVideo.srcObject.addTrack(audioTrack);
11933
11948
  }
11934
- logger.info(LOG_PREFIX, "Switch camera to " + cam);
11935
- resolve(cam);
11949
+ logger.info(LOG_PREFIX, "Switch camera to " + cameraId);
11950
+ resolve(cameraId);
11936
11951
  })["catch"](function (reason) {
11937
11952
  logger.error(LOG_PREFIX, reason);
11938
11953
  reject(reason);