Skip to content

Conversation

@kexinF
Copy link
Collaborator

@kexinF kexinF commented May 8, 2024

I made the changes in the following files:

  1. NameTag.css to convenient for my testing

  2. draw_badge_api.ts:

  • add drawCameraSizeChange function inside the DrawBadgeApi, it takes the detected width and height as input.
  • Modify drawEverythingToImage takes the width and height as input and using the scale factors to determine the new axis values
  1. app/main/page.tsx
  • add onMyMediaChange inside this file. Ideally, this should be inside the /lib/draw_badge_api, but I haven't figured out how to return the width and height as an event listener.

I don't have the extra camera, so I was not able to test how it performs on different types of video inputs.

@kexinF kexinF requested review from Shaomei and blickly May 8, 2024 08:17
@kexinF kexinF linked an issue May 8, 2024 that may be closed by this pull request
@vercel
Copy link

vercel bot commented May 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
zoom-companion-shaomei-test ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 13, 2024 7:01am
zoom-companion-test ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 13, 2024 7:01am

@kexinF kexinF changed the title 1/2: Add onMyMediaChange event api Add onMyMediaChange event api May 13, 2024
@Shaomei
Copy link
Collaborator

Shaomei commented Jun 19, 2024

@blickly can you take a look?

Comment on lines +38 to +50
zoomSdk.onMyMediaChange((event) => {
console.log(event)
if (
event.media &&
'video' in event.media &&
event.media.video &&
event.media.video.state &&
typeof event.media.video.width === 'number' &&
typeof event.media.video.height === 'number'
) {
foregroundDrawer.drawCameraSizeChange(event.media.video.width, event.media.video.height);
}
});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if we add an onMyMediaChange method to zoomapi.ts, we can move this part into draw_badge_api.ts

Comment on lines +31 to +37
zoomSdk.config({
capabilities: [
"setVirtualForeground",
"removeVirtualForeground",
"onMyMediaChange",
]
})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sure that this already happens inside zoomapi.ts

// TODO: make sure the imageData scale and resize correctly based on window size.
// make need to make some more Zoom API calls to get user window size.
function drawEverythingToImage(nametag: NameTagBadge, handWave: HandWaveBadge): ImageData {
function drawEverythingToImage(nametag: NameTagBadge, handWave: HandWaveBadge, videoWidth: number, videoHeight: number): ImageData {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I'd probably make an interface to represent the "video resolution" rather than making people remember the order of the two numbers here.

Comment on lines +63 to +64
const xFactor = videoWidth / 1600;
const yFactor = videoHeight / 900;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are places here where these xFactor and yFactor could be avoided by using relative sizes rather than specific pixel sizes. See https://developer.mozilla.org/en-US/docs/Web/CSS/font-size

@Shaomei
Copy link
Collaborator

Shaomei commented Aug 12, 2024

Thank you @kexinF for taking a stab at this. The changes were adapted into PR #90 and merged into the repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make sure the nametag appear in the bottom right corner of user foreground

3 participants