@videosdk.live/react-sdk 0.1.43 → 0.1.46

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,42 @@
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
+ //# sourceMappingURL=useConnection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useConnection.d.ts","sourceRoot":"","sources":["../../src/connection/useConnection.js"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,6CAnBW,MAAM;;;;;;;;YAQP,MAAM;;iBAED,MAAM;iBACN;YACd,EAAS,EAAE,MAAM,CAAC;YAClB,eAAsB,WAAW;YACjC,GAAU,WAAW;YACrB,YAAmB,EAAE,4BAA4B,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
@@ -282,7 +282,7 @@ var MeetingConsumer = function MeetingConsumer(_ref2) {
282
282
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(MeetingProviderContex.Consumer, null, children));
283
283
  };
284
284
 
285
- var version = "0.1.43";
285
+ var version = "0.1.46";
286
286
 
287
287
  var MeetingProvider = function MeetingProvider(_ref) {
288
288
  var children = _ref.children,
@@ -1100,6 +1100,10 @@ var useParticipant = function useParticipant(participantId, _temp) {
1100
1100
  screenShareStream = _useState3[0],
1101
1101
  setScreenShareStream = _useState3[1];
1102
1102
 
1103
+ var _useState4 = React.useState(null),
1104
+ screenShareAudioStream = _useState4[0],
1105
+ setScreenShareAudioStream = _useState4[1];
1106
+
1103
1107
  var meeting = useMeeting();
1104
1108
 
1105
1109
  var _useMemo = React.useMemo(function () {
@@ -1129,13 +1133,13 @@ var useParticipant = function useParticipant(participantId, _temp) {
1129
1133
 
1130
1134
  var participant = participants === null || participants === void 0 ? void 0 : participants.get(participantId);
1131
1135
 
1132
- var _useState4 = React.useState(participant === null || participant === void 0 ? void 0 : participant.webcamOn),
1133
- webcamOn = _useState4[0],
1134
- setWebcamOn = _useState4[1];
1136
+ var _useState5 = React.useState(participant === null || participant === void 0 ? void 0 : participant.webcamOn),
1137
+ webcamOn = _useState5[0],
1138
+ setWebcamOn = _useState5[1];
1135
1139
 
1136
- var _useState5 = React.useState(participant === null || participant === void 0 ? void 0 : participant.micOn),
1137
- micOn = _useState5[0],
1138
- setMicOn = _useState5[1];
1140
+ var _useState6 = React.useState(participant === null || participant === void 0 ? void 0 : participant.micOn),
1141
+ micOn = _useState6[0],
1142
+ setMicOn = _useState6[1];
1139
1143
 
1140
1144
  var setTrack = function setTrack(stream) {
1141
1145
  if (stream.track.readyState === 'live') {
@@ -1151,6 +1155,10 @@ var useParticipant = function useParticipant(participantId, _temp) {
1151
1155
  case 'share':
1152
1156
  setScreenShareStream(stream);
1153
1157
  break;
1158
+
1159
+ case 'shareAudio':
1160
+ setScreenShareAudioStream(stream);
1161
+ break;
1154
1162
  }
1155
1163
  }
1156
1164
  };
@@ -1169,6 +1177,10 @@ var useParticipant = function useParticipant(participantId, _temp) {
1169
1177
  case 'share':
1170
1178
  setScreenShareStream(null);
1171
1179
  break;
1180
+
1181
+ case 'shareAudio':
1182
+ setScreenShareAudioStream(null);
1183
+ break;
1172
1184
  }
1173
1185
  }
1174
1186
  };
@@ -1293,6 +1305,7 @@ var useParticipant = function useParticipant(participantId, _temp) {
1293
1305
  webcamStream: webcamStream,
1294
1306
  micStream: micStream,
1295
1307
  screenShareStream: screenShareStream,
1308
+ screenShareAudioStream: screenShareAudioStream,
1296
1309
  webcamOn: webcamOn,
1297
1310
  micOn: micOn,
1298
1311
  screenShareOn: !!screenShareStream,
@@ -1490,12 +1503,15 @@ var createScreenShareVideoTrack = function createScreenShareVideoTrack(_ref2) {
1490
1503
  var _ref2$encoderConfig = _ref2.encoderConfig,
1491
1504
  encoderConfig = _ref2$encoderConfig === void 0 ? undefined : _ref2$encoderConfig,
1492
1505
  _ref2$optimizationMod = _ref2.optimizationMode,
1493
- optimizationMode = _ref2$optimizationMod === void 0 ? undefined : _ref2$optimizationMod;
1506
+ optimizationMode = _ref2$optimizationMod === void 0 ? undefined : _ref2$optimizationMod,
1507
+ _ref2$withAudio = _ref2.withAudio,
1508
+ withAudio = _ref2$withAudio === void 0 ? 'enable' : _ref2$withAudio;
1494
1509
 
1495
1510
  try {
1496
1511
  return Promise.resolve(jsSdk.VideoSDK.createScreenShareVideoTrack({
1497
1512
  encoderConfig: encoderConfig,
1498
- optimizationMode: optimizationMode
1513
+ optimizationMode: optimizationMode,
1514
+ withAudio: withAudio
1499
1515
  }));
1500
1516
  } catch (e) {
1501
1517
  return Promise.reject(e);