@realsee/live 0.5.3 → 0.5.4-alpha.1

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,5 +1,5 @@
1
1
  import TRTC from 'trtc-js-sdk';
2
- import { DefaultModality, ConsoleLogger, LogLevel as LogLevel$1, DefaultDeviceController, MeetingSessionStatusCode, MeetingSessionConfiguration, DefaultMeetingSession } from 'amazon-chime-sdk-js';
2
+ import { DefaultModality, ConsoleLogger, LogLevel as LogLevel$1, DefaultDeviceController, MeetingSessionConfiguration, DefaultMeetingSession, MeetingSessionStatusCode } from 'amazon-chime-sdk-js';
3
3
  import React, { createContext } from 'react';
4
4
 
5
5
  /******************************************************************************
@@ -60,7 +60,7 @@ function __generator$1(thisArg, body) {
60
60
  function verb(n) { return function (v) { return step([n, v]); }; }
61
61
  function step(op) {
62
62
  if (f) throw new TypeError("Generator is already executing.");
63
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
63
+ while (_) try {
64
64
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
65
65
  if (y = 0, t) op = [op[0] & 2, t.value];
66
66
  switch (op[0]) {
@@ -648,7 +648,7 @@ var BrowserRTC4Chime = /** @class */ (function (_super) {
648
648
  // 挂载签名钩子
649
649
  _this._getVoiceSign = options.getVoiceSign;
650
650
  _this._initDom();
651
- _this.logger = new ConsoleLogger('WebRTCLogger', options.logLevel || LogLevel$1.OFF);
651
+ _this.logger = new ConsoleLogger('WebRTCLogger', options.logLevel || LogLevel$1.INFO);
652
652
  _this.deviceController = new DefaultDeviceController(_this.logger);
653
653
  _this.initObservers();
654
654
  return _this;
@@ -672,7 +672,7 @@ var BrowserRTC4Chime = /** @class */ (function (_super) {
672
672
  this.emit('joinWillStart');
673
673
  _d.label = 1;
674
674
  case 1:
675
- _d.trys.push([1, 6, , 7]);
675
+ _d.trys.push([1, 5, , 6]);
676
676
  return [4 /*yield*/, this._getVoiceSign(__assign$1(__assign$1({}, options), { roomId: options.roomId || 0 }))];
677
677
  case 2:
678
678
  _a = _d.sent(), userId = _a.userId, userSig = _a.userSig;
@@ -716,21 +716,18 @@ var BrowserRTC4Chime = /** @class */ (function (_super) {
716
716
  defaultAudioInput = audioInputDevices.find(function (device) { return device.deviceId === 'default'; });
717
717
  otherAudioInput = audioInputDevices.find(function (device) { return device.deviceId !== ''; });
718
718
  this.audioInput = defaultAudioInput || otherAudioInput;
719
- return [4 /*yield*/, this.meetingSession.audioVideo.chooseVideoInputDevice(null)];
719
+ return [4 /*yield*/, this.meetingSession.audioVideo.startAudioInput(((_c = this.audioInput) === null || _c === void 0 ? void 0 : _c.deviceId) || 'default')];
720
720
  case 4:
721
- _d.sent();
722
- return [4 /*yield*/, this.meetingSession.audioVideo.chooseAudioInputDevice(((_c = this.audioInput) === null || _c === void 0 ? void 0 : _c.deviceId) || 'default')];
723
- case 5:
724
721
  _d.sent();
725
722
  this.meetingSession.audioVideo.start();
726
- return [3 /*break*/, 7];
727
- case 6:
723
+ return [3 /*break*/, 6];
724
+ case 5:
728
725
  e_1 = _d.sent();
729
726
  this.emit('error', e_1);
730
727
  this.logger.error(e_1.message);
731
728
  success(false);
732
- return [3 /*break*/, 7];
733
- case 7: return [2 /*return*/];
729
+ return [3 /*break*/, 6];
730
+ case 6: return [2 /*return*/];
734
731
  }
735
732
  });
736
733
  }); })];
@@ -745,21 +742,27 @@ var BrowserRTC4Chime = /** @class */ (function (_super) {
745
742
  var _a, _b;
746
743
  _this.joined = false;
747
744
  var observer = {
748
- audioVideoDidStop: function (sessionStatus) {
749
- var sessionStatusCode = sessionStatus.statusCode();
750
- if (sessionStatusCode === MeetingSessionStatusCode.Left) {
751
- /*
752
- - You called meetingSession.audioVideo.stop().
753
- - When closing a browser window or page, Chime SDK attempts to leave the session.
754
- */
755
- _this.logger.info('You left the session');
756
- success(true);
757
- }
758
- else {
759
- _this.logger.info("Stopped with a session status code: ".concat(sessionStatusCode));
760
- success(true);
761
- }
762
- },
745
+ audioVideoDidStop: function (sessionStatus) { return __awaiter$1(_this, void 0, void 0, function () {
746
+ var sessionStatusCode;
747
+ var _a;
748
+ return __generator$1(this, function (_b) {
749
+ sessionStatusCode = sessionStatus.statusCode();
750
+ (_a = this.meetingSession) === null || _a === void 0 ? void 0 : _a.deviceController.destroy();
751
+ if (sessionStatusCode === MeetingSessionStatusCode.Left) {
752
+ /*
753
+ - You called meetingSession.audioVideo.stop().
754
+ - When closing a browser window or page, Chime SDK attempts to leave the session.
755
+ */
756
+ this.logger.info('You left the session');
757
+ success(true);
758
+ }
759
+ else {
760
+ this.logger.info("Stopped with a session status code: ".concat(sessionStatusCode));
761
+ success(true);
762
+ }
763
+ return [2 /*return*/];
764
+ });
765
+ }); },
763
766
  };
764
767
  (_a = _this.meetingSession) === null || _a === void 0 ? void 0 : _a.audioVideo.addObserver(observer);
765
768
  (_b = _this.meetingSession) === null || _b === void 0 ? void 0 : _b.audioVideo.stop();