-
Notifications
You must be signed in to change notification settings - Fork 4
Add onMyMediaChange event api #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add onMyMediaChange event api #66
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
@blickly can you take a look? |
| 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); | ||
| } | ||
| }); |
There was a problem hiding this comment.
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
| zoomSdk.config({ | ||
| capabilities: [ | ||
| "setVirtualForeground", | ||
| "removeVirtualForeground", | ||
| "onMyMediaChange", | ||
| ] | ||
| }) |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
| const xFactor = videoWidth / 1600; | ||
| const yFactor = videoHeight / 900; |
There was a problem hiding this comment.
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
I made the changes in the following files:
NameTag.css to convenient for my testing
draw_badge_api.ts:
drawCameraSizeChangefunction inside theDrawBadgeApi, it takes the detected width and height as input.drawEverythingToImagetakes the width and height as input and using the scale factors to determine the new axis valuesonMyMediaChangeinside 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.