@stream-io/video-react-native-sdk 0.7.6 → 0.7.7

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.
Files changed (54) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/commonjs/components/Call/CallControls/ScreenShareToggleButton.js +1 -1
  3. package/dist/commonjs/components/Call/CallControls/ScreenShareToggleButton.js.map +1 -1
  4. package/dist/commonjs/components/Call/CallLayout/CallParticipantsSpotlight.js +1 -3
  5. package/dist/commonjs/components/Call/CallLayout/CallParticipantsSpotlight.js.map +1 -1
  6. package/dist/commonjs/components/Livestream/HostLivestream/HostLivestream.js +1 -3
  7. package/dist/commonjs/components/Livestream/HostLivestream/HostLivestream.js.map +1 -1
  8. package/dist/commonjs/components/Livestream/LivestreamControls/LivestreamScreenShareToggleButton.js +1 -1
  9. package/dist/commonjs/components/Livestream/LivestreamControls/LivestreamScreenShareToggleButton.js.map +1 -1
  10. package/dist/commonjs/components/Livestream/LivestreamLayout/LivestreamLayout.js +3 -4
  11. package/dist/commonjs/components/Livestream/LivestreamLayout/LivestreamLayout.js.map +1 -1
  12. package/dist/commonjs/components/Livestream/ViewerLivestream/ViewerLivestream.js +1 -3
  13. package/dist/commonjs/components/Livestream/ViewerLivestream/ViewerLivestream.js.map +1 -1
  14. package/dist/commonjs/components/Participant/ParticipantView/ParticipantLabel.js +2 -3
  15. package/dist/commonjs/components/Participant/ParticipantView/ParticipantLabel.js.map +1 -1
  16. package/dist/commonjs/components/Participant/ParticipantView/VideoRenderer.js +1 -2
  17. package/dist/commonjs/components/Participant/ParticipantView/VideoRenderer.js.map +1 -1
  18. package/dist/commonjs/version.js +1 -1
  19. package/dist/module/components/Call/CallControls/ScreenShareToggleButton.js +3 -3
  20. package/dist/module/components/Call/CallControls/ScreenShareToggleButton.js.map +1 -1
  21. package/dist/module/components/Call/CallLayout/CallParticipantsSpotlight.js +2 -4
  22. package/dist/module/components/Call/CallLayout/CallParticipantsSpotlight.js.map +1 -1
  23. package/dist/module/components/Livestream/HostLivestream/HostLivestream.js +2 -4
  24. package/dist/module/components/Livestream/HostLivestream/HostLivestream.js.map +1 -1
  25. package/dist/module/components/Livestream/LivestreamControls/LivestreamScreenShareToggleButton.js +3 -3
  26. package/dist/module/components/Livestream/LivestreamControls/LivestreamScreenShareToggleButton.js.map +1 -1
  27. package/dist/module/components/Livestream/LivestreamLayout/LivestreamLayout.js +4 -5
  28. package/dist/module/components/Livestream/LivestreamLayout/LivestreamLayout.js.map +1 -1
  29. package/dist/module/components/Livestream/ViewerLivestream/ViewerLivestream.js +2 -3
  30. package/dist/module/components/Livestream/ViewerLivestream/ViewerLivestream.js.map +1 -1
  31. package/dist/module/components/Participant/ParticipantView/ParticipantLabel.js +3 -4
  32. package/dist/module/components/Participant/ParticipantView/ParticipantLabel.js.map +1 -1
  33. package/dist/module/components/Participant/ParticipantView/VideoRenderer.js +2 -3
  34. package/dist/module/components/Participant/ParticipantView/VideoRenderer.js.map +1 -1
  35. package/dist/module/version.js +1 -1
  36. package/dist/typescript/components/Call/CallControls/ScreenShareToggleButton.d.ts.map +1 -1
  37. package/dist/typescript/components/Call/CallLayout/CallParticipantsSpotlight.d.ts.map +1 -1
  38. package/dist/typescript/components/Livestream/HostLivestream/HostLivestream.d.ts.map +1 -1
  39. package/dist/typescript/components/Livestream/LivestreamControls/LivestreamScreenShareToggleButton.d.ts.map +1 -1
  40. package/dist/typescript/components/Livestream/LivestreamLayout/LivestreamLayout.d.ts.map +1 -1
  41. package/dist/typescript/components/Livestream/ViewerLivestream/ViewerLivestream.d.ts.map +1 -1
  42. package/dist/typescript/components/Participant/ParticipantView/ParticipantLabel.d.ts.map +1 -1
  43. package/dist/typescript/components/Participant/ParticipantView/VideoRenderer.d.ts.map +1 -1
  44. package/dist/typescript/version.d.ts +1 -1
  45. package/package.json +3 -3
  46. package/src/components/Call/CallControls/ScreenShareToggleButton.tsx +4 -5
  47. package/src/components/Call/CallLayout/CallParticipantsSpotlight.tsx +3 -6
  48. package/src/components/Livestream/HostLivestream/HostLivestream.tsx +5 -5
  49. package/src/components/Livestream/LivestreamControls/LivestreamScreenShareToggleButton.tsx +4 -5
  50. package/src/components/Livestream/LivestreamLayout/LivestreamLayout.tsx +16 -16
  51. package/src/components/Livestream/ViewerLivestream/ViewerLivestream.tsx +5 -5
  52. package/src/components/Participant/ParticipantView/ParticipantLabel.tsx +4 -5
  53. package/src/components/Participant/ParticipantView/VideoRenderer.tsx +7 -7
  54. package/src/version.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  import React, { useCallback, useEffect, useState } from 'react';
2
- import { SfuModels, StreamVideoParticipant } from '@stream-io/video-client';
2
+ import { hasScreenShare, SfuModels } from '@stream-io/video-client';
3
3
  import { useCall, useCallStateHooks } from '@stream-io/video-react-bindings';
4
4
  import { StyleSheet, View, ViewStyle } from 'react-native';
5
5
  import { usePaginatedLayoutSortPreset } from '../../../hooks/usePaginatedLayoutSortPreset';
@@ -9,7 +9,6 @@ import {
9
9
  VideoRendererProps,
10
10
  } from '../../Participant';
11
11
  import { ScreenShareOverlayProps } from '../../utility/ScreenShareOverlay';
12
- import { VideoDimension } from '@stream-io/video-client/dist/src/gen/video/sfu/models/models';
13
12
 
14
13
  /**
15
14
  * Props for the LivestreamLayout component.
@@ -30,9 +29,6 @@ export type LivestreamLayoutProps = {
30
29
  ScreenShareOverlay?: React.ComponentType<ScreenShareOverlayProps> | null;
31
30
  };
32
31
 
33
- const hasScreenShare = (p?: StreamVideoParticipant) =>
34
- p?.publishedTracks.includes(SfuModels.TrackType.SCREEN_SHARE);
35
-
36
32
  /**
37
33
  * The LivestreamLayout component presents the live stream video layout.
38
34
  */
@@ -46,11 +42,12 @@ export const LivestreamLayout = ({
46
42
  const {
47
43
  theme: { colors, livestreamLayout },
48
44
  } = useTheme();
49
- const [currentSpeaker, ...otherParticipants] = useParticipants();
45
+ const participants = useParticipants();
46
+ const [currentSpeaker] = participants;
50
47
  const hasOngoingScreenShare = useHasOngoingScreenShare();
51
48
  const presenter = hasOngoingScreenShare
52
- ? hasScreenShare(currentSpeaker) && currentSpeaker
53
- : otherParticipants.find(hasScreenShare);
49
+ ? participants.find(hasScreenShare)
50
+ : undefined;
54
51
 
55
52
  usePaginatedLayoutSortPreset(call);
56
53
 
@@ -64,12 +61,15 @@ export const LivestreamLayout = ({
64
61
  ? undefined
65
62
  : objectFit;
66
63
 
67
- const onDimensionsChange = useCallback((d: VideoDimension | undefined) => {
68
- if (d) {
69
- const isWidthWide = d.width > d.height;
70
- setObjectFit(isWidthWide ? 'contain' : 'cover');
71
- }
72
- }, []);
64
+ const onDimensionsChange = useCallback(
65
+ (d: SfuModels.VideoDimension | undefined) => {
66
+ if (d) {
67
+ const isWidthWide = d.width > d.height;
68
+ setObjectFit(isWidthWide ? 'contain' : 'cover');
69
+ }
70
+ },
71
+ [],
72
+ );
73
73
 
74
74
  const landScapeStyles: ViewStyle = {
75
75
  flexDirection: landscape ? 'row' : 'column',
@@ -109,9 +109,9 @@ export const LivestreamLayout = ({
109
109
  const RemoteVideoTrackDimensionsRenderLessComponent = ({
110
110
  onDimensionsChange,
111
111
  }: {
112
- onDimensionsChange: (d: VideoDimension | undefined) => void;
112
+ onDimensionsChange: (d: SfuModels.VideoDimension | undefined) => void;
113
113
  }) => {
114
- const [dimension, setDimension] = useState<VideoDimension>();
114
+ const [dimension, setDimension] = useState<SfuModels.VideoDimension>();
115
115
  const { useCallStatsReport } = useCallStateHooks();
116
116
  const statsReport = useCallStatsReport();
117
117
  const highestFrameHeight = statsReport?.subscriberStats?.highestFrameHeight;
@@ -21,10 +21,7 @@ import {
21
21
  FloatingParticipantView as DefaultFloatingParticipantView,
22
22
  FloatingParticipantViewProps,
23
23
  } from '../../Participant';
24
- import { SfuModels, StreamVideoParticipant } from '@stream-io/video-client';
25
-
26
- const hasVideoTrack = (p?: StreamVideoParticipant) =>
27
- p?.publishedTracks.includes(SfuModels.TrackType.VIDEO);
24
+ import { hasVideo } from '@stream-io/video-client';
28
25
 
29
26
  /**
30
27
  * Props for the ViewerLivestream component.
@@ -71,7 +68,10 @@ export const ViewerLivestream = ({
71
68
  const hasOngoingScreenShare = useHasOngoingScreenShare();
72
69
  const [currentSpeaker] = useParticipants();
73
70
  const floatingParticipant =
74
- hasOngoingScreenShare && hasVideoTrack(currentSpeaker) && currentSpeaker;
71
+ hasOngoingScreenShare &&
72
+ currentSpeaker &&
73
+ hasVideo(currentSpeaker) &&
74
+ currentSpeaker;
75
75
 
76
76
  const [topViewHeight, setTopViewHeight] = React.useState<number>();
77
77
  const [controlsHeight, setControlsHeight] = React.useState<number>();
@@ -10,7 +10,7 @@ import { useCall, useI18n } from '@stream-io/video-react-bindings';
10
10
  import { ComponentTestIds } from '../../../constants/TestIds';
11
11
  import { ParticipantViewProps } from './ParticipantView';
12
12
  import { Z_INDEX } from '../../../constants';
13
- import { SfuModels } from '@stream-io/video-client';
13
+ import { hasAudio, hasVideo } from '@stream-io/video-client';
14
14
  import { useTheme } from '../../../contexts/ThemeContext';
15
15
 
16
16
  /**
@@ -43,16 +43,15 @@ export const ParticipantLabel = ({
43
43
  },
44
44
  },
45
45
  } = useTheme();
46
- const { name, userId, pin, publishedTracks, sessionId, isLocalParticipant } =
47
- participant;
46
+ const { name, userId, pin, sessionId, isLocalParticipant } = participant;
48
47
  const call = useCall();
49
48
  const { t } = useI18n();
50
49
  const participantName = name ?? userId;
51
50
 
52
51
  const participantLabel = isLocalParticipant ? t('You') : participantName;
53
52
  const isPinningEnabled = pin?.isLocalPin;
54
- const isAudioMuted = !publishedTracks.includes(SfuModels.TrackType.AUDIO);
55
- const isVideoMuted = !publishedTracks.includes(SfuModels.TrackType.VIDEO);
53
+ const isAudioMuted = !hasAudio(participant);
54
+ const isVideoMuted = !hasVideo(participant);
56
55
 
57
56
  const unPinParticipantHandler = () => {
58
57
  call?.unpin(sessionId);
@@ -1,9 +1,12 @@
1
1
  import React, { useEffect, useRef } from 'react';
2
2
  import { StyleSheet, View } from 'react-native';
3
+ import type { MediaStream } from '@stream-io/react-native-webrtc';
3
4
  import { RTCView } from '@stream-io/react-native-webrtc';
4
5
  import { ParticipantViewProps } from './ParticipantView';
5
6
  import {
6
7
  CallingState,
8
+ hasScreenShare,
9
+ hasVideo,
7
10
  SfuModels,
8
11
  VideoTrackType,
9
12
  VisibilityState,
@@ -11,7 +14,6 @@ import {
11
14
  import { useCall, useCallStateHooks } from '@stream-io/video-react-bindings';
12
15
  import { ParticipantVideoFallback as DefaultParticipantVideoFallback } from './ParticipantVideoFallback';
13
16
  import { useTheme } from '../../../contexts/ThemeContext';
14
- import type { MediaStream } from '@stream-io/react-native-webrtc';
15
17
 
16
18
  const DEFAULT_VIEWPORT_VISIBILITY_STATE: Record<
17
19
  VideoTrackType,
@@ -59,18 +61,16 @@ export const VideoRenderer = ({
59
61
  const {
60
62
  isLocalParticipant,
61
63
  sessionId,
62
- publishedTracks,
63
64
  viewportVisibilityState,
64
65
  videoStream,
65
66
  screenShareStream,
66
67
  } = participant;
67
68
 
68
69
  const isScreenSharing = trackType === 'screenShareTrack';
69
- const isPublishingVideoTrack = publishedTracks.includes(
70
- isScreenSharing
71
- ? SfuModels.TrackType.SCREEN_SHARE
72
- : SfuModels.TrackType.VIDEO,
73
- );
70
+ const isPublishingVideoTrack = isScreenSharing
71
+ ? hasScreenShare(participant)
72
+ : hasVideo(participant);
73
+
74
74
  const hasJoinedCall = callingState === CallingState.JOINED;
75
75
  const videoStreamToRender = (isScreenSharing
76
76
  ? screenShareStream
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '0.7.6';
1
+ export const version = '0.7.7';