Skip to main content

Functions to enable plugins

Each plugin in meeting.plugins object is of type RTKPlugin and exposes the following functions to enable plugins.

Add Plugin View​

This method adds the communication layer between the plugin inside the iframe and the core application (meeting object) in the main window.

const webviewRef = useRef<WebView>();
const plugins = meeting.plugins.all.toArray();

plugins.forEach(async (plugin: RTKPlugin) => {
let iframe = {
src: plugin.baseURL,
allow: 'true',
title: plugin.name,
props: {
onMessage: (_e) => {},
},
postMessage: (_data) => {
if (webviewRef.current) {
(webviewRef.current as WebView).postMessage(_data);
}
},
};
await plugin.addPluginView(iframe);
});

<WebView
ref={webviewRef}
....
/>

Activate Plugins​

The activate() method activates a plugin for all users in the meeting. When you activate a plugin, it moves into the active plugins map and can be accessed from meeting.plugins.active.

The snippet below displays all plugins and activates a plugin on click.

const plugins = meeting.plugins.all.toArray();

plugins.forEach((plugin: RTKPlugin) => {
await plugin.activate();
});

Here is another way you can activate a plugin.

const plugins = meeting.plugins.all.toArray();
const plugin = plugins.find((p) => p.name === 'YouTube');

await plugin?.activate();