@videosdk.live/react-sdk 0.1.43 → 0.1.44

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.
@@ -0,0 +1,43 @@
1
+ export default useConnection;
2
+ /**
3
+ *
4
+ * @param {string} connectionId
5
+ * @param {{onMeeting:{
6
+ * onParticipantJoined: Function,
7
+ * onParticipantLeft: Function,
8
+ * onChatMessage: Function
9
+ * }}}
10
+ * @returns {{
11
+ * connection: {
12
+ * id: string;
13
+ * close: Function;
14
+ * payload: string;
15
+ * meeting: {
16
+ * id: string;
17
+ * sendChatMessage: Function;
18
+ * end: Function;
19
+ * participants: Array<ConnectionParticipant>;
20
+ * };
21
+ * }}}
22
+ */
23
+ declare function useConnection(connectionId: string, { onMeeting }?: {
24
+ onMeeting: {
25
+ onParticipantJoined: Function;
26
+ onParticipantLeft: Function;
27
+ onChatMessage: Function;
28
+ };
29
+ }): {
30
+ connection: {
31
+ id: string;
32
+ close: Function;
33
+ payload: string;
34
+ meeting: {
35
+ id: string;
36
+ sendChatMessage: Function;
37
+ end: Function;
38
+ participants: Array<ConnectionParticipant>;
39
+ };
40
+ };
41
+ };
42
+ import { ConnectionParticipant } from "@videosdk.live/js-sdk/connectionParticipant";
43
+ //# sourceMappingURL=useConnection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useConnection.d.ts","sourceRoot":"","sources":["../../src/connection/useConnection.js"],"names":[],"mappings":";AAGA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,6CAnBW,MAAM;;;;;;;;YAQP,MAAM;;iBAED,MAAM;iBACN;YACd,EAAS,EAAE,MAAM,CAAC;YAClB,eAAsB,WAAW;YACjC,GAAU,WAAW;YACrB,YAAmB,EAAE,MAAM,qBAAqB,CAAC,CAAC;SAC1C;;EAoFR"}
@@ -0,0 +1,99 @@
1
+ import MeetingProvider from "./meeting/MeetingProvider";
2
+ import { useMeeting } from "./meeting/meetingProviderContextDef";
3
+ import useParticipant from "./participant/useParticipant";
4
+ import usePubSub from "./pubSub/usePubSub";
5
+ import { MeetingConsumer } from "./meeting/meetingProviderContextDef";
6
+ import useConnection from "./connection/useConnection";
7
+ export const Constants: {
8
+ errors: {
9
+ INVALID_TOKEN: number;
10
+ INVALID_API_KEY: number;
11
+ INVALID_PERMISSIONS: number;
12
+ INVALID_MEETING_ID: number;
13
+ INVALID_PARTICIPANT_ID: number;
14
+ DUPLICATE_PARTICIPANT: number;
15
+ ACCOUNT_DEACTIVATED: number;
16
+ ACCOUNT_DISCONTINUED: number;
17
+ START_RECORDING_FAILED: number;
18
+ STOP_RECORDING_FAILED: number;
19
+ START_LIVESTREAM_FAILED: number;
20
+ STOP_LIVESTREAM_FAILED: number;
21
+ INVALID_LIVESTREAM_CONFIG: number;
22
+ START_HLS_FAILED: number;
23
+ STOP_HLS_FAILED: number;
24
+ RECORDING_FAILED: number;
25
+ LIVESTREAM_FAILED: number;
26
+ HLS_FAILED: number;
27
+ ERROR_GET_VIDEO_MEDIA: number;
28
+ ERROR_GET_AUDIO_MEDIA: number;
29
+ ERROR_GET_DISPLAY_MEDIA: number;
30
+ };
31
+ recordingEvents: {
32
+ RECORDING_STARTING: string;
33
+ RECORDING_STARTED: string;
34
+ RECORDING_STOPPING: string;
35
+ RECORDING_STOPPED: string;
36
+ };
37
+ livestreamEvents: {
38
+ LIVESTREAM_STARTING: string;
39
+ LIVESTREAM_STARTED: string;
40
+ LIVESTREAM_STOPPING: string;
41
+ LIVESTREAM_STOPPED: string;
42
+ };
43
+ };
44
+ /**
45
+ * @param {{
46
+ * cameraId: string | undefined,
47
+ * encoderConfig: "h90p_w160p" | "h180p_w320p" | "h216p_w384p"
48
+ * | "h360p_w640p" | "h540p_w960p" | "h720p_w1280p" | "h1080p_w1920p"
49
+ * | "h1440p_w2560p" | "h2160p_w3840p" | "h120p_w160p" | "h180p_w240p"
50
+ * | "h240p_w320p" | "h360p_w480p" | "h480p_w640p" | "h540p_w720p"
51
+ * | "h720p_w960p" | "h1080p_w1440p" | "h1440p_w1920p" | undefined,
52
+ * facingMode: "front" | "environment" | undefined,
53
+ * optimizationMode: "text"| "motion" | "detail" | undefined
54
+ * }}
55
+ */
56
+ export function createCameraVideoTrack({ cameraId, encoderConfig, facingMode, optimizationMode }: {
57
+ cameraId: string | undefined;
58
+ encoderConfig: "h90p_w160p" | "h180p_w320p" | "h216p_w384p" | "h360p_w640p" | "h540p_w960p" | "h720p_w1280p" | "h1080p_w1920p" | "h1440p_w2560p" | "h2160p_w3840p" | "h120p_w160p" | "h180p_w240p" | "h240p_w320p" | "h360p_w480p" | "h480p_w640p" | "h540p_w720p" | "h720p_w960p" | "h1080p_w1440p" | "h1440p_w1920p" | undefined;
59
+ facingMode: "front" | "environment" | undefined;
60
+ optimizationMode: "text" | "motion" | "detail" | undefined;
61
+ }): Promise<MediaStream>;
62
+ /**
63
+ * @param {{
64
+ * noiseConfig: {
65
+ * echoCancellation: boolean,
66
+ * autoGainControl: boolean,
67
+ * noiseSuppression: boolean
68
+ * } | undefined,
69
+ * encoderConfig: "speech_low_quality"
70
+ * | "speech_standard" | "music_standard"
71
+ * | "standard_stereo" | "high_quality"
72
+ * | "high_quality_stereo" | undefined
73
+ * microphoneId: string | undefined
74
+ * }}
75
+ */
76
+ export function createMicrophoneAudioTrack({ noiseConfig, encoderConfig, microphoneId }: {
77
+ noiseConfig: {
78
+ echoCancellation: boolean;
79
+ autoGainControl: boolean;
80
+ noiseSuppression: boolean;
81
+ } | undefined;
82
+ encoderConfig: "speech_low_quality" | "speech_standard" | "music_standard" | "standard_stereo" | "high_quality" | "high_quality_stereo" | undefined;
83
+ microphoneId: string | undefined;
84
+ }): Promise<MediaStream>;
85
+ /**
86
+ * @param {{
87
+ * encoderConfig: "h360p_30fps" | "h720p_5fps" | "h720p_15fps"
88
+ * | "h1080p_15fps" | "h1080p_30fps" | undefined,
89
+ * optimizationMode: "text"| "motion" | "detail" | undefined,
90
+ * withAudio:"enable" | "disable"
91
+ * }}
92
+ */
93
+ export function createScreenShareVideoTrack({ encoderConfig, optimizationMode, withAudio }: {
94
+ encoderConfig: "h360p_30fps" | "h720p_5fps" | "h720p_15fps" | "h1080p_15fps" | "h1080p_30fps" | undefined;
95
+ optimizationMode: "text" | "motion" | "detail" | undefined;
96
+ withAudio: "enable" | "disable";
97
+ }): Promise<MediaStream>;
98
+ export { MeetingProvider, useMeeting, useParticipant, usePubSub, MeetingConsumer, useConnection };
99
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":";;;;;;AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAqC;AAErC;;;;;;;;;;;GAWG;AACH,kGAXW;IACV,QAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,aAAgB,EAAE,YAAY,GAAG,aAAa,GAAG,aAAa,GACtD,aAAa,GAAG,aAAa,GAAG,cAAc,GAAG,eAAe,GAChE,eAAe,GAAG,eAAe,GAAG,aAAa,GAAG,aAAa,GACjE,aAAa,GAAG,aAAa,GAAG,aAAa,GAAG,aAAa,GAC7D,aAAa,GAAG,eAAe,GAAG,eAAe,GAAG,SAAS,CAAC;IACtE,UAAa,EAAE,OAAO,GAAG,aAAa,GAAG,SAAS,CAAC;IACnD,gBAAmB,EAAE,MAAM,GAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAA;CACzD,wBAcH;AAsBD;;;;;;;;;;;;;GAaG;AACH,yFAbW;IACV,WAAc,EAAE;QAChB,gBAAqB,EAAE,OAAO,CAAC;QAC/B,eAAoB,EAAE,OAAO,CAAC;QAC9B,gBAAqB,EAAE,OAAO,CAAA;KAC1B,GAAG,SAAS,CAAC;IACjB,aAAgB,EAAE,oBAAoB,GAC9B,iBAAiB,GAAG,gBAAgB,GACpC,iBAAiB,GAAG,cAAc,GAClC,qBAAqB,GAAG,SAAS,CAAA;IACzC,YAAe,EAAE,MAAM,GAAG,SAAS,CAAA;CAChC,wBAYH;AA5CD;;;;;;;GAOG;AACH,4FAPW;IACV,aAAgB,EAAE,aAAa,GAAG,YAAY,GAAG,aAAa,GACpD,cAAc,GAAG,cAAc,GAAG,SAAS,CAAC;IACtD,gBAAmB,EAAE,MAAM,GAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IAC7D,SAAY,EAAC,QAAQ,GAAG,SAAS,CAAA;CAC9B,wBAYH"}
package/dist/index.js CHANGED
@@ -1,9 +1,13 @@
1
1
  function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
2
2
 
3
+ require('@videosdk.live/js-sdk/connection');
4
+ require('@videosdk.live/js-sdk/meeting');
5
+ require('@videosdk.live/js-sdk/participant');
3
6
  var React = require('react');
4
7
  var React__default = _interopDefault(React);
5
8
  var EventEmitter = _interopDefault(require('events'));
6
9
  var jsSdk = require('@videosdk.live/js-sdk');
10
+ require('@videosdk.live/js-sdk/connectionParticipant');
7
11
 
8
12
  var eventPrifix = 'videosdk-live-react-sdk';
9
13
  var events = {
@@ -1100,6 +1104,10 @@ var useParticipant = function useParticipant(participantId, _temp) {
1100
1104
  screenShareStream = _useState3[0],
1101
1105
  setScreenShareStream = _useState3[1];
1102
1106
 
1107
+ var _useState4 = React.useState(null),
1108
+ screenShareAudioStream = _useState4[0],
1109
+ setScreenShareAudioStream = _useState4[1];
1110
+
1103
1111
  var meeting = useMeeting();
1104
1112
 
1105
1113
  var _useMemo = React.useMemo(function () {
@@ -1129,13 +1137,13 @@ var useParticipant = function useParticipant(participantId, _temp) {
1129
1137
 
1130
1138
  var participant = participants === null || participants === void 0 ? void 0 : participants.get(participantId);
1131
1139
 
1132
- var _useState4 = React.useState(participant === null || participant === void 0 ? void 0 : participant.webcamOn),
1133
- webcamOn = _useState4[0],
1134
- setWebcamOn = _useState4[1];
1140
+ var _useState5 = React.useState(participant === null || participant === void 0 ? void 0 : participant.webcamOn),
1141
+ webcamOn = _useState5[0],
1142
+ setWebcamOn = _useState5[1];
1135
1143
 
1136
- var _useState5 = React.useState(participant === null || participant === void 0 ? void 0 : participant.micOn),
1137
- micOn = _useState5[0],
1138
- setMicOn = _useState5[1];
1144
+ var _useState6 = React.useState(participant === null || participant === void 0 ? void 0 : participant.micOn),
1145
+ micOn = _useState6[0],
1146
+ setMicOn = _useState6[1];
1139
1147
 
1140
1148
  var setTrack = function setTrack(stream) {
1141
1149
  if (stream.track.readyState === 'live') {
@@ -1151,6 +1159,10 @@ var useParticipant = function useParticipant(participantId, _temp) {
1151
1159
  case 'share':
1152
1160
  setScreenShareStream(stream);
1153
1161
  break;
1162
+
1163
+ case 'shareAudio':
1164
+ setScreenShareAudioStream(stream);
1165
+ break;
1154
1166
  }
1155
1167
  }
1156
1168
  };
@@ -1169,6 +1181,10 @@ var useParticipant = function useParticipant(participantId, _temp) {
1169
1181
  case 'share':
1170
1182
  setScreenShareStream(null);
1171
1183
  break;
1184
+
1185
+ case 'shareAudio':
1186
+ setScreenShareAudioStream(null);
1187
+ break;
1172
1188
  }
1173
1189
  }
1174
1190
  };
@@ -1293,6 +1309,7 @@ var useParticipant = function useParticipant(participantId, _temp) {
1293
1309
  webcamStream: webcamStream,
1294
1310
  micStream: micStream,
1295
1311
  screenShareStream: screenShareStream,
1312
+ screenShareAudioStream: screenShareAudioStream,
1296
1313
  webcamOn: webcamOn,
1297
1314
  micOn: micOn,
1298
1315
  screenShareOn: !!screenShareStream,
@@ -1490,12 +1507,15 @@ var createScreenShareVideoTrack = function createScreenShareVideoTrack(_ref2) {
1490
1507
  var _ref2$encoderConfig = _ref2.encoderConfig,
1491
1508
  encoderConfig = _ref2$encoderConfig === void 0 ? undefined : _ref2$encoderConfig,
1492
1509
  _ref2$optimizationMod = _ref2.optimizationMode,
1493
- optimizationMode = _ref2$optimizationMod === void 0 ? undefined : _ref2$optimizationMod;
1510
+ optimizationMode = _ref2$optimizationMod === void 0 ? undefined : _ref2$optimizationMod,
1511
+ _ref2$withAudio = _ref2.withAudio,
1512
+ withAudio = _ref2$withAudio === void 0 ? 'enable' : _ref2$withAudio;
1494
1513
 
1495
1514
  try {
1496
1515
  return Promise.resolve(jsSdk.VideoSDK.createScreenShareVideoTrack({
1497
1516
  encoderConfig: encoderConfig,
1498
- optimizationMode: optimizationMode
1517
+ optimizationMode: optimizationMode,
1518
+ withAudio: withAudio
1499
1519
  }));
1500
1520
  } catch (e) {
1501
1521
  return Promise.reject(e);