@videosdk.live/react-sdk 0.1.41 → 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.
- package/dist/connection/useConnection.d.ts +43 -0
- package/dist/connection/useConnection.d.ts.map +1 -0
- package/dist/index.d.ts +99 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +113 -10
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +113 -10
- package/dist/index.modern.js.map +1 -1
- package/dist/meeting/MeetingProvider.d.ts +44 -0
- package/dist/meeting/MeetingProvider.d.ts.map +1 -0
- package/dist/meeting/meetingProviderContextDef.d.ts +149 -0
- package/dist/meeting/meetingProviderContextDef.d.ts.map +1 -0
- package/dist/participant/useParticipant.d.ts +112 -0
- package/dist/participant/useParticipant.d.ts.map +1 -0
- package/dist/pubSub/usePubSub.d.ts +37 -0
- package/dist/pubSub/usePubSub.d.ts.map +1 -0
- package/dist/utils.d.ts +32 -0
- package/dist/utils.d.ts.map +1 -0
- package/package.json +6 -4
|
@@ -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"}
|
package/dist/index.d.ts
ADDED
|
@@ -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 = {
|
|
@@ -33,7 +37,8 @@ var events = {
|
|
|
33
37
|
'hls-started': eventPrifix + "-hls-started",
|
|
34
38
|
'hls-stopped': eventPrifix + "-hls-stopped",
|
|
35
39
|
'recording-state-changed': eventPrifix + "-recording-state-changed",
|
|
36
|
-
'livestream-state-changed': eventPrifix + "-livestream-state-changed"
|
|
40
|
+
'livestream-state-changed': eventPrifix + "-livestream-state-changed",
|
|
41
|
+
'meeting-state-changed': eventPrifix + "-meeting-state-changed"
|
|
37
42
|
};
|
|
38
43
|
var eventEmitter = new EventEmitter();
|
|
39
44
|
eventEmitter.setMaxListeners(9999);
|
|
@@ -94,7 +99,9 @@ var useMeeting = function useMeeting(_temp) {
|
|
|
94
99
|
_ref$onRecordingState = _ref.onRecordingStateChanged,
|
|
95
100
|
onRecordingStateChanged = _ref$onRecordingState === void 0 ? function () {} : _ref$onRecordingState,
|
|
96
101
|
_ref$onLivestreamStat = _ref.onLivestreamStateChanged,
|
|
97
|
-
onLivestreamStateChanged = _ref$onLivestreamStat === void 0 ? function () {} : _ref$onLivestreamStat
|
|
102
|
+
onLivestreamStateChanged = _ref$onLivestreamStat === void 0 ? function () {} : _ref$onLivestreamStat,
|
|
103
|
+
_ref$onMeetingStateCh = _ref.onMeetingStateChanged,
|
|
104
|
+
onMeetingStateChanged = _ref$onMeetingStateCh === void 0 ? function () {} : _ref$onMeetingStateCh;
|
|
98
105
|
|
|
99
106
|
React.useEffect(function () {
|
|
100
107
|
eventEmitter.on(events['participant-joined'], onParticipantJoined);
|
|
@@ -124,7 +131,9 @@ var useMeeting = function useMeeting(_temp) {
|
|
|
124
131
|
eventEmitter.on(events['hls-stopped'], onHlsStopped);
|
|
125
132
|
eventEmitter.on(events['recording-state-changed'], onRecordingStateChanged);
|
|
126
133
|
eventEmitter.on(events['livestream-state-changed'], onLivestreamStateChanged);
|
|
134
|
+
eventEmitter.on(events['meeting-state-changed'], onMeetingStateChanged);
|
|
127
135
|
return function () {
|
|
136
|
+
eventEmitter.off(events['meeting-state-changed'], onMeetingStateChanged);
|
|
128
137
|
eventEmitter.off(events['participant-joined'], onParticipantJoined);
|
|
129
138
|
eventEmitter.off(events['participant-left'], onParticipantLeft);
|
|
130
139
|
eventEmitter.off(events['speaker-changed'], onSpeakerChanged);
|
|
@@ -211,8 +220,11 @@ var MeetingConsumer = function MeetingConsumer(_ref2) {
|
|
|
211
220
|
_ref2$onRecordingStat = _ref2.onRecordingStateChanged,
|
|
212
221
|
onRecordingStateChanged = _ref2$onRecordingStat === void 0 ? function () {} : _ref2$onRecordingStat,
|
|
213
222
|
_ref2$onLivestreamSta = _ref2.onLivestreamStateChanged,
|
|
214
|
-
onLivestreamStateChanged = _ref2$onLivestreamSta === void 0 ? function () {} : _ref2$onLivestreamSta
|
|
223
|
+
onLivestreamStateChanged = _ref2$onLivestreamSta === void 0 ? function () {} : _ref2$onLivestreamSta,
|
|
224
|
+
_ref2$onMeetingStateC = _ref2.onMeetingStateChanged,
|
|
225
|
+
onMeetingStateChanged = _ref2$onMeetingStateC === void 0 ? function () {} : _ref2$onMeetingStateC;
|
|
215
226
|
React.useEffect(function () {
|
|
227
|
+
eventEmitter.on(events['meeting-state-changed'], onMeetingStateChanged);
|
|
216
228
|
eventEmitter.on(events['participant-joined'], onParticipantJoined);
|
|
217
229
|
eventEmitter.on(events['participant-left'], onParticipantLeft);
|
|
218
230
|
eventEmitter.on(events['speaker-changed'], onSpeakerChanged);
|
|
@@ -241,6 +253,7 @@ var MeetingConsumer = function MeetingConsumer(_ref2) {
|
|
|
241
253
|
eventEmitter.on(events['recording-state-changed'], onRecordingStateChanged);
|
|
242
254
|
eventEmitter.on(events['livestream-state-changed'], onLivestreamStateChanged);
|
|
243
255
|
return function () {
|
|
256
|
+
eventEmitter.off(events['meeting-state-changed'], onMeetingStateChanged);
|
|
244
257
|
eventEmitter.off(events['participant-joined'], onParticipantJoined);
|
|
245
258
|
eventEmitter.off(events['participant-left'], onParticipantLeft);
|
|
246
259
|
eventEmitter.off(events['speaker-changed'], onSpeakerChanged);
|
|
@@ -273,7 +286,7 @@ var MeetingConsumer = function MeetingConsumer(_ref2) {
|
|
|
273
286
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(MeetingProviderContex.Consumer, null, children));
|
|
274
287
|
};
|
|
275
288
|
|
|
276
|
-
var version = "0.1.
|
|
289
|
+
var version = "0.1.43";
|
|
277
290
|
|
|
278
291
|
var MeetingProvider = function MeetingProvider(_ref) {
|
|
279
292
|
var children = _ref.children,
|
|
@@ -547,6 +560,7 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
547
560
|
var _meeting$localPartici;
|
|
548
561
|
|
|
549
562
|
if (typeof (meeting === null || meeting === void 0 ? void 0 : meeting.off) === 'function') {
|
|
563
|
+
meeting.off('meeting-state-changed', _handle_meeting_state_changed);
|
|
550
564
|
meeting.off('participant-joined', _handle_participant_joined);
|
|
551
565
|
meeting.off('participant-left', _handle_participant_left);
|
|
552
566
|
meeting.off('presenter-changed', _handle_presenter_changed);
|
|
@@ -642,6 +656,10 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
642
656
|
eventEmitter.emit(events['livestream-state-changed'], data);
|
|
643
657
|
};
|
|
644
658
|
|
|
659
|
+
var _handle_meeting_state_changed = function _handle_meeting_state_changed(data) {
|
|
660
|
+
eventEmitter.emit(events['meeting-state-changed'], data);
|
|
661
|
+
};
|
|
662
|
+
|
|
645
663
|
var join = function join() {
|
|
646
664
|
var meeting = jsSdk.VideoSDK && jsSdk.VideoSDK.initMeeting(configRef.current);
|
|
647
665
|
setMeeting(meeting);
|
|
@@ -650,6 +668,7 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
650
668
|
participants.set(localParticipant.id, localParticipant);
|
|
651
669
|
setParticipants(participants);
|
|
652
670
|
setLocalParticipant(localParticipant);
|
|
671
|
+
meeting.on('meeting-state-changed', _handle_meeting_state_changed);
|
|
653
672
|
meeting.on('participant-joined', _handle_participant_joined);
|
|
654
673
|
meeting.on('participant-left', _handle_participant_left);
|
|
655
674
|
meeting.on('presenter-changed', _handle_presenter_changed);
|
|
@@ -1069,7 +1088,9 @@ var useParticipant = function useParticipant(participantId, _temp) {
|
|
|
1069
1088
|
_ref$onStreamEnabled = _ref.onStreamEnabled,
|
|
1070
1089
|
onStreamEnabled = _ref$onStreamEnabled === void 0 ? function () {} : _ref$onStreamEnabled,
|
|
1071
1090
|
_ref$onStreamDisabled = _ref.onStreamDisabled,
|
|
1072
|
-
onStreamDisabled = _ref$onStreamDisabled === void 0 ? function () {} : _ref$onStreamDisabled
|
|
1091
|
+
onStreamDisabled = _ref$onStreamDisabled === void 0 ? function () {} : _ref$onStreamDisabled,
|
|
1092
|
+
_ref$onMediaStatusCha = _ref.onMediaStatusChanged,
|
|
1093
|
+
onMediaStatusChanged = _ref$onMediaStatusCha === void 0 ? function () {} : _ref$onMediaStatusCha;
|
|
1073
1094
|
|
|
1074
1095
|
var _useState = React.useState(null),
|
|
1075
1096
|
webcamStream = _useState[0],
|
|
@@ -1083,6 +1104,10 @@ var useParticipant = function useParticipant(participantId, _temp) {
|
|
|
1083
1104
|
screenShareStream = _useState3[0],
|
|
1084
1105
|
setScreenShareStream = _useState3[1];
|
|
1085
1106
|
|
|
1107
|
+
var _useState4 = React.useState(null),
|
|
1108
|
+
screenShareAudioStream = _useState4[0],
|
|
1109
|
+
setScreenShareAudioStream = _useState4[1];
|
|
1110
|
+
|
|
1086
1111
|
var meeting = useMeeting();
|
|
1087
1112
|
|
|
1088
1113
|
var _useMemo = React.useMemo(function () {
|
|
@@ -1112,6 +1137,14 @@ var useParticipant = function useParticipant(participantId, _temp) {
|
|
|
1112
1137
|
|
|
1113
1138
|
var participant = participants === null || participants === void 0 ? void 0 : participants.get(participantId);
|
|
1114
1139
|
|
|
1140
|
+
var _useState5 = React.useState(participant === null || participant === void 0 ? void 0 : participant.webcamOn),
|
|
1141
|
+
webcamOn = _useState5[0],
|
|
1142
|
+
setWebcamOn = _useState5[1];
|
|
1143
|
+
|
|
1144
|
+
var _useState6 = React.useState(participant === null || participant === void 0 ? void 0 : participant.micOn),
|
|
1145
|
+
micOn = _useState6[0],
|
|
1146
|
+
setMicOn = _useState6[1];
|
|
1147
|
+
|
|
1115
1148
|
var setTrack = function setTrack(stream) {
|
|
1116
1149
|
if (stream.track.readyState === 'live') {
|
|
1117
1150
|
switch (stream.kind) {
|
|
@@ -1126,6 +1159,10 @@ var useParticipant = function useParticipant(participantId, _temp) {
|
|
|
1126
1159
|
case 'share':
|
|
1127
1160
|
setScreenShareStream(stream);
|
|
1128
1161
|
break;
|
|
1162
|
+
|
|
1163
|
+
case 'shareAudio':
|
|
1164
|
+
setScreenShareAudioStream(stream);
|
|
1165
|
+
break;
|
|
1129
1166
|
}
|
|
1130
1167
|
}
|
|
1131
1168
|
};
|
|
@@ -1144,6 +1181,10 @@ var useParticipant = function useParticipant(participantId, _temp) {
|
|
|
1144
1181
|
case 'share':
|
|
1145
1182
|
setScreenShareStream(null);
|
|
1146
1183
|
break;
|
|
1184
|
+
|
|
1185
|
+
case 'shareAudio':
|
|
1186
|
+
setScreenShareAudioStream(null);
|
|
1187
|
+
break;
|
|
1147
1188
|
}
|
|
1148
1189
|
}
|
|
1149
1190
|
};
|
|
@@ -1158,6 +1199,24 @@ var useParticipant = function useParticipant(participantId, _temp) {
|
|
|
1158
1199
|
onStreamDisabled(stream);
|
|
1159
1200
|
};
|
|
1160
1201
|
|
|
1202
|
+
var _handleMediaStatusChanged = function _handleMediaStatusChanged(data) {
|
|
1203
|
+
var kind = data.kind,
|
|
1204
|
+
peerId = data.peerId,
|
|
1205
|
+
newStatus = data.newStatus;
|
|
1206
|
+
|
|
1207
|
+
if (kind == 'audio') {
|
|
1208
|
+
setMicOn(newStatus);
|
|
1209
|
+
} else if (kind == 'video') {
|
|
1210
|
+
setWebcamOn(newStatus);
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
onMediaStatusChanged({
|
|
1214
|
+
kind: kind,
|
|
1215
|
+
peerId: peerId,
|
|
1216
|
+
newStatus: newStatus
|
|
1217
|
+
});
|
|
1218
|
+
};
|
|
1219
|
+
|
|
1161
1220
|
var setQuality = function setQuality(quality) {
|
|
1162
1221
|
participant === null || participant === void 0 ? void 0 : participant.setQuality(quality);
|
|
1163
1222
|
};
|
|
@@ -1190,6 +1249,30 @@ var useParticipant = function useParticipant(participantId, _temp) {
|
|
|
1190
1249
|
participant === null || participant === void 0 ? void 0 : participant.unpin(data);
|
|
1191
1250
|
};
|
|
1192
1251
|
|
|
1252
|
+
var getAudioStats = function getAudioStats() {
|
|
1253
|
+
return Promise.resolve(participant === null || participant === void 0 ? void 0 : participant.getAudioStats());
|
|
1254
|
+
};
|
|
1255
|
+
|
|
1256
|
+
var getVideoStats = function getVideoStats() {
|
|
1257
|
+
return Promise.resolve(participant === null || participant === void 0 ? void 0 : participant.getVideoStats());
|
|
1258
|
+
};
|
|
1259
|
+
|
|
1260
|
+
var consumeWebcamStreams = function consumeWebcamStreams() {
|
|
1261
|
+
participant === null || participant === void 0 ? void 0 : participant.consumeWebcamStreams();
|
|
1262
|
+
};
|
|
1263
|
+
|
|
1264
|
+
var consumeMicStreams = function consumeMicStreams() {
|
|
1265
|
+
participant === null || participant === void 0 ? void 0 : participant.consumeMicStreams();
|
|
1266
|
+
};
|
|
1267
|
+
|
|
1268
|
+
var stopConsumingWebcamStreams = function stopConsumingWebcamStreams() {
|
|
1269
|
+
participant === null || participant === void 0 ? void 0 : participant.stopConsumingWebcamStreams();
|
|
1270
|
+
};
|
|
1271
|
+
|
|
1272
|
+
var stopConsumingMicStreams = function stopConsumingMicStreams() {
|
|
1273
|
+
participant === null || participant === void 0 ? void 0 : participant.stopConsumingMicStreams();
|
|
1274
|
+
};
|
|
1275
|
+
|
|
1193
1276
|
var switchTo = function switchTo(data) {
|
|
1194
1277
|
return Promise.resolve(participant === null || participant === void 0 ? void 0 : participant.switchTo(data)).then(function () {});
|
|
1195
1278
|
};
|
|
@@ -1203,11 +1286,21 @@ var useParticipant = function useParticipant(participantId, _temp) {
|
|
|
1203
1286
|
});
|
|
1204
1287
|
}
|
|
1205
1288
|
|
|
1289
|
+
if (participant !== null && participant !== void 0 && participant.micOn) {
|
|
1290
|
+
setMicOn(micOn);
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
if (participant !== null && participant !== void 0 && participant.webcamOn) {
|
|
1294
|
+
setWebcamOn(webcamOn);
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1206
1297
|
participant === null || participant === void 0 ? void 0 : participant.on('stream-enabled', _handleStreamEnabled);
|
|
1207
1298
|
participant === null || participant === void 0 ? void 0 : participant.on('stream-disabled', _handleStreamDisabled);
|
|
1299
|
+
participant === null || participant === void 0 ? void 0 : participant.on('media-status-changed', _handleMediaStatusChanged);
|
|
1208
1300
|
return function () {
|
|
1209
1301
|
participant === null || participant === void 0 ? void 0 : participant.off('stream-enabled', _handleStreamEnabled);
|
|
1210
1302
|
participant === null || participant === void 0 ? void 0 : participant.off('stream-disabled', _handleStreamDisabled);
|
|
1303
|
+
participant === null || participant === void 0 ? void 0 : participant.off('media-status-changed', _handleMediaStatusChanged);
|
|
1211
1304
|
};
|
|
1212
1305
|
}, [participant]);
|
|
1213
1306
|
return {
|
|
@@ -1216,13 +1309,18 @@ var useParticipant = function useParticipant(participantId, _temp) {
|
|
|
1216
1309
|
webcamStream: webcamStream,
|
|
1217
1310
|
micStream: micStream,
|
|
1218
1311
|
screenShareStream: screenShareStream,
|
|
1219
|
-
|
|
1220
|
-
|
|
1312
|
+
screenShareAudioStream: screenShareAudioStream,
|
|
1313
|
+
webcamOn: webcamOn,
|
|
1314
|
+
micOn: micOn,
|
|
1221
1315
|
screenShareOn: !!screenShareStream,
|
|
1222
1316
|
isLocal: (localParticipant === null || localParticipant === void 0 ? void 0 : localParticipant.id) === participantId,
|
|
1223
1317
|
isActiveSpeaker: activeSpeakerId === participantId,
|
|
1224
1318
|
isMainParticipant: (mainParticipant === null || mainParticipant === void 0 ? void 0 : mainParticipant.id) === participantId,
|
|
1225
1319
|
pinState: pinState,
|
|
1320
|
+
consumeMicStreams: consumeMicStreams,
|
|
1321
|
+
consumeWebcamStreams: consumeWebcamStreams,
|
|
1322
|
+
stopConsumingMicStreams: stopConsumingMicStreams,
|
|
1323
|
+
stopConsumingWebcamStreams: stopConsumingWebcamStreams,
|
|
1226
1324
|
setQuality: setQuality,
|
|
1227
1325
|
setViewPort: setViewPort,
|
|
1228
1326
|
enableMic: enableMic,
|
|
@@ -1231,7 +1329,9 @@ var useParticipant = function useParticipant(participantId, _temp) {
|
|
|
1231
1329
|
disableWebcam: disableWebcam,
|
|
1232
1330
|
pin: pin,
|
|
1233
1331
|
unpin: unpin,
|
|
1234
|
-
switchTo: switchTo
|
|
1332
|
+
switchTo: switchTo,
|
|
1333
|
+
getAudioStats: getAudioStats,
|
|
1334
|
+
getVideoStats: getVideoStats
|
|
1235
1335
|
};
|
|
1236
1336
|
};
|
|
1237
1337
|
|
|
@@ -1407,12 +1507,15 @@ var createScreenShareVideoTrack = function createScreenShareVideoTrack(_ref2) {
|
|
|
1407
1507
|
var _ref2$encoderConfig = _ref2.encoderConfig,
|
|
1408
1508
|
encoderConfig = _ref2$encoderConfig === void 0 ? undefined : _ref2$encoderConfig,
|
|
1409
1509
|
_ref2$optimizationMod = _ref2.optimizationMode,
|
|
1410
|
-
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;
|
|
1411
1513
|
|
|
1412
1514
|
try {
|
|
1413
1515
|
return Promise.resolve(jsSdk.VideoSDK.createScreenShareVideoTrack({
|
|
1414
1516
|
encoderConfig: encoderConfig,
|
|
1415
|
-
optimizationMode: optimizationMode
|
|
1517
|
+
optimizationMode: optimizationMode,
|
|
1518
|
+
withAudio: withAudio
|
|
1416
1519
|
}));
|
|
1417
1520
|
} catch (e) {
|
|
1418
1521
|
return Promise.reject(e);
|