Skip to content

Commit f9eacc1

Browse files
committed
v3.0.31 Fully hide participants and screenshares that are marked as isAudioOnly.
1 parent 5fd4b0f commit f9eacc1

File tree

4 files changed

+145
-74
lines changed

4 files changed

+145
-74
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@api.stream/studio-kit",
3-
"version": "3.0.30",
3+
"version": "3.0.31",
44
"description": "Client SDK for building studio experiences with API.stream",
55
"license": "MIT",
66
"private": false,

src/core/transforms/WebRTC.tsx

+20-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,16 @@ import { getProject, getProjectRoom } from '../data'
1313
type Props = {
1414
volume: number
1515
isMuted: boolean
16+
/**
17+
* `isHidden` denotes whether the video feed is enabled.
18+
* If `isHidden` is true, but `isAudioOnly` is false, the placeholder will be rendered.
19+
*/
1620
isHidden: boolean
21+
/**
22+
* `isAudioOnly` denotes whether the participant node appears in the `content` or is contained in the `audioContainer`.
23+
* If `isHidden` is true, but `isAudioOnly` is false, the placeholder will be rendered.
24+
*/
25+
isAudioOnly: boolean
1726
sink: string
1827
}
1928

@@ -73,7 +82,7 @@ export const RoomParticipant = {
7382
}) => {
7483
const ref = useRef<HTMLVideoElement>()
7584

76-
const { volume = 1, isHidden = false } = props || {}
85+
const { volume = 1, isHidden = false, isAudioOnly = false } = props || {}
7786
const [labelSize, setLabelSize] = useState<0 | 1 | 2 | 3>(0)
7887

7988
/* It's checking if the participant is the local participant. */
@@ -88,7 +97,7 @@ export const RoomParticipant = {
8897

8998
// Hide video if explicitly isHidden by host or
9099
// if the participant is sending no video
91-
const hasVideo = !props?.isHidden && source?.props?.videoEnabled
100+
const hasVideo = !isAudioOnly && !isHidden && source?.props?.videoEnabled
92101

93102
useEffect(() => {
94103
if (!ref.current) return
@@ -152,8 +161,13 @@ export const RoomParticipant = {
152161
style={{
153162
position: 'relative',
154163
display: 'flex',
155-
height: '100%',
156-
width: '100%',
164+
...(isAudioOnly ? {
165+
height: '0px',
166+
width: '0px',
167+
} : {
168+
height: '100%',
169+
width: '100%',
170+
}),
157171
}}
158172
>
159173
<div
@@ -170,7 +184,7 @@ export const RoomParticipant = {
170184
opacity: hasVideo ? '0' : '1',
171185
}}
172186
>
173-
{source?.props.displayName && (
187+
{source?.props.displayName && !props?.isAudioOnly && (
174188
<div
175189
style={{
176190
borderRadius: '50%',
@@ -218,7 +232,7 @@ export const RoomParticipant = {
218232
}}
219233
/>
220234
</div>
221-
{source?.props.displayName && (
235+
{source?.props.displayName && !isAudioOnly && (
222236
<div
223237
className="NameBannerContainer"
224238
style={{

src/helpers/compositor.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,8 @@ const ElementTree = (props: { nodeId: string }) => {
398398
})}
399399
style={{
400400
position: 'relative',
401-
width: nodeProps.size?.x || '100%',
402-
height: nodeProps.size?.y || '100%',
401+
width: (node.props?.isHidden ?? false) ? '0%' : '100%',
402+
height: (node.props?.isHidden ?? false) ? '0%' : '100%',
403403
pointerEvents: 'none',
404404
}}
405405
>
@@ -467,8 +467,8 @@ const ElementTree = (props: { nodeId: string }) => {
467467
className="interactive-overlay"
468468
ref={interactiveRef}
469469
style={{
470-
height: '100%',
471-
width: '100%',
470+
width: (node.props?.isHidden ?? false) ? '0%' : '100%',
471+
height: (node.props?.isHidden ?? false) ? '0%' : '100%',
472472
position: 'absolute',
473473
zIndex: 2,
474474
}}

0 commit comments

Comments
 (0)