@videosdk.live/react-sdk 0.3.0 → 0.3.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.
@@ -3,63 +3,53 @@ import EventEmitter from 'events';
3
3
  import { VideoSDK } from '@videosdk.live/js-sdk';
4
4
  export { CameraDeviceInfo, DeviceInfo, MicrophoneDeviceInfo } from '@videosdk.live/js-sdk';
5
5
 
6
- function _extends() {
7
- _extends = Object.assign ? Object.assign.bind() : function (target) {
8
- for (var i = 1; i < arguments.length; i++) {
9
- var source = arguments[i];
10
- for (var key in source) {
11
- if (Object.prototype.hasOwnProperty.call(source, key)) {
12
- target[key] = source[key];
13
- }
14
- }
15
- }
16
- return target;
17
- };
18
- return _extends.apply(this, arguments);
6
+ function _arrayLikeToArray(r, a) {
7
+ (null == a || a > r.length) && (a = r.length);
8
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
9
+ return n;
19
10
  }
20
- function _objectWithoutPropertiesLoose(source, excluded) {
21
- if (source == null) return {};
22
- var target = {};
23
- var sourceKeys = Object.keys(source);
24
- var key, i;
25
- for (i = 0; i < sourceKeys.length; i++) {
26
- key = sourceKeys[i];
27
- if (excluded.indexOf(key) >= 0) continue;
28
- target[key] = source[key];
29
- }
30
- return target;
31
- }
32
- function _unsupportedIterableToArray(o, minLen) {
33
- if (!o) return;
34
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
35
- var n = Object.prototype.toString.call(o).slice(8, -1);
36
- if (n === "Object" && o.constructor) n = o.constructor.name;
37
- if (n === "Map" || n === "Set") return Array.from(o);
38
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
39
- }
40
- function _arrayLikeToArray(arr, len) {
41
- if (len == null || len > arr.length) len = arr.length;
42
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
43
- return arr2;
44
- }
45
- function _createForOfIteratorHelperLoose(o, allowArrayLike) {
46
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
47
- if (it) return (it = it.call(o)).next.bind(it);
48
- if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
49
- if (it) o = it;
50
- var i = 0;
11
+ function _createForOfIteratorHelperLoose(r, e) {
12
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
13
+ if (t) return (t = t.call(r)).next.bind(t);
14
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
15
+ t && (r = t);
16
+ var o = 0;
51
17
  return function () {
52
- if (i >= o.length) return {
53
- done: true
54
- };
55
- return {
56
- done: false,
57
- value: o[i++]
18
+ return o >= r.length ? {
19
+ done: !0
20
+ } : {
21
+ done: !1,
22
+ value: r[o++]
58
23
  };
59
24
  };
60
25
  }
61
26
  throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
62
27
  }
28
+ function _extends() {
29
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
30
+ for (var e = 1; e < arguments.length; e++) {
31
+ var t = arguments[e];
32
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
33
+ }
34
+ return n;
35
+ }, _extends.apply(null, arguments);
36
+ }
37
+ function _objectWithoutPropertiesLoose(r, e) {
38
+ if (null == r) return {};
39
+ var t = {};
40
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
41
+ if (-1 !== e.indexOf(n)) continue;
42
+ t[n] = r[n];
43
+ }
44
+ return t;
45
+ }
46
+ function _unsupportedIterableToArray(r, a) {
47
+ if (r) {
48
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
49
+ var t = {}.toString.call(r).slice(8, -1);
50
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
51
+ }
52
+ }
63
53
 
64
54
  var eventPrifix = 'videosdk-live-react-sdk';
65
55
  var events = {
@@ -409,7 +399,7 @@ var MeetingConsumer = function MeetingConsumer(_ref2) {
409
399
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MeetingProviderContex.Consumer, null, children));
410
400
  };
411
401
 
412
- var version = "0.3.0";
402
+ var version = "0.3.1";
413
403
 
414
404
  var MeetingProvider = function MeetingProvider(_ref) {
415
405
  var children = _ref.children,
@@ -661,7 +651,7 @@ var MeetingProvider = function MeetingProvider(_ref) {
661
651
  setIsMeetingJoined(true);
662
652
  }
663
653
  };
664
- var _handle_meeting_left = function _handle_meeting_left() {
654
+ var _handle_meeting_left2 = function _handle_meeting_left() {
665
655
  eventEmitter.emit(events['meeting-left']);
666
656
  var meeting = meetingRef.current;
667
657
  if (meeting) {
@@ -679,7 +669,7 @@ var MeetingProvider = function MeetingProvider(_ref) {
679
669
  meeting.off('recording-started', _handle_recording_started);
680
670
  meeting.off('recording-stopped', _handle_recording_stopped);
681
671
  meeting.off('meeting-joined', _handle_meeting_joined);
682
- meeting.off('meeting-left', _handle_meeting_left);
672
+ meeting.off('meeting-left', _handle_meeting_left2);
683
673
  meeting.off('livestream-started', _handle_live_stream_started);
684
674
  meeting.off('livestream-stopped', _handle_live_stream_stopped);
685
675
  meeting.off('video-state-changed', _handle_video_state_changed);
@@ -861,7 +851,7 @@ var MeetingProvider = function MeetingProvider(_ref) {
861
851
  meeting.on('recording-started', _handle_recording_started);
862
852
  meeting.on('recording-stopped', _handle_recording_stopped);
863
853
  meeting.on('meeting-joined', _handle_meeting_joined);
864
- meeting.on('meeting-left', _handle_meeting_left);
854
+ meeting.on('meeting-left', _handle_meeting_left2);
865
855
  meeting.on('livestream-started', _handle_live_stream_started);
866
856
  meeting.on('livestream-stopped', _handle_live_stream_stopped);
867
857
  meeting.on('video-state-changed', _handle_video_state_changed);
@@ -1278,7 +1268,15 @@ var useParticipant = function useParticipant(participantId, _temp) {
1278
1268
  _ref$onStreamPaused = _ref.onStreamPaused,
1279
1269
  onStreamPaused = _ref$onStreamPaused === void 0 ? function () {} : _ref$onStreamPaused,
1280
1270
  _ref$onStreamResumed = _ref.onStreamResumed,
1281
- onStreamResumed = _ref$onStreamResumed === void 0 ? function () {} : _ref$onStreamResumed;
1271
+ onStreamResumed = _ref$onStreamResumed === void 0 ? function () {} : _ref$onStreamResumed,
1272
+ _ref$onProducerAdded = _ref.onProducerAdded,
1273
+ onProducerAdded = _ref$onProducerAdded === void 0 ? function () {} : _ref$onProducerAdded,
1274
+ _ref$onProducerRemove = _ref.onProducerRemoved,
1275
+ onProducerRemoved = _ref$onProducerRemove === void 0 ? function () {} : _ref$onProducerRemove,
1276
+ _ref$onConsumerAdded = _ref.onConsumerAdded,
1277
+ onConsumerAdded = _ref$onConsumerAdded === void 0 ? function () {} : _ref$onConsumerAdded,
1278
+ _ref$onConsumerRemove = _ref.onConsumerRemoved,
1279
+ onConsumerRemoved = _ref$onConsumerRemove === void 0 ? function () {} : _ref$onConsumerRemove;
1282
1280
  var _useState = useState(null),
1283
1281
  webcamStream = _useState[0],
1284
1282
  setwebcamStream = _useState[1];
@@ -1495,6 +1493,18 @@ var useParticipant = function useParticipant(participantId, _temp) {
1495
1493
  });
1496
1494
  participant === null || participant === void 0 ? void 0 : participant.on('media-status-changed', _handleMediaStatusChanged);
1497
1495
  participant === null || participant === void 0 ? void 0 : participant.on('video-quality-changed', _handleVideoQualityChanged);
1496
+ participant === null || participant === void 0 ? void 0 : participant.on('producer-added', function (data) {
1497
+ onProducerAdded(data);
1498
+ });
1499
+ participant === null || participant === void 0 ? void 0 : participant.on('producer-removed', function (data) {
1500
+ onProducerRemoved(data);
1501
+ });
1502
+ participant === null || participant === void 0 ? void 0 : participant.on('consumer-added', function (data) {
1503
+ onConsumerAdded(data);
1504
+ });
1505
+ participant === null || participant === void 0 ? void 0 : participant.on('consumer-removed', function (data) {
1506
+ onConsumerRemoved(data);
1507
+ });
1498
1508
  eventEmitter.on(events['participant-mode-changed'], _handleParticipantModeChanged);
1499
1509
  return function () {
1500
1510
  participant === null || participant === void 0 ? void 0 : participant.off('stream-enabled', _handleStreamEnabled);