@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.
@@ -30,6 +30,7 @@ var events = {
30
30
  'hls-started': eventPrifix + "-hls-started",
31
31
  'hls-stopped': eventPrifix + "-hls-stopped",
32
32
  'hls-state-changed': eventPrifix + "-hls-state-changed",
33
+ 'hls-playable-state-changed': eventPrifix + "-hls-playable-state-changed",
33
34
  'recording-state-changed': eventPrifix + "-recording-state-changed",
34
35
  'livestream-state-changed': eventPrifix + "-livestream-state-changed",
35
36
  'meeting-state-changed': eventPrifix + "-meeting-state-changed",
@@ -39,7 +40,6 @@ var eventEmitter = new EventEmitter();
39
40
  eventEmitter.setMaxListeners(9999);
40
41
 
41
42
  var MeetingProviderContex = createContext();
42
-
43
43
  var useMeeting = function useMeeting(_temp) {
44
44
  var _ref = _temp === void 0 ? {} : _temp,
45
45
  _ref$onParticipantJoi = _ref.onParticipantJoined,
@@ -297,7 +297,7 @@ var MeetingConsumer = function MeetingConsumer(_ref2) {
297
297
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MeetingProviderContex.Consumer, null, children));
298
298
  };
299
299
 
300
- var version = "0.1.66";
300
+ var version = "0.1.67";
301
301
 
302
302
  var MeetingProvider = function MeetingProvider(_ref) {
303
303
  var children = _ref.children,
@@ -354,15 +354,22 @@ var MeetingProvider = function MeetingProvider(_ref) {
354
354
  var _useState16 = useState(false),
355
355
  isHls = _useState16[0],
356
356
  setIsHls = _useState16[1];
357
- var _useState17 = useState(null),
357
+ var _useState17 = useState('RECORDING_STOPPED'),
358
358
  recordingState = _useState17[0],
359
359
  setRecordingState = _useState17[1];
360
- var _useState18 = useState(null),
360
+ var _useState18 = useState('LIVESTREAM_STOPPED'),
361
361
  livestreamState = _useState18[0],
362
362
  setLivestreamState = _useState18[1];
363
- var _useState19 = useState(null),
363
+ var _useState19 = useState('HLS_STOPPED'),
364
364
  hlsState = _useState19[0],
365
365
  setHlsState = _useState19[1];
366
+ var _useState20 = useState({
367
+ downstreamUrl: null,
368
+ playbackHlsUrl: null,
369
+ livestreamUrl: null
370
+ }),
371
+ hlsUrls = _useState20[0],
372
+ setHlsUrls = _useState20[1];
366
373
  var meetingRef = useRef();
367
374
  var localMicOnRef = useRef();
368
375
  var localWebcamOnRef = useRef();
@@ -416,9 +423,14 @@ var MeetingProvider = function MeetingProvider(_ref) {
416
423
  setConnections(new Map());
417
424
  setIsMeetingJoined(false);
418
425
  setIsHls(false);
419
- setRecordingState(null);
420
- setLivestreamState(null);
421
- setHlsState(null);
426
+ setRecordingState('RECORDING_STOPPED');
427
+ setLivestreamState('LIVESTREAM_STOPPED');
428
+ setHlsState('HLS_STOPPED');
429
+ setHlsUrls({
430
+ downstreamUrl: null,
431
+ playbackHlsUrl: null,
432
+ livestreamUrl: null
433
+ });
422
434
  };
423
435
  var _handle_participant_joined = function _handle_participant_joined(participant) {
424
436
  setParticipants(function (participants) {
@@ -619,6 +631,19 @@ var MeetingProvider = function MeetingProvider(_ref) {
619
631
  };
620
632
  var _handle_hls_state_changed = function _handle_hls_state_changed(data) {
621
633
  setHlsState(data === null || data === void 0 ? void 0 : data.status);
634
+ if ((data === null || data === void 0 ? void 0 : data.status) == 'HLS_PLAYABLE') {
635
+ setHlsUrls({
636
+ downstreamUrl: data === null || data === void 0 ? void 0 : data.downstreamUrl,
637
+ playbackHlsUrl: data === null || data === void 0 ? void 0 : data.playbackHlsUrl,
638
+ livestreamUrl: data === null || data === void 0 ? void 0 : data.livestreamUrl
639
+ });
640
+ } else if ((data === null || data === void 0 ? void 0 : data.status) == 'HLS_STOPPED') {
641
+ setHlsUrls({
642
+ downstreamUrl: null,
643
+ playbackHlsUrl: null,
644
+ livestreamUrl: null
645
+ });
646
+ }
622
647
  eventEmitter.emit(events['hls-state-changed'], data);
623
648
  };
624
649
  var _handle_meeting_state_changed = function _handle_meeting_state_changed(data) {
@@ -632,7 +657,6 @@ var MeetingProvider = function MeetingProvider(_ref) {
632
657
  participants.set(part.id, part);
633
658
  return participants;
634
659
  });
635
-
636
660
  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)) {
637
661
  setLocalParticipant(function (participant) {
638
662
  participant.mode = data.mode;
@@ -898,7 +922,7 @@ var MeetingProvider = function MeetingProvider(_ref) {
898
922
  payload = _ref6.payload;
899
923
  try {
900
924
  var _meeting3 = meetingRef.current;
901
- var _temp2 = function () {
925
+ var _temp = function () {
902
926
  if (_meeting3) {
903
927
  return Promise.resolve(_meeting3.connectTo({
904
928
  meetingId: meetingId,
@@ -906,7 +930,7 @@ var MeetingProvider = function MeetingProvider(_ref) {
906
930
  })).then(function () {});
907
931
  }
908
932
  }();
909
- return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
933
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
910
934
  } catch (e) {
911
935
  return Promise.reject(e);
912
936
  }
@@ -969,6 +993,7 @@ var MeetingProvider = function MeetingProvider(_ref) {
969
993
  recordingState: recordingState,
970
994
  livestreamState: livestreamState,
971
995
  hlsState: hlsState,
996
+ hlsUrls: hlsUrls,
972
997
  isMeetingJoined: isMeetingJoined,
973
998
  join: join,
974
999
  leave: leave,
@@ -1038,7 +1063,6 @@ var useParticipant = function useParticipant(participantId, _temp) {
1038
1063
  cam: false,
1039
1064
  share: false
1040
1065
  };
1041
-
1042
1066
  return {
1043
1067
  participants: participants,
1044
1068
  localParticipant: localParticipant,
@@ -1052,7 +1076,6 @@ var useParticipant = function useParticipant(participantId, _temp) {
1052
1076
  activeSpeakerId = _useMemo.activeSpeakerId,
1053
1077
  mainParticipant = _useMemo.mainParticipant,
1054
1078
  pinState = _useMemo.pinState;
1055
-
1056
1079
  var participant = participants === null || participants === void 0 ? void 0 : participants.get(participantId);
1057
1080
  var _useState5 = useState(participant === null || participant === void 0 ? void 0 : participant.webcamOn),
1058
1081
  webcamOn = _useState5[0],
@@ -1173,6 +1196,9 @@ var useParticipant = function useParticipant(participantId, _temp) {
1173
1196
  var unpin = function unpin(data) {
1174
1197
  participant === null || participant === void 0 ? void 0 : participant.unpin(data);
1175
1198
  };
1199
+ var remove = function remove() {
1200
+ participant === null || participant === void 0 ? void 0 : participant.remove();
1201
+ };
1176
1202
  var getAudioStats = function getAudioStats() {
1177
1203
  return Promise.resolve(participant === null || participant === void 0 ? void 0 : participant.getAudioStats());
1178
1204
  };
@@ -1250,6 +1276,7 @@ var useParticipant = function useParticipant(participantId, _temp) {
1250
1276
  disableWebcam: disableWebcam,
1251
1277
  pin: pin,
1252
1278
  unpin: unpin,
1279
+ remove: remove,
1253
1280
  switchTo: switchTo,
1254
1281
  getAudioStats: getAudioStats,
1255
1282
  getVideoStats: getVideoStats,
@@ -1343,7 +1370,6 @@ var usePubSub = function usePubSub(topic, _temp) {
1343
1370
  messages = _useState[0],
1344
1371
  setMessages = _useState[1];
1345
1372
  var isSubscribed = useRef(false);
1346
-
1347
1373
  var publish = function publish(message, options) {
1348
1374
  if (meeting) {
1349
1375
  meeting.pubSub.publish(topic, message, options);
@@ -1385,7 +1411,6 @@ var usePubSub = function usePubSub(topic, _temp) {
1385
1411
  };
1386
1412
 
1387
1413
  var Constants = VideoSDK.Constants;
1388
-
1389
1414
  var createCameraVideoTrack = function createCameraVideoTrack(_ref) {
1390
1415
  var _ref$cameraId = _ref.cameraId,
1391
1416
  cameraId = _ref$cameraId === void 0 ? undefined : _ref$cameraId,
@@ -1409,7 +1434,6 @@ var createCameraVideoTrack = function createCameraVideoTrack(_ref) {
1409
1434
  return Promise.reject(e);
1410
1435
  }
1411
1436
  };
1412
-
1413
1437
  var createScreenShareVideoTrack = function createScreenShareVideoTrack(_ref2) {
1414
1438
  var _ref2$encoderConfig = _ref2.encoderConfig,
1415
1439
  encoderConfig = _ref2$encoderConfig === void 0 ? undefined : _ref2$encoderConfig,
@@ -1427,7 +1451,6 @@ var createScreenShareVideoTrack = function createScreenShareVideoTrack(_ref2) {
1427
1451
  return Promise.reject(e);
1428
1452
  }
1429
1453
  };
1430
-
1431
1454
  var createMicrophoneAudioTrack = function createMicrophoneAudioTrack(_ref3) {
1432
1455
  var _ref3$noiseConfig = _ref3.noiseConfig,
1433
1456
  noiseConfig = _ref3$noiseConfig === void 0 ? undefined : _ref3$noiseConfig,