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