@stream-io/video-react-sdk 1.33.4 → 1.34.0

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.
@@ -1153,7 +1153,7 @@ const SpeakerTest = (props) => {
1153
1153
  const audioElementRef = react.useRef(null);
1154
1154
  const [isPlaying, setIsPlaying] = react.useState(false);
1155
1155
  const { t } = videoReactBindings.useI18n();
1156
- const { audioUrl = `https://unpkg.com/${"@stream-io/video-react-sdk"}@${"1.33.4"}/assets/piano.mp3`, } = props;
1156
+ const { audioUrl = `https://unpkg.com/${"@stream-io/video-react-sdk"}@${"1.34.0"}/assets/piano.mp3`, } = props;
1157
1157
  // Update audio output device when selection changes
1158
1158
  react.useEffect(() => {
1159
1159
  const audio = audioElementRef.current;
@@ -1794,7 +1794,9 @@ const ParticipantDetails = ({ indicatorsVisible = true, }) => {
1794
1794
  const hasVideoTrack = videoClient.hasVideo(participant);
1795
1795
  const canUnpin = !!pin && pin.isLocalPin;
1796
1796
  const isTrackPaused = trackType !== 'none' ? videoClient.hasPausedTrack(participant, trackType) : false;
1797
- 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 && (
1797
+ const isAudioTrackUnmuted = useIsTrackUnmuted(participant);
1798
+ const isAudioConnecting = hasAudioTrack && !isAudioTrackUnmuted;
1799
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: "str-video__participant-details", children: jsxRuntime.jsxs("div", { className: "str-video__participant-details__name", children: [name || userId, indicatorsVisible && isAudioConnecting && (jsxRuntime.jsx(LoadingIndicator, { className: "str-video__participant-details__name--audio-connecting", tooltip: t('Audio is connecting...') })), 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 && (
1798
1800
  // TODO: remove this monstrosity once we have a proper design
1799
1801
  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 &&
1800
1802
  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 })) }))] }));
@@ -1804,6 +1806,29 @@ const SpeechIndicator = () => {
1804
1806
  const { isSpeaking, isDominantSpeaker } = participant;
1805
1807
  return (jsxRuntime.jsxs("span", { className: clsx('str-video__speech-indicator', isSpeaking && 'str-video__speech-indicator--speaking', isDominantSpeaker && 'str-video__speech-indicator--dominant'), children: [jsxRuntime.jsx("span", { className: "str-video__speech-indicator__bar" }), jsxRuntime.jsx("span", { className: "str-video__speech-indicator__bar" }), jsxRuntime.jsx("span", { className: "str-video__speech-indicator__bar" })] }));
1806
1808
  };
1809
+ const useIsTrackUnmuted = (participant) => {
1810
+ const audioStream = participant.audioStream;
1811
+ const [unmuted, setUnmuted] = react.useState(() => {
1812
+ const track = audioStream?.getAudioTracks()[0];
1813
+ return !!track && !track.muted;
1814
+ });
1815
+ react.useEffect(() => {
1816
+ const track = audioStream?.getAudioTracks()[0];
1817
+ if (!track)
1818
+ return;
1819
+ setUnmuted(!track.muted);
1820
+ const handler = () => {
1821
+ setUnmuted(!track.muted);
1822
+ };
1823
+ track.addEventListener('mute', handler);
1824
+ track.addEventListener('unmute', handler);
1825
+ return () => {
1826
+ track.removeEventListener('mute', handler);
1827
+ track.removeEventListener('unmute', handler);
1828
+ };
1829
+ }, [audioStream]);
1830
+ return unmuted;
1831
+ };
1807
1832
 
1808
1833
  const ParticipantView = react.forwardRef(function ParticipantView({ participant, trackType = 'videoTrack', mirror, muteAudio, refs: { setVideoElement, setVideoPlaceholderElement } = {}, className, VideoPlaceholder, PictureInPicturePlaceholder, ParticipantViewUI = DefaultParticipantViewUI, }, ref) {
1809
1834
  const { isLocalParticipant, isSpeaking, isDominantSpeaker, sessionId } = participant;
@@ -1974,6 +1999,7 @@ var en = {
1974
1999
  "Dominant Speaker": "Dominant Speaker",
1975
2000
  "Poor connection quality": "Poor connection quality. Please check your internet connection.",
1976
2001
  "Video paused due to insufficient bandwidth": "Video paused due to insufficient bandwidth",
2002
+ "Audio is connecting...": "Audio is connecting...",
1977
2003
  Participants: Participants,
1978
2004
  Anonymous: Anonymous,
1979
2005
  "No participants found": "No participants found",