@videosdk.live/react-sdk 0.2.1 → 0.2.3
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/index.js +291 -18
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +290 -20
- package/dist/index.modern.js.map +1 -1
- package/dist/types/index.d.ts +164 -1
- package/dist/types/meeting.d.ts +24 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -5,6 +5,54 @@ var React__default = _interopDefault(React);
|
|
|
5
5
|
var EventEmitter = _interopDefault(require('events'));
|
|
6
6
|
var jsSdk = require('@videosdk.live/js-sdk');
|
|
7
7
|
|
|
8
|
+
function _arrayLikeToArray(r, a) {
|
|
9
|
+
(null == a || a > r.length) && (a = r.length);
|
|
10
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
11
|
+
return n;
|
|
12
|
+
}
|
|
13
|
+
function _createForOfIteratorHelperLoose(r, e) {
|
|
14
|
+
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
15
|
+
if (t) return (t = t.call(r)).next.bind(t);
|
|
16
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
|
|
17
|
+
t && (r = t);
|
|
18
|
+
var o = 0;
|
|
19
|
+
return function () {
|
|
20
|
+
return o >= r.length ? {
|
|
21
|
+
done: !0
|
|
22
|
+
} : {
|
|
23
|
+
done: !1,
|
|
24
|
+
value: r[o++]
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
29
|
+
}
|
|
30
|
+
function _extends() {
|
|
31
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
32
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
33
|
+
var t = arguments[e];
|
|
34
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
35
|
+
}
|
|
36
|
+
return n;
|
|
37
|
+
}, _extends.apply(null, arguments);
|
|
38
|
+
}
|
|
39
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
40
|
+
if (null == r) return {};
|
|
41
|
+
var t = {};
|
|
42
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
43
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
44
|
+
t[n] = r[n];
|
|
45
|
+
}
|
|
46
|
+
return t;
|
|
47
|
+
}
|
|
48
|
+
function _unsupportedIterableToArray(r, a) {
|
|
49
|
+
if (r) {
|
|
50
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
51
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
52
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
8
56
|
var eventPrifix = 'videosdk-live-react-sdk';
|
|
9
57
|
var events = {
|
|
10
58
|
'participant-joined': eventPrifix + "-participant-joined",
|
|
@@ -47,6 +95,19 @@ var events = {
|
|
|
47
95
|
};
|
|
48
96
|
var eventEmitter = new EventEmitter();
|
|
49
97
|
eventEmitter.setMaxListeners(9999);
|
|
98
|
+
function debounce(func, delay) {
|
|
99
|
+
var timeout;
|
|
100
|
+
return function () {
|
|
101
|
+
var _this = this;
|
|
102
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
103
|
+
args[_key] = arguments[_key];
|
|
104
|
+
}
|
|
105
|
+
clearTimeout(timeout);
|
|
106
|
+
timeout = setTimeout(function () {
|
|
107
|
+
return func.apply(_this, args);
|
|
108
|
+
}, delay);
|
|
109
|
+
};
|
|
110
|
+
}
|
|
50
111
|
|
|
51
112
|
var MeetingProviderContex = React.createContext();
|
|
52
113
|
var useMeeting = function useMeeting(_temp) {
|
|
@@ -322,7 +383,7 @@ var MeetingConsumer = function MeetingConsumer(_ref2) {
|
|
|
322
383
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(MeetingProviderContex.Consumer, null, children));
|
|
323
384
|
};
|
|
324
385
|
|
|
325
|
-
var version = "0.2.
|
|
386
|
+
var version = "0.2.2";
|
|
326
387
|
|
|
327
388
|
var MeetingProvider = function MeetingProvider(_ref) {
|
|
328
389
|
var children = _ref.children,
|
|
@@ -560,12 +621,19 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
560
621
|
eventEmitter.emit(events['mic-requested'], data);
|
|
561
622
|
};
|
|
562
623
|
var _handle_meeting_joined = function _handle_meeting_joined(data) {
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
624
|
+
if (data.switchRoomId) {
|
|
625
|
+
setMessages(function (s) {
|
|
626
|
+
return [].concat(s, data.messages);
|
|
627
|
+
});
|
|
628
|
+
eventEmitter.emit(events['meeting-joined'], data);
|
|
629
|
+
} else {
|
|
630
|
+
joinedOnFirstRender.current = true;
|
|
631
|
+
setMessages(function (s) {
|
|
632
|
+
return [].concat(s, data.messages);
|
|
633
|
+
});
|
|
634
|
+
eventEmitter.emit(events['meeting-joined'], data);
|
|
635
|
+
setIsMeetingJoined(true);
|
|
636
|
+
}
|
|
569
637
|
};
|
|
570
638
|
var _handle_meeting_left2 = function _handle_meeting_left() {
|
|
571
639
|
eventEmitter.emit(events['meeting-left']);
|
|
@@ -860,6 +928,17 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
860
928
|
enableWebcam(customVideoTrack);
|
|
861
929
|
}
|
|
862
930
|
};
|
|
931
|
+
var switchTo = function switchTo(_ref3) {
|
|
932
|
+
var meetingId = _ref3.meetingId,
|
|
933
|
+
token = _ref3.token;
|
|
934
|
+
var meeting = meetingRef.current;
|
|
935
|
+
if (meeting) {
|
|
936
|
+
meeting.switchTo({
|
|
937
|
+
meetingId: meetingId,
|
|
938
|
+
token: token
|
|
939
|
+
});
|
|
940
|
+
}
|
|
941
|
+
};
|
|
863
942
|
var disableScreenShare = function disableScreenShare() {
|
|
864
943
|
var meeting = meetingRef.current;
|
|
865
944
|
if (meeting) {
|
|
@@ -946,8 +1025,8 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
946
1025
|
meeting.changeMic(obj);
|
|
947
1026
|
}
|
|
948
1027
|
};
|
|
949
|
-
var startVideo = function startVideo(
|
|
950
|
-
var link =
|
|
1028
|
+
var startVideo = function startVideo(_ref4) {
|
|
1029
|
+
var link = _ref4.link;
|
|
951
1030
|
var meeting = meetingRef.current;
|
|
952
1031
|
if (meeting) {
|
|
953
1032
|
meeting.startVideo({
|
|
@@ -967,8 +1046,8 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
967
1046
|
meeting.resumeVideo();
|
|
968
1047
|
}
|
|
969
1048
|
};
|
|
970
|
-
var pauseVideo = function pauseVideo(
|
|
971
|
-
var currentTime =
|
|
1049
|
+
var pauseVideo = function pauseVideo(_ref5) {
|
|
1050
|
+
var currentTime = _ref5.currentTime;
|
|
972
1051
|
var meeting = meetingRef.current;
|
|
973
1052
|
if (meeting) {
|
|
974
1053
|
meeting.pauseVideo({
|
|
@@ -976,8 +1055,20 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
976
1055
|
});
|
|
977
1056
|
}
|
|
978
1057
|
};
|
|
979
|
-
var
|
|
980
|
-
var
|
|
1058
|
+
var enableAdaptiveSubscription = function enableAdaptiveSubscription() {
|
|
1059
|
+
var meeting = meetingRef.current;
|
|
1060
|
+
if (meeting) {
|
|
1061
|
+
meeting.enableAdaptiveSubscription();
|
|
1062
|
+
}
|
|
1063
|
+
};
|
|
1064
|
+
var disableAdaptiveSubscription = function disableAdaptiveSubscription() {
|
|
1065
|
+
var meeting = meetingRef.current;
|
|
1066
|
+
if (meeting) {
|
|
1067
|
+
meeting.disableAdaptiveSubscription();
|
|
1068
|
+
}
|
|
1069
|
+
};
|
|
1070
|
+
var seekVideo = function seekVideo(_ref6) {
|
|
1071
|
+
var currentTime = _ref6.currentTime;
|
|
981
1072
|
var meeting = meetingRef.current;
|
|
982
1073
|
if (meeting) {
|
|
983
1074
|
meeting.seekVideo({
|
|
@@ -997,9 +1088,9 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
997
1088
|
meeting.stopLivestream();
|
|
998
1089
|
}
|
|
999
1090
|
};
|
|
1000
|
-
var connectTo = function connectTo(
|
|
1001
|
-
var meetingId =
|
|
1002
|
-
payload =
|
|
1091
|
+
var connectTo = function connectTo(_ref7) {
|
|
1092
|
+
var meetingId = _ref7.meetingId,
|
|
1093
|
+
payload = _ref7.payload;
|
|
1003
1094
|
try {
|
|
1004
1095
|
var _meeting3 = meetingRef.current;
|
|
1005
1096
|
var _temp = function () {
|
|
@@ -1095,6 +1186,7 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
1095
1186
|
disableScreenShare: disableScreenShare,
|
|
1096
1187
|
enableScreenShare: enableScreenShare,
|
|
1097
1188
|
toggleScreenShare: toggleScreenShare,
|
|
1189
|
+
switchTo: switchTo,
|
|
1098
1190
|
getMics: getMics,
|
|
1099
1191
|
getWebcams: getWebcams,
|
|
1100
1192
|
changeWebcam: changeWebcam,
|
|
@@ -1110,7 +1202,9 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
1110
1202
|
stopLivestream: stopLivestream,
|
|
1111
1203
|
connectTo: connectTo,
|
|
1112
1204
|
startHls: startHls,
|
|
1113
|
-
stopHls: stopHls
|
|
1205
|
+
stopHls: stopHls,
|
|
1206
|
+
enableAdaptiveSubscription: enableAdaptiveSubscription,
|
|
1207
|
+
disableAdaptiveSubscription: disableAdaptiveSubscription
|
|
1114
1208
|
}
|
|
1115
1209
|
}, children);
|
|
1116
1210
|
};
|
|
@@ -1124,7 +1218,11 @@ var useParticipant = function useParticipant(participantId, _temp) {
|
|
|
1124
1218
|
_ref$onMediaStatusCha = _ref.onMediaStatusChanged,
|
|
1125
1219
|
onMediaStatusChanged = _ref$onMediaStatusCha === void 0 ? function () {} : _ref$onMediaStatusCha,
|
|
1126
1220
|
_ref$onVideoQualityCh = _ref.onVideoQualityChanged,
|
|
1127
|
-
onVideoQualityChanged = _ref$onVideoQualityCh === void 0 ? function () {} : _ref$onVideoQualityCh
|
|
1221
|
+
onVideoQualityChanged = _ref$onVideoQualityCh === void 0 ? function () {} : _ref$onVideoQualityCh,
|
|
1222
|
+
_ref$onStreamPaused = _ref.onStreamPaused,
|
|
1223
|
+
onStreamPaused = _ref$onStreamPaused === void 0 ? function () {} : _ref$onStreamPaused,
|
|
1224
|
+
_ref$onStreamResumed = _ref.onStreamResumed,
|
|
1225
|
+
onStreamResumed = _ref$onStreamResumed === void 0 ? function () {} : _ref$onStreamResumed;
|
|
1128
1226
|
var _useState = React.useState(null),
|
|
1129
1227
|
webcamStream = _useState[0],
|
|
1130
1228
|
setwebcamStream = _useState[1];
|
|
@@ -1333,6 +1431,12 @@ var useParticipant = function useParticipant(participantId, _temp) {
|
|
|
1333
1431
|
}
|
|
1334
1432
|
participant === null || participant === void 0 ? void 0 : participant.on('stream-enabled', _handleStreamEnabled);
|
|
1335
1433
|
participant === null || participant === void 0 ? void 0 : participant.on('stream-disabled', _handleStreamDisabled);
|
|
1434
|
+
participant === null || participant === void 0 ? void 0 : participant.on('stream-paused', function (data) {
|
|
1435
|
+
onStreamPaused(data);
|
|
1436
|
+
});
|
|
1437
|
+
participant === null || participant === void 0 ? void 0 : participant.on('stream-resumed', function (data) {
|
|
1438
|
+
onStreamResumed(data);
|
|
1439
|
+
});
|
|
1336
1440
|
participant === null || participant === void 0 ? void 0 : participant.on('media-status-changed', _handleMediaStatusChanged);
|
|
1337
1441
|
participant === null || participant === void 0 ? void 0 : participant.on('video-quality-changed', _handleVideoQualityChanged);
|
|
1338
1442
|
eventEmitter.on(events['participant-mode-changed'], _handleParticipantModeChanged);
|
|
@@ -1957,6 +2061,7 @@ var useWhiteboard = function useWhiteboard() {
|
|
|
1957
2061
|
};
|
|
1958
2062
|
};
|
|
1959
2063
|
|
|
2064
|
+
var _excluded = ["participantId", "type"];
|
|
1960
2065
|
var Constants = jsSdk.VideoSDK.Constants;
|
|
1961
2066
|
var createCameraVideoTrack = function createCameraVideoTrack(_ref) {
|
|
1962
2067
|
var _ref$cameraId = _ref.cameraId,
|
|
@@ -2028,6 +2133,171 @@ var getNetworkStats = function getNetworkStats(_temp) {
|
|
|
2028
2133
|
return Promise.reject(e);
|
|
2029
2134
|
}
|
|
2030
2135
|
};
|
|
2136
|
+
var withAdaptiveObservers = function withAdaptiveObservers(VideoPlayerComponent) {
|
|
2137
|
+
var intersectionObserverOptions = {
|
|
2138
|
+
root: null,
|
|
2139
|
+
rootMargin: '0px',
|
|
2140
|
+
threshold: 0
|
|
2141
|
+
};
|
|
2142
|
+
var debounceDelay = 400;
|
|
2143
|
+
return function (props) {
|
|
2144
|
+
var participantId = props.participantId,
|
|
2145
|
+
type = props.type;
|
|
2146
|
+
var ref = React.useRef(null);
|
|
2147
|
+
var observerRef = React.useRef(null);
|
|
2148
|
+
var resizeObserverRef = React.useRef(null);
|
|
2149
|
+
var _useParticipant = useParticipant(participantId),
|
|
2150
|
+
participant = _useParticipant.participant;
|
|
2151
|
+
React.useEffect(function () {
|
|
2152
|
+
if (type === 'share' || !ref.current || !participant) return;
|
|
2153
|
+
var element = ref.current;
|
|
2154
|
+
if (!element || !participant) return;
|
|
2155
|
+
if (observerRef.current) observerRef.current.disconnect();
|
|
2156
|
+
var handleIntersectionChange = debounce(function (entries) {
|
|
2157
|
+
for (var _iterator = _createForOfIteratorHelperLoose(entries), _step; !(_step = _iterator()).done;) {
|
|
2158
|
+
var entry = _step.value;
|
|
2159
|
+
if (entry.intersectionRatio > 0) {
|
|
2160
|
+
for (var _iterator2 = _createForOfIteratorHelperLoose(participant.streams.values()), _step2; !(_step2 = _iterator2()).done;) {
|
|
2161
|
+
var stream = _step2.value;
|
|
2162
|
+
if (stream.kind === 'video' && stream.pausedBy !== 'SUB_MANAGER') {
|
|
2163
|
+
stream.resume();
|
|
2164
|
+
}
|
|
2165
|
+
}
|
|
2166
|
+
} else {
|
|
2167
|
+
for (var _iterator3 = _createForOfIteratorHelperLoose(participant.streams.values()), _step3; !(_step3 = _iterator3()).done;) {
|
|
2168
|
+
var _stream = _step3.value;
|
|
2169
|
+
if (_stream.kind === 'video') {
|
|
2170
|
+
_stream.pause();
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
}, debounceDelay);
|
|
2176
|
+
observerRef.current = new IntersectionObserver(handleIntersectionChange, intersectionObserverOptions);
|
|
2177
|
+
var processResize = function processResize(width, height) {
|
|
2178
|
+
if (width > 0 && height > 0) {
|
|
2179
|
+
participant.setViewPort(width, height);
|
|
2180
|
+
}
|
|
2181
|
+
};
|
|
2182
|
+
var handleResize = debounce(function (entries) {
|
|
2183
|
+
var _entries$0$contentRec = entries[0].contentRect,
|
|
2184
|
+
width = _entries$0$contentRec.width,
|
|
2185
|
+
height = _entries$0$contentRec.height;
|
|
2186
|
+
processResize(width, height);
|
|
2187
|
+
}, debounceDelay);
|
|
2188
|
+
resizeObserverRef.current = new ResizeObserver(handleResize);
|
|
2189
|
+
resizeObserverRef.current.observe(element);
|
|
2190
|
+
observerRef.current.observe(element);
|
|
2191
|
+
return function () {
|
|
2192
|
+
if (observerRef.current) {
|
|
2193
|
+
observerRef.current.disconnect();
|
|
2194
|
+
}
|
|
2195
|
+
if (resizeObserverRef.current) {
|
|
2196
|
+
resizeObserverRef.current.disconnect();
|
|
2197
|
+
}
|
|
2198
|
+
};
|
|
2199
|
+
}, []);
|
|
2200
|
+
return /*#__PURE__*/React__default.createElement(VideoPlayerComponent, _extends({
|
|
2201
|
+
ref: ref
|
|
2202
|
+
}, props));
|
|
2203
|
+
};
|
|
2204
|
+
};
|
|
2205
|
+
var VideoSDKPlayer = React.forwardRef(function (_ref5, ref) {
|
|
2206
|
+
var participantId = _ref5.participantId,
|
|
2207
|
+
_ref5$type = _ref5.type,
|
|
2208
|
+
type = _ref5$type === void 0 ? 'video' : _ref5$type,
|
|
2209
|
+
_ref5$containerStyle = _ref5.containerStyle,
|
|
2210
|
+
containerStyle = _ref5$containerStyle === void 0 ? {} : _ref5$containerStyle,
|
|
2211
|
+
_ref5$className = _ref5.className,
|
|
2212
|
+
className = _ref5$className === void 0 ? '' : _ref5$className,
|
|
2213
|
+
_ref5$classNameVideo = _ref5.classNameVideo,
|
|
2214
|
+
classNameVideo = _ref5$classNameVideo === void 0 ? '' : _ref5$classNameVideo,
|
|
2215
|
+
_ref5$videoStyle = _ref5.videoStyle,
|
|
2216
|
+
videoStyle = _ref5$videoStyle === void 0 ? {} : _ref5$videoStyle;
|
|
2217
|
+
var _useParticipant2 = useParticipant(participantId),
|
|
2218
|
+
webcamOn = _useParticipant2.webcamOn,
|
|
2219
|
+
webcamStream = _useParticipant2.webcamStream,
|
|
2220
|
+
isLocal = _useParticipant2.isLocal,
|
|
2221
|
+
screenShareStream = _useParticipant2.screenShareStream,
|
|
2222
|
+
screenShareOn = _useParticipant2.screenShareOn;
|
|
2223
|
+
var videoRef = React.useRef(null);
|
|
2224
|
+
React.useEffect(function () {
|
|
2225
|
+
var stream = type === 'share' ? screenShareStream : webcamStream;
|
|
2226
|
+
var isOn = type === 'share' ? screenShareOn : webcamOn;
|
|
2227
|
+
if (videoRef.current) {
|
|
2228
|
+
if (isOn && stream) {
|
|
2229
|
+
var mediaStream = new MediaStream();
|
|
2230
|
+
mediaStream.addTrack(stream.track);
|
|
2231
|
+
videoRef.current.srcObject = mediaStream;
|
|
2232
|
+
videoRef.current.play()["catch"](function (error) {
|
|
2233
|
+
return console.error('videoRef.current.play() failed', error);
|
|
2234
|
+
});
|
|
2235
|
+
} else {
|
|
2236
|
+
videoRef.current.srcObject = null;
|
|
2237
|
+
}
|
|
2238
|
+
}
|
|
2239
|
+
}, [type].concat(type === 'share' ? [screenShareOn, screenShareStream] : type === 'video' ? [webcamOn, webcamStream] : []));
|
|
2240
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
2241
|
+
ref: ref,
|
|
2242
|
+
className: "video-container participant-video-" + participantId + " " + (className || ''),
|
|
2243
|
+
style: _extends({
|
|
2244
|
+
objectFit: type === 'share' ? 'contain' : 'none',
|
|
2245
|
+
height: '100%'
|
|
2246
|
+
}, containerStyle)
|
|
2247
|
+
}, /*#__PURE__*/React__default.createElement("video", {
|
|
2248
|
+
width: "100%",
|
|
2249
|
+
height: "100%",
|
|
2250
|
+
ref: videoRef,
|
|
2251
|
+
autoPlay: true,
|
|
2252
|
+
className: classNameVideo,
|
|
2253
|
+
style: isLocal && type !== 'share' ? _extends({
|
|
2254
|
+
transform: 'scaleX(-1)',
|
|
2255
|
+
WebkitTransform: 'scaleX(-1)'
|
|
2256
|
+
}, videoStyle) : videoStyle
|
|
2257
|
+
}));
|
|
2258
|
+
});
|
|
2259
|
+
var VideoPlayer = function VideoPlayer(_ref6) {
|
|
2260
|
+
var participantId = _ref6.participantId,
|
|
2261
|
+
type = _ref6.type,
|
|
2262
|
+
props = _objectWithoutPropertiesLoose(_ref6, _excluded);
|
|
2263
|
+
var VideoPlayerComponent = React.useMemo(function () {
|
|
2264
|
+
return type === 'share' ? VideoSDKPlayer : withAdaptiveObservers(VideoSDKPlayer);
|
|
2265
|
+
}, [type, participantId]);
|
|
2266
|
+
return /*#__PURE__*/React__default.createElement(VideoPlayerComponent, _extends({
|
|
2267
|
+
participantId: participantId,
|
|
2268
|
+
type: type
|
|
2269
|
+
}, props));
|
|
2270
|
+
};
|
|
2271
|
+
var AudioPlayer = function AudioPlayer(_ref7) {
|
|
2272
|
+
var participantId = _ref7.participantId,
|
|
2273
|
+
type = _ref7.type;
|
|
2274
|
+
var _useParticipant3 = useParticipant(participantId),
|
|
2275
|
+
micStream = _useParticipant3.micStream,
|
|
2276
|
+
isLocal = _useParticipant3.isLocal,
|
|
2277
|
+
screenShareAudioStream = _useParticipant3.screenShareAudioStream;
|
|
2278
|
+
var micRef = React.useRef(null);
|
|
2279
|
+
React.useEffect(function () {
|
|
2280
|
+
if (micRef.current) {
|
|
2281
|
+
var audioStream = type === 'shareAudio' ? screenShareAudioStream : micStream;
|
|
2282
|
+
if (audioStream) {
|
|
2283
|
+
var mediaStream = new MediaStream();
|
|
2284
|
+
mediaStream.addTrack(audioStream.track);
|
|
2285
|
+
micRef.current.srcObject = mediaStream;
|
|
2286
|
+
micRef.current.play()["catch"](function (error) {
|
|
2287
|
+
return console.error('micRef.current.play() failed', error);
|
|
2288
|
+
});
|
|
2289
|
+
} else {
|
|
2290
|
+
micRef.current.srcObject = null;
|
|
2291
|
+
}
|
|
2292
|
+
}
|
|
2293
|
+
}, [micStream, screenShareAudioStream, type]);
|
|
2294
|
+
return /*#__PURE__*/React__default.createElement("audio", {
|
|
2295
|
+
ref: micRef,
|
|
2296
|
+
autoPlay: true,
|
|
2297
|
+
playsInline: true,
|
|
2298
|
+
muted: isLocal
|
|
2299
|
+
});
|
|
2300
|
+
};
|
|
2031
2301
|
|
|
2032
2302
|
Object.defineProperty(exports, 'CameraDeviceInfo', {
|
|
2033
2303
|
enumerable: true,
|
|
@@ -2047,9 +2317,11 @@ Object.defineProperty(exports, 'MicrophoneDeviceInfo', {
|
|
|
2047
2317
|
return jsSdk.MicrophoneDeviceInfo;
|
|
2048
2318
|
}
|
|
2049
2319
|
});
|
|
2320
|
+
exports.AudioPlayer = AudioPlayer;
|
|
2050
2321
|
exports.Constants = Constants;
|
|
2051
2322
|
exports.MeetingConsumer = MeetingConsumer;
|
|
2052
2323
|
exports.MeetingProvider = MeetingProvider;
|
|
2324
|
+
exports.VideoPlayer = VideoPlayer;
|
|
2053
2325
|
exports.createCameraVideoTrack = createCameraVideoTrack;
|
|
2054
2326
|
exports.createMicrophoneAudioTrack = createMicrophoneAudioTrack;
|
|
2055
2327
|
exports.createScreenShareVideoTrack = createScreenShareVideoTrack;
|
|
@@ -2063,4 +2335,5 @@ exports.useParticipant = useParticipant;
|
|
|
2063
2335
|
exports.usePubSub = usePubSub;
|
|
2064
2336
|
exports.useTranscription = useTranscription;
|
|
2065
2337
|
exports.useWhiteboard = useWhiteboard;
|
|
2338
|
+
exports.withAdaptiveObservers = withAdaptiveObservers;
|
|
2066
2339
|
//# sourceMappingURL=index.js.map
|