Skip to content

Commit 1671dfe

Browse files
committed
Add debugging
1 parent fa776de commit 1671dfe

2 files changed

Lines changed: 56 additions & 43 deletions

File tree

compositions/daily-baseline/components/VideoSplit.js

Lines changed: 55 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,18 @@ import { RoomContext } from "#vcs-react/contexts";
1212

1313
const textSize_gu = 1;
1414
const headerH_gu = textSize_gu * 10;
15-
1615
let primaryColor;
1716
let pauseBgColor;
1817

18+
function header(parentFrame, params, layoutCtx) {
19+
let { x, y, w, h } = parentFrame;
20+
const pxPerGu = layoutCtx.pixelsPerGridUnit;
21+
22+
h = headerH_gu * pxPerGu;
23+
24+
return { x, y, w, h };
25+
}
26+
1927
function body(parentFrame, params, layoutCtx) {
2028
let { x, y, w, h } = parentFrame;
2129
const pxPerGu = layoutCtx.pixelsPerGridUnit;
@@ -34,17 +42,19 @@ export default function AugmentedSplit(props) {
3442
const currentLayout = params["currentLayout"];
3543
primaryColor = params["voedaily.primary.color"];
3644
pauseBgColor = params["voedaily.pause.bgColor"];
45+
const room = React.useContext(RoomContext);
3746

3847
let baseVideo, pipOverlay, otherOverlays;
3948
let pipIdx;
4049
let bubbleIdx;
41-
const room = React.useContext(RoomContext);
4250

4351
switch (currentLayout) {
4452
case "1x1":
4553
pipIdx = null;
4654
bubbleIdx = 1;
47-
baseVideo = <VideoSingleCustom {...props} />;
55+
baseVideo = (
56+
<VideoSingleCustom participantDescs={[participantDescs[0]]} />
57+
);
4858
break;
4959
case "2x1":
5060
pipIdx = null;
@@ -54,7 +64,9 @@ export default function AugmentedSplit(props) {
5464
case "1x1withPIP":
5565
pipIdx = 1;
5666
bubbleIdx = 2;
57-
baseVideo = <VideoSingleCustom {...props} />;
67+
baseVideo = (
68+
<VideoSingleCustom participantDescs={[participantDescs[0]]} />
69+
);
5870
break;
5971
case "2x1withPIP":
6072
pipIdx = 2;
@@ -85,12 +97,17 @@ export default function AugmentedSplit(props) {
8597
{baseVideo && baseVideo}
8698
{pipOverlay && pipOverlay}
8799
{otherOverlays && otherOverlays}
100+
<debug.MediaInputPrintout
101+
layout={[header]}
102+
bgOpacity={0.5}
103+
renderEnv={room.renderingEnvironment}
104+
/>
88105
<debug.RoomPrintout
89106
layout={[body]}
90107
room={room}
91108
bgOpacity={0.5}
92109
headerTextColor="rgba(255, 255, 255, 0.68)"
93-
textSize_gu={1}
110+
textSize_gu={2}
94111
/>
95112
</Box>
96113
);
@@ -121,7 +138,7 @@ function getInitials(name) {
121138
function SimplePip({ participant }) {
122139
const { videoId, displayName = "", paused } = participant;
123140
const pxPerGu = useGrid().pixelsPerGridUnit;
124-
const pipSize_gu = 10;
141+
const pipSize_gu = 6;
125142

126143
const layoutProps = {
127144
positionCorner: PositionCorner.TOP_RIGHT,
@@ -136,15 +153,9 @@ function SimplePip({ participant }) {
136153
fontFamily: "DMSans",
137154
fontWeight: "700",
138155
textAlign: "center",
139-
fontSize_px: 56,
156+
fontSize_gu: 2,
140157
};
141158

142-
// const layoutPause = [centerText, { minH_gu: 5, minW_gu: 3 }];
143-
const layoutPause = [
144-
layoutFuncs.placeText,
145-
{ vAlign: "center", hAlign: "center" },
146-
];
147-
148159
const videoStyle = {
149160
cornerRadius_px: (pipSize_gu / 2) * pxPerGu, // mask to circle
150161
};
@@ -164,21 +175,26 @@ function SimplePip({ participant }) {
164175
if (paused || videoId == null) {
165176
// no video available, show a placeholder with the icon
166177
content = (
167-
<Box id="pipOutline" style={fillStyle} layout={layout}>
178+
<Box style={fillStyle} layout={layout}>
168179
{displayName ? (
169-
<Box clip layout={[layoutFuncs.centerYIfNeeded, { minH_gu: 2 }]}>
170-
<Text clip style={labelStyle} layout={layoutPause}>
171-
{getInitials(displayName)}
172-
</Text>
173-
</Box>
180+
<Text
181+
clip
182+
style={labelStyle}
183+
layout={[
184+
layoutFuncs.placeText,
185+
{ vAlign: "center", hAlign: "center", yOffset_gu: 0.45 },
186+
]}
187+
>
188+
{getInitials(displayName)}
189+
</Text>
174190
) : (
175191
<Image src="user_white_64.png" scaleMode="fill" />
176192
)}
177193
</Box>
178194
);
179195
} else {
180196
content = (
181-
<Box id="pipOutline" style={outlineStyle} layout={layout}>
197+
<Box style={outlineStyle} layout={layout}>
182198
<Video
183199
id="pipVideo"
184200
src={videoId}
@@ -207,7 +223,7 @@ function SimplePip({ participant }) {
207223
//
208224
function PipRow({ participantDescs }) {
209225
const pxPerGu = useGrid().pixelsPerGridUnit;
210-
const pipSize_gu = 6;
226+
const pipSize_gu = 4;
211227
const margin_gu = 2;
212228
const interval_gu = 1;
213229

@@ -245,27 +261,29 @@ function PipRow({ participantDescs }) {
245261
fontFamily: "DMSans",
246262
fontWeight: "700",
247263
textAlign: "center",
248-
fontSize_px: 40,
264+
fontSize_gu: 2,
249265
};
250266

251267
return participantDescs.map((pd, idx) => {
252268
const { videoId, paused, displayName = "" } = pd;
253269

254270
return paused ? (
255-
<Box id="pipOutline" style={fillStyle} layout={[rowLayoutFn, { idx }]}>
271+
<Box
272+
id={idx + "_pipAudience"}
273+
style={fillStyle}
274+
layout={[rowLayoutFn, { idx }]}
275+
>
256276
{displayName ? (
257-
<Box clip layout={[layoutFuncs.centerYIfNeeded, { minH_gu: 2 }]}>
258-
<Text
259-
clip
260-
style={labelStyle}
261-
layout={[
262-
layoutFuncs.placeText,
263-
{ vAlign: "center", hAlign: "center", idx },
264-
]}
265-
>
266-
{getInitials(displayName)}
267-
</Text>
268-
</Box>
277+
<Text
278+
clip
279+
style={labelStyle}
280+
layout={[
281+
layoutFuncs.placeText,
282+
{ vAlign: "center", hAlign: "center", yOffset_gu: 0.45 },
283+
]}
284+
>
285+
{getInitials(displayName)}
286+
</Text>
269287
) : (
270288
<Image src="user_white_64.png" scaleMode="fill" />
271289
)}
@@ -281,12 +299,7 @@ function PipRow({ participantDescs }) {
281299
// this is the original VideoSplit function from the baseline composition
282300
//
283301
function VideoSplit(props) {
284-
const {
285-
participantDescs = [],
286-
margin_gu = 0,
287-
splitDirection,
288-
currentLayout,
289-
} = props;
302+
const { participantDescs = [], margin_gu = 0, splitDirection } = props;
290303
// Make sure we have exactly one or two boxes
291304
const totalItems = Math.max(1, Math.min(participantDescs.length, 2));
292305

@@ -329,8 +342,8 @@ function VideoSplit(props) {
329342
enableParticipantOverride={true}
330343
overrideParticipant={participant}
331344
overrideDecoration={overrideDecoration}
332-
placeholderStyle={fillStyle}
333345
{...props}
346+
placeholderStyle={fillStyle}
334347
/>
335348
</Box>
336349
);

compositions/daily-baseline/params.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const compositionParams = [
1818
id: 'currentLayout',
1919
type: 'enum',
2020
defaultValue: '2x2',
21-
values: ['2x2', '2x1'],
21+
values: ['1x1', '2x2', '2x1', '1x1withPIP', '2x1withPIP'],
2222
},
2323
{
2424
id: 'showTextOverlay',

0 commit comments

Comments
 (0)