Created
February 1, 2024 12:29
-
-
Save Tushkiz/73453c7b65c45033c7c71c8072bb9435 to your computer and use it in GitHub Desktop.
Revisions
-
Tushkiz created this gist
Feb 1, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,48 @@ import { useEffect, useState } from 'react'; import { useDyteClient } from '@dytesdk/react-web-core'; import { DyteMeeting, DyteUIBuilder, generateConfig } from '@dytesdk/react-ui-kit'; type UIConfig = ReturnType<typeof generateConfig>['config']; function DisableControlsAddonApp() { const [meeting, initMeeting] = useDyteClient(); const [uiConfig, setUIConfig] = useState<UIConfig>(); 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 init = async () => { initMeeting({ defaults: { audio: true, video: true }, authToken: queryToken, }).then((meet) => { if (!meet) { console.log('failed to initialize meeting'); return; } const config = generateConfig(meet.self.suggestedTheme, meet).config; const builder = new DyteUIBuilder(config); const componentsToDisable = ['dyte-mic-toggle', 'dyte-camera-toggle']; componentsToDisable.forEach((component) => { builder.find('div#setupcontrols-media')?.remove(component); builder.find('div#controlbar-center')?.remove(component); builder.find('div#controlbar-mobile')?.remove(component); }); setUIConfig(builder.build()); }); }; init(); }, []); if (!meeting) { return <div>Loading...</div>; } return <DyteMeeting meeting={meeting} config={uiConfig} />; } export default DisableControlsAddonApp;