@stream-io/video-react-sdk 1.18.13 → 1.19.1

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.cjs.js CHANGED
@@ -787,7 +787,10 @@ const Video$1 = ({ enabled = true, mirror, trackType, participant, className, Vi
787
787
  : false;
788
788
  const isInvisible = trackType === 'none' ||
789
789
  viewportVisibilityState?.[trackType] === videoClient.VisibilityState.INVISIBLE;
790
- const hasNoVideoOrInvisible = !enabled || !isPublishingTrack || isInvisible;
790
+ const hasNoVideoOrInvisible = !enabled ||
791
+ !isPublishingTrack ||
792
+ isInvisible ||
793
+ videoClient.hasPausedTrack(participant, trackType);
791
794
  const mirrorVideo = mirror === undefined
792
795
  ? isLocalParticipant && trackType === 'videoTrack'
793
796
  : mirror;
@@ -899,7 +902,7 @@ const BackgroundFiltersProvider = (props) => {
899
902
  };
900
903
  const BackgroundFilters = (props) => {
901
904
  const call = videoReactBindings.useCall();
902
- const { children, start } = useRenderer(props.tfLite);
905
+ const { children, start } = useRenderer(props.tfLite, call);
903
906
  const { backgroundFilter, onError } = useBackgroundFilters();
904
907
  const handleErrorRef = react.useRef(undefined);
905
908
  handleErrorRef.current = onError;
@@ -913,7 +916,7 @@ const BackgroundFilters = (props) => {
913
916
  }, [backgroundFilter, call, start]);
914
917
  return children;
915
918
  };
916
- const useRenderer = (tfLite) => {
919
+ const useRenderer = (tfLite, call) => {
917
920
  const { backgroundFilter, backgroundBlurLevel, backgroundImage } = useBackgroundFilters();
918
921
  const videoRef = react.useRef(null);
919
922
  const canvasRef = react.useRef(null);
@@ -950,6 +953,11 @@ const useRenderer = (tfLite) => {
950
953
  width: trackSettings.width ?? 0,
951
954
  height: trackSettings.height ?? 0,
952
955
  }));
956
+ call?.tracer.trace('backgroundFilters.enable', {
957
+ backgroundFilter,
958
+ backgroundBlurLevel,
959
+ backgroundImage,
960
+ });
953
961
  renderer = videoFiltersWeb.createRenderer(tfLite, videoEl, canvasEl, {
954
962
  backgroundFilter,
955
963
  backgroundBlurLevel,
@@ -964,6 +972,7 @@ const useRenderer = (tfLite) => {
964
972
  return {
965
973
  output,
966
974
  stop: () => {
975
+ call?.tracer.trace('backgroundFilters.disable', null);
967
976
  renderer?.dispose();
968
977
  if (videoRef.current)
969
978
  videoRef.current.srcObject = null;
@@ -971,7 +980,13 @@ const useRenderer = (tfLite) => {
971
980
  videoClient.disposeOfMediaStream(outputStream);
972
981
  },
973
982
  };
974
- }, [backgroundBlurLevel, backgroundFilter, backgroundImage, tfLite]);
983
+ }, [
984
+ backgroundBlurLevel,
985
+ backgroundFilter,
986
+ backgroundImage,
987
+ call?.tracer,
988
+ tfLite,
989
+ ]);
975
990
  const children = (jsxRuntime.jsxs("div", { className: "str-video__background-filters", children: [jsxRuntime.jsx("video", { className: clsx('str-video__background-filters__video', videoSize.height > videoSize.width &&
976
991
  'str-video__background-filters__video--tall'), ref: videoRef, playsInline: true, muted: true, controls: false, ...videoSize }), backgroundImage && (jsxRuntime.jsx("img", { className: "str-video__background-filters__background-image", alt: "Background", ref: bgImageRef, src: backgroundImage, ...videoSize })), jsxRuntime.jsx("canvas", { className: "str-video__background-filters__target-canvas", ...videoSize, ref: canvasRef })] }));
977
992
  return {
@@ -2217,9 +2232,11 @@ const DefaultScreenShareOverlay = () => {
2217
2232
  const call = videoReactBindings.useCall();
2218
2233
  const { t } = videoReactBindings.useI18n();
2219
2234
  const stopScreenShare = () => {
2220
- call?.screenShare.disable();
2235
+ call?.screenShare.disable().catch((err) => {
2236
+ console.error('Failed to stop screen sharing:', err);
2237
+ });
2221
2238
  };
2222
- return (jsxRuntime.jsxs("div", { className: "str-video__screen-share-overlay", children: [jsxRuntime.jsx(Icon, { icon: "screen-share-off" }), jsxRuntime.jsx("span", { className: "str-video__screen-share-overlay__title", children: t('You are presenting your screen') }), jsxRuntime.jsxs("button", { onClick: stopScreenShare, className: "str-video__screen-share-overlay__button", children: [jsxRuntime.jsx(Icon, { icon: "close" }), " ", t('Stop Screen Sharing')] })] }));
2239
+ return (jsxRuntime.jsxs("div", { className: "str-video__screen-share-overlay", children: [jsxRuntime.jsx(Icon, { icon: "screen-share-off" }), jsxRuntime.jsx("span", { className: "str-video__screen-share-overlay__title", children: t('You are presenting your screen') }), jsxRuntime.jsxs("button", { onClick: stopScreenShare, type: "button", className: "str-video__screen-share-overlay__button", children: [jsxRuntime.jsx(Icon, { icon: "close" }), " ", t('Stop Screen Sharing')] })] }));
2223
2240
  };
2224
2241
  const DefaultParticipantViewUI = ({ indicatorsVisible = true, menuPlacement = 'bottom-start', showMenuButton = true, ParticipantActionsContextMenu: ParticipantActionsContextMenu$1 = ParticipantActionsContextMenu, }) => {
2225
2242
  const { participant, trackType } = useParticipantViewContext();
@@ -2232,7 +2249,7 @@ const DefaultParticipantViewUI = ({ indicatorsVisible = true, menuPlacement = 'b
2232
2249
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [showMenuButton && (jsxRuntime.jsx(MenuToggle, { strategy: "fixed", placement: menuPlacement, ToggleButton: ToggleButton, children: jsxRuntime.jsx(ParticipantActionsContextMenu$1, {}) })), jsxRuntime.jsx(Reaction, { participant: participant }), jsxRuntime.jsx(ParticipantDetails, { indicatorsVisible: indicatorsVisible })] }));
2233
2250
  };
2234
2251
  const ParticipantDetails = ({ indicatorsVisible = true, }) => {
2235
- const { participant } = useParticipantViewContext();
2252
+ const { participant, trackType } = useParticipantViewContext();
2236
2253
  const { isLocalParticipant, connectionQuality, pin, sessionId, name, userId, } = participant;
2237
2254
  const call = videoReactBindings.useCall();
2238
2255
  const { t } = videoReactBindings.useI18n();
@@ -2241,7 +2258,8 @@ const ParticipantDetails = ({ indicatorsVisible = true, }) => {
2241
2258
  const hasAudioTrack = videoClient.hasAudio(participant);
2242
2259
  const hasVideoTrack = videoClient.hasVideo(participant);
2243
2260
  const canUnpin = !!pin && pin.isLocalPin;
2244
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: "str-video__participant-details", children: jsxRuntime.jsxs("span", { className: "str-video__participant-details__name", children: [name || userId, indicatorsVisible && !hasAudioTrack && (jsxRuntime.jsx("span", { className: "str-video__participant-details__name--audio-muted" })), indicatorsVisible && !hasVideoTrack && (jsxRuntime.jsx("span", { className: "str-video__participant-details__name--video-muted" })), indicatorsVisible && canUnpin && (
2261
+ const isTrackPaused = trackType !== 'none' ? videoClient.hasPausedTrack(participant, trackType) : false;
2262
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: "str-video__participant-details", children: jsxRuntime.jsxs("span", { className: "str-video__participant-details__name", children: [name || userId, indicatorsVisible && !hasAudioTrack && (jsxRuntime.jsx("span", { className: "str-video__participant-details__name--audio-muted" })), indicatorsVisible && !hasVideoTrack && (jsxRuntime.jsx("span", { className: "str-video__participant-details__name--video-muted" })), indicatorsVisible && isTrackPaused && (jsxRuntime.jsx("span", { title: t('Video paused due to insufficient bandwidth'), className: "str-video__participant-details__name--track-paused" })), indicatorsVisible && canUnpin && (
2245
2263
  // TODO: remove this monstrosity once we have a proper design
2246
2264
  jsxRuntime.jsx("span", { title: t('Unpin'), onClick: () => call?.unpin(sessionId), className: "str-video__participant-details__name--pinned" })), indicatorsVisible && jsxRuntime.jsx(SpeechIndicator, {})] }) }), indicatorsVisible && (jsxRuntime.jsx(Notification, { isVisible: isLocalParticipant &&
2247
2265
  connectionQuality === videoClient.SfuModels.ConnectionQuality.POOR, message: t('Poor connection quality'), children: connectionQualityAsString && (jsxRuntime.jsx("span", { className: clsx('str-video__participant-details__connection-quality', `str-video__participant-details__connection-quality--${connectionQualityAsString}`), title: connectionQualityAsString })) }))] }));
@@ -2414,6 +2432,7 @@ var en = {
2414
2432
  "{{ direction }} picture-in-picture": "{{ direction }} picture-in-picture",
2415
2433
  "Dominant Speaker": "Dominant Speaker",
2416
2434
  "Poor connection quality": "Poor connection quality. Please check your internet connection.",
2435
+ "Video paused due to insufficient bandwidth": "Video paused due to insufficient bandwidth",
2417
2436
  Participants: Participants,
2418
2437
  Anonymous: Anonymous,
2419
2438
  "No participants found": "No participants found",
@@ -2937,7 +2956,7 @@ const checkCanJoinEarly = (startsAt, joinAheadTimeSeconds) => {
2937
2956
  return Date.now() >= +startsAt - (joinAheadTimeSeconds ?? 0) * 1000;
2938
2957
  };
2939
2958
 
2940
- const [major, minor, patch] = ("1.18.13").split('.');
2959
+ const [major, minor, patch] = ("1.19.1").split('.');
2941
2960
  videoClient.setSdkInfo({
2942
2961
  type: videoClient.SfuModels.SdkType.REACT,
2943
2962
  major,