Skip to main content

Functions to enable plugins

Each plugin in meeting.plugins object is of type DytePlugin 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 plugins = meeting.plugins.all.toArray();

plugins.forEach(async (plugin: DytePlugin) => {
const iframe = document.createElement('iframe');
await plugin.addPluginView(iframe);
});

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: DytePlugin) => {
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();