Other methods
Send data to the plugin
You can send data (type any
) to a plugin using the sendData()
method. This method comes in handy when building your own plugin.
val pluginId = '...';
val plugin = meeting.plugins.active.firstOrNull { it.id == pluginId }
plugin?.let { p ->
p.sendData(
eventName = "my-custom-event",
data = "Hello world"
)
}
Listening to plugin events
You can receive data from a plugin by implementing the onPluginMessage()
method defined in DytePluginEventsListener
interface. This method comes in handy when building your own plugin.
val pluginEventListener = object : DytePluginEventsListener {
override fun onPluginActivated(plugim: DytePlugin) {
...
}
override fun onPluginDeactivated(plugin: DytePlugin) {
...
}
override onPluginMessage(plugin: DytePlugin, eventName: String, data: Any?) {
...
}
override onPluginFileRequest(plugin: DytePlugin) {
...
}
}
meeting.addPluginEventsListener(pluginEventListener)
Upload file to a plugin
You can upload a file to a plugin that supports file uploads using the uploadFile()
method. This method comes in handy when
building your own plugin.
val pluginId = '...';
val plugin = meeting.plugins.active.firstOrNull { it.id == pluginId }
plugin?.let { p ->
p.uploadFile(
DytePluginFile(
resultCode = 1,
data = Intent() // Intent with the file data
)
)
}