@videosdk.live/react-sdk 0.1.66 → 0.1.68

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.
package/README.md CHANGED
@@ -37,7 +37,7 @@
37
37
  Visit our official guide for [Browser Support](https://docs.videosdk.live/docs/realtime-communication/see-also/device-browser-support)
38
38
 
39
39
  ## Demo App
40
- Check out demo [here](https://videosdk.live/prebuilt/)
40
+ Check out demo [here](https://demo.videosdk.live/conference-meeting/)
41
41
 
42
42
  ## Prerequisites
43
43
 
@@ -80,7 +80,7 @@ import {
80
80
 
81
81
  ## Documentation
82
82
 
83
- Check the components and their usage in our [documentation](https://docs.videosdk.live/react/guide/video-and-audio-calling-api-sdk/getting-started).
83
+ Check the components and their usage in our [documentation](https://docs.videosdk.live/react/guide/video-and-audio-calling-api-sdk/concept-and-architecture).
84
84
 
85
85
  ## Quick Start
86
86
 
package/dist/index.js CHANGED
@@ -33,6 +33,7 @@ var events = {
33
33
  'hls-started': eventPrifix + "-hls-started",
34
34
  'hls-stopped': eventPrifix + "-hls-stopped",
35
35
  'hls-state-changed': eventPrifix + "-hls-state-changed",
36
+ 'hls-playable-state-changed': eventPrifix + "-hls-playable-state-changed",
36
37
  'recording-state-changed': eventPrifix + "-recording-state-changed",
37
38
  'livestream-state-changed': eventPrifix + "-livestream-state-changed",
38
39
  'meeting-state-changed': eventPrifix + "-meeting-state-changed",
@@ -42,7 +43,6 @@ var eventEmitter = new EventEmitter();
42
43
  eventEmitter.setMaxListeners(9999);
43
44
 
44
45
  var MeetingProviderContex = React.createContext();
45
-
46
46
  var useMeeting = function useMeeting(_temp) {
47
47
  var _ref = _temp === void 0 ? {} : _temp,
48
48
  _ref$onParticipantJoi = _ref.onParticipantJoined,
@@ -300,7 +300,7 @@ var MeetingConsumer = function MeetingConsumer(_ref2) {
300
300
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(MeetingProviderContex.Consumer, null, children));
301
301
  };
302
302
 
303
- var version = "0.1.66";
303
+ var version = "0.1.67";
304
304
 
305
305
  var MeetingProvider = function MeetingProvider(_ref) {
306
306
  var children = _ref.children,
@@ -357,15 +357,22 @@ var MeetingProvider = function MeetingProvider(_ref) {
357
357
  var _useState16 = React.useState(false),
358
358
  isHls = _useState16[0],
359
359
  setIsHls = _useState16[1];
360
- var _useState17 = React.useState(null),
360
+ var _useState17 = React.useState('RECORDING_STOPPED'),
361
361
  recordingState = _useState17[0],
362
362
  setRecordingState = _useState17[1];
363
- var _useState18 = React.useState(null),
363
+ var _useState18 = React.useState('LIVESTREAM_STOPPED'),
364
364
  livestreamState = _useState18[0],
365
365
  setLivestreamState = _useState18[1];
366
- var _useState19 = React.useState(null),
366
+ var _useState19 = React.useState('HLS_STOPPED'),
367
367
  hlsState = _useState19[0],
368
368
  setHlsState = _useState19[1];
369
+ var _useState20 = React.useState({
370
+ downstreamUrl: null,
371
+ playbackHlsUrl: null,
372
+ livestreamUrl: null
373
+ }),
374
+ hlsUrls = _useState20[0],
375
+ setHlsUrls = _useState20[1];
369
376
  var meetingRef = React.useRef();
370
377
  var localMicOnRef = React.useRef();
371
378
  var localWebcamOnRef = React.useRef();
@@ -419,9 +426,14 @@ var MeetingProvider = function MeetingProvider(_ref) {
419
426
  setConnections(new Map());
420
427
  setIsMeetingJoined(false);
421
428
  setIsHls(false);
422
- setRecordingState(null);
423
- setLivestreamState(null);
424
- setHlsState(null);
429
+ setRecordingState('RECORDING_STOPPED');
430
+ setLivestreamState('LIVESTREAM_STOPPED');
431
+ setHlsState('HLS_STOPPED');
432
+ setHlsUrls({
433
+ downstreamUrl: null,
434
+ playbackHlsUrl: null,
435
+ livestreamUrl: null
436
+ });
425
437
  };
426
438
  var _handle_participant_joined = function _handle_participant_joined(participant) {
427
439
  setParticipants(function (participants) {
@@ -622,6 +634,19 @@ var MeetingProvider = function MeetingProvider(_ref) {
622
634
  };
623
635
  var _handle_hls_state_changed = function _handle_hls_state_changed(data) {
624
636
  setHlsState(data === null || data === void 0 ? void 0 : data.status);
637
+ if ((data === null || data === void 0 ? void 0 : data.status) == 'HLS_PLAYABLE') {
638
+ setHlsUrls({
639
+ downstreamUrl: data === null || data === void 0 ? void 0 : data.downstreamUrl,
640
+ playbackHlsUrl: data === null || data === void 0 ? void 0 : data.playbackHlsUrl,
641
+ livestreamUrl: data === null || data === void 0 ? void 0 : data.livestreamUrl
642
+ });
643
+ } else if ((data === null || data === void 0 ? void 0 : data.status) == 'HLS_STOPPED') {
644
+ setHlsUrls({
645
+ downstreamUrl: null,
646
+ playbackHlsUrl: null,
647
+ livestreamUrl: null
648
+ });
649
+ }
625
650
  eventEmitter.emit(events['hls-state-changed'], data);
626
651
  };
627
652
  var _handle_meeting_state_changed = function _handle_meeting_state_changed(data) {
@@ -635,7 +660,6 @@ var MeetingProvider = function MeetingProvider(_ref) {
635
660
  participants.set(part.id, part);
636
661
  return participants;
637
662
  });
638
-
639
663
  if (data.participantId === (meetingRef === null || meetingRef === void 0 ? void 0 : (_meetingRef$current2 = meetingRef.current) === null || _meetingRef$current2 === void 0 ? void 0 : (_meetingRef$current2$ = _meetingRef$current2.localParticipant) === null || _meetingRef$current2$ === void 0 ? void 0 : _meetingRef$current2$.id)) {
640
664
  setLocalParticipant(function (participant) {
641
665
  participant.mode = data.mode;
@@ -901,7 +925,7 @@ var MeetingProvider = function MeetingProvider(_ref) {
901
925
  payload = _ref6.payload;
902
926
  try {
903
927
  var _meeting3 = meetingRef.current;
904
- var _temp2 = function () {
928
+ var _temp = function () {
905
929
  if (_meeting3) {
906
930
  return Promise.resolve(_meeting3.connectTo({
907
931
  meetingId: meetingId,
@@ -909,7 +933,7 @@ var MeetingProvider = function MeetingProvider(_ref) {
909
933
  })).then(function () {});
910
934
  }
911
935
  }();
912
- return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
936
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
913
937
  } catch (e) {
914
938
  return Promise.reject(e);
915
939
  }
@@ -972,6 +996,7 @@ var MeetingProvider = function MeetingProvider(_ref) {
972
996
  recordingState: recordingState,
973
997
  livestreamState: livestreamState,
974
998
  hlsState: hlsState,
999
+ hlsUrls: hlsUrls,
975
1000
  isMeetingJoined: isMeetingJoined,
976
1001
  join: join,
977
1002
  leave: leave,
@@ -1041,7 +1066,6 @@ var useParticipant = function useParticipant(participantId, _temp) {
1041
1066
  cam: false,
1042
1067
  share: false
1043
1068
  };
1044
-
1045
1069
  return {
1046
1070
  participants: participants,
1047
1071
  localParticipant: localParticipant,
@@ -1055,7 +1079,6 @@ var useParticipant = function useParticipant(participantId, _temp) {
1055
1079
  activeSpeakerId = _useMemo.activeSpeakerId,
1056
1080
  mainParticipant = _useMemo.mainParticipant,
1057
1081
  pinState = _useMemo.pinState;
1058
-
1059
1082
  var participant = participants === null || participants === void 0 ? void 0 : participants.get(participantId);
1060
1083
  var _useState5 = React.useState(participant === null || participant === void 0 ? void 0 : participant.webcamOn),
1061
1084
  webcamOn = _useState5[0],
@@ -1176,6 +1199,9 @@ var useParticipant = function useParticipant(participantId, _temp) {
1176
1199
  var unpin = function unpin(data) {
1177
1200
  participant === null || participant === void 0 ? void 0 : participant.unpin(data);
1178
1201
  };
1202
+ var remove = function remove() {
1203
+ participant === null || participant === void 0 ? void 0 : participant.remove();
1204
+ };
1179
1205
  var getAudioStats = function getAudioStats() {
1180
1206
  return Promise.resolve(participant === null || participant === void 0 ? void 0 : participant.getAudioStats());
1181
1207
  };
@@ -1253,6 +1279,7 @@ var useParticipant = function useParticipant(participantId, _temp) {
1253
1279
  disableWebcam: disableWebcam,
1254
1280
  pin: pin,
1255
1281
  unpin: unpin,
1282
+ remove: remove,
1256
1283
  switchTo: switchTo,
1257
1284
  getAudioStats: getAudioStats,
1258
1285
  getVideoStats: getVideoStats,
@@ -1346,7 +1373,6 @@ var usePubSub = function usePubSub(topic, _temp) {
1346
1373
  messages = _useState[0],
1347
1374
  setMessages = _useState[1];
1348
1375
  var isSubscribed = React.useRef(false);
1349
-
1350
1376
  var publish = function publish(message, options) {
1351
1377
  if (meeting) {
1352
1378
  meeting.pubSub.publish(topic, message, options);
@@ -1388,7 +1414,6 @@ var usePubSub = function usePubSub(topic, _temp) {
1388
1414
  };
1389
1415
 
1390
1416
  var Constants = jsSdk.VideoSDK.Constants;
1391
-
1392
1417
  var createCameraVideoTrack = function createCameraVideoTrack(_ref) {
1393
1418
  var _ref$cameraId = _ref.cameraId,
1394
1419
  cameraId = _ref$cameraId === void 0 ? undefined : _ref$cameraId,
@@ -1412,7 +1437,6 @@ var createCameraVideoTrack = function createCameraVideoTrack(_ref) {
1412
1437
  return Promise.reject(e);
1413
1438
  }
1414
1439
  };
1415
-
1416
1440
  var createScreenShareVideoTrack = function createScreenShareVideoTrack(_ref2) {
1417
1441
  var _ref2$encoderConfig = _ref2.encoderConfig,
1418
1442
  encoderConfig = _ref2$encoderConfig === void 0 ? undefined : _ref2$encoderConfig,
@@ -1430,7 +1454,6 @@ var createScreenShareVideoTrack = function createScreenShareVideoTrack(_ref2) {
1430
1454
  return Promise.reject(e);
1431
1455
  }
1432
1456
  };
1433
-
1434
1457
  var createMicrophoneAudioTrack = function createMicrophoneAudioTrack(_ref3) {
1435
1458
  var _ref3$noiseConfig = _ref3.noiseConfig,
1436
1459
  noiseConfig = _ref3$noiseConfig === void 0 ? undefined : _ref3$noiseConfig,