Other methods
Send data to the plugin
You can send data (type Any
) to a plugin using the sendData()
method.
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 RtkPluginsEventListener
interface. This method comes in handy when building your own plugin. The RtkPluginsEventListener
interface also offers other callbacks as given below:
val pluginsEventListener = object : RtkPluginsEventListener {
override fun onPluginActivated(plugin: RtkPlugin) {
}
override fun onPluginDeactivated(plugin: RtkPlugin) {
}
override onPluginMessage(plugin: RtkPlugin, eventName: String, data: Any?) {
}
override onPluginFileRequest(plugin: RtkPlugin) {
}
}
meeting.addPluginsEventListener(pluginsEventListener)
Upload file to a plugin
You can upload a file to a plugin that supports file uploads using the uploadFile()
method.
val pluginId = '';
val plugin = meeting.plugins.active.firstOrNull { it.id == pluginId }
plugin?.let { p ->
p.uploadFile(
RtkPluginFile(
resultCode = 1,
data = Intent() // Intent with the file data
)
)
}