Skip to content

Commit

Permalink
fix: whiteboard zoom on mweb
Browse files Browse the repository at this point in the history
  • Loading branch information
eswarclynn committed Jan 16, 2024
1 parent f57d331 commit fd5e090
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/react-sdk/src/hooks/useWhiteboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useHMSActions, useHMSStore } from '../primitives/HmsRoomProvider';

const WHITEBOARD_ORIGIN = 'https://whiteboard-qa.100ms.live';

export const useWhiteboard = () => {
export const useWhiteboard = (isMobile = false) => {
const isConnected = useHMSStore(selectIsConnectedToRoom);
const localPeerUserId = useHMSStore(selectLocalPeer)?.customerUserId;
const whiteboard = useHMSStore(selectWhiteboard);
Expand All @@ -30,11 +30,11 @@ export const useWhiteboard = () => {
const url = new URL(WHITEBOARD_ORIGIN);
url.searchParams.set('endpoint', `https://${whiteboard.addr}`);
url.searchParams.set('token', whiteboard.token);
if (isHeadless) {
if (isHeadless || isMobile) {
url.searchParams.set('zoom_to_content', 'true');
}
iframeRef.current.src = url.toString();
}, [whiteboard?.addr, whiteboard?.token, isHeadless]);
}, [whiteboard?.addr, whiteboard?.token, isHeadless, isMobile]);

useEffect(() => {
if (isConnected) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import React, { useEffect, useMemo } from 'react';
import { useMedia } from 'react-use';
import { selectPeers, selectWhiteboard, useHMSStore, useWhiteboard } from '@100mslive/react-sdk';
import { SecondaryTiles } from '../components/SecondaryTiles';
import { ProminenceLayout } from '../components/VideoLayouts/ProminenceLayout';
import { config as cssConfig } from '../../';
import { Box } from '../../Layout';
// @ts-ignore: No implicit Any
import { useSetAppDataByKey } from '../components/AppData/useUISettings';
import { APP_DATA } from '../common/constants';

const EmbedComponent = () => {
const { iframeRef } = useWhiteboard();
const isMobile = useMedia(cssConfig.media.md);
const { iframeRef } = useWhiteboard(isMobile);

return (
<Box
Expand Down

0 comments on commit fd5e090

Please sign in to comment.