Skip to content

Instantly share code, notes, and snippets.

@Tushkiz
Created May 17, 2024 10:10
Show Gist options
  • Save Tushkiz/bd5a94ba272065169fe7a10039c29ee9 to your computer and use it in GitHub Desktop.
Save Tushkiz/bd5a94ba272065169fe7a10039c29ee9 to your computer and use it in GitHub Desktop.
Remove Dyte clock using DyteUIBuilder
import { useEffect, useState } from 'react';
import { useDyteClient } from '@dytesdk/react-web-core';
import { DyteUIBuilder, DyteMeeting } from '@dytesdk/react-ui-kit';
function App() {
const [meeting, initMeeting] = useDyteClient({ resetOnLeave: true });
const [uiConfig, setUiConfig] = useState<any>();
const url = new URL(window.location.href);
const queryToken = url.searchParams.get('authToken');
if (!queryToken) {
alert('Please add authToken to url query params');
}
useEffect(() => {
const start = async () => {
if (!queryToken) return;
await initMeeting({
authToken: queryToken,
defaults: {
video: false,
audio: false,
},
}).then(() => {
const builder = new DyteUIBuilder(uiConfig);
const el = builder.find('div#header-right');
el?.remove('dyte-clock');
setUiConfig(builder.build());
});
};
start();
}, []);
if (meeting) {
return <DyteMeeting meeting={meeting} config={uiConfig} />;
}
return <div>Loading...</div>;
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment