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