@videosdk.live/react-sdk 0.2.2 → 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 CHANGED
@@ -383,7 +383,7 @@ var MeetingConsumer = function MeetingConsumer(_ref2) {
383
383
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(MeetingProviderContex.Consumer, null, children));
384
384
  };
385
385
 
386
- var version = "0.2.1";
386
+ var version = "0.2.2";
387
387
 
388
388
  var MeetingProvider = function MeetingProvider(_ref) {
389
389
  var children = _ref.children,
@@ -2217,22 +2217,26 @@ var VideoSDKPlayer = React.forwardRef(function (_ref5, ref) {
2217
2217
  var _useParticipant2 = useParticipant(participantId),
2218
2218
  webcamOn = _useParticipant2.webcamOn,
2219
2219
  webcamStream = _useParticipant2.webcamStream,
2220
- isLocal = _useParticipant2.isLocal;
2221
- var webcamRef = React.useRef(null);
2220
+ isLocal = _useParticipant2.isLocal,
2221
+ screenShareStream = _useParticipant2.screenShareStream,
2222
+ screenShareOn = _useParticipant2.screenShareOn;
2223
+ var videoRef = React.useRef(null);
2222
2224
  React.useEffect(function () {
2223
- if (webcamRef.current) {
2224
- if (webcamOn && webcamStream) {
2225
+ var stream = type === 'share' ? screenShareStream : webcamStream;
2226
+ var isOn = type === 'share' ? screenShareOn : webcamOn;
2227
+ if (videoRef.current) {
2228
+ if (isOn && stream) {
2225
2229
  var mediaStream = new MediaStream();
2226
- mediaStream.addTrack(webcamStream.track);
2227
- webcamRef.current.srcObject = mediaStream;
2228
- webcamRef.current.play()["catch"](function (error) {
2229
- return console.error('videoElem.current.play() failed', error);
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);
2230
2234
  });
2231
2235
  } else {
2232
- webcamRef.current.srcObject = null;
2236
+ videoRef.current.srcObject = null;
2233
2237
  }
2234
2238
  }
2235
- }, [webcamStream, webcamOn]);
2239
+ }, [type].concat(type === 'share' ? [screenShareOn, screenShareStream] : type === 'video' ? [webcamOn, webcamStream] : []));
2236
2240
  return /*#__PURE__*/React__default.createElement("div", {
2237
2241
  ref: ref,
2238
2242
  className: "video-container participant-video-" + participantId + " " + (className || ''),
@@ -2243,10 +2247,10 @@ var VideoSDKPlayer = React.forwardRef(function (_ref5, ref) {
2243
2247
  }, /*#__PURE__*/React__default.createElement("video", {
2244
2248
  width: "100%",
2245
2249
  height: "100%",
2246
- ref: webcamRef,
2250
+ ref: videoRef,
2247
2251
  autoPlay: true,
2248
2252
  className: classNameVideo,
2249
- style: isLocal ? _extends({
2253
+ style: isLocal && type !== 'share' ? _extends({
2250
2254
  transform: 'scaleX(-1)',
2251
2255
  WebkitTransform: 'scaleX(-1)'
2252
2256
  }, videoStyle) : videoStyle