Skip to main content

Functions to enable plugins

Enable Plugins

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

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 list and can be accessed from meeting.plugins.active.

The snippet below retrieves the first plugin from the list and activates it.

val plugin: DytePlugin = meeting.plugins.all[0]

plugin.activate()

This directly activates the plugin without any user interaction.

For e.g. you can also show a list of all plugins and activate a plugin on click programmatically.

val plugins: List<DytePlugin> = meeting.plugins.all

plugins.forEach { plugin ->
val button = Button(context)

button.text = "Activate ${plugin.name}"
button.setOnClickListener {
plugin.activate()
}

// Add the button to your view
view.addView(button)
}

Get Plugin View

When a plugin is enabled, the core SDK adds a communication layer between the plugin inside the WebView and itself (meeting object). The getPluginView() method returns a configured WebView of an active plugin, that can be added to a ViewGroup.

val plugin = meeting.plugins.active[0]

plugin.getPluginView() // This will return a WebView

Disable Plugins

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

Deactivate Plugin

The deactivate() method deactivates the plugin for all users in the meeting. When you deactivate a plugin, it moves out of the active plugins list and can only be accessed from meeting.plugins.all.

val plugin = meeting.plugins.active[0]

plugin.deactivate()