Skip to main content

Load Plugins

Overview: How to display plugins inside plugins view.​

To display individual plugin inside App. We will be using component RtkPluginsView

Creating plugin view​

 let viewModel = VideoPeerViewModel(mobileClient: meeting,
participant: meeting.localUser,
showSelfPreviewVideo: false,
showScreenShareVideoView: true)
let pluginView = RtkPluginsView(videoPeerViewModel:viewModel)
self.view.addSubview(pluginView)

Use above code to create instance of RtkPluginsView and add this view to any view of your choice.

Loading pluginView with plugins​

You can get the list of active plugins with the help of below API

let plugins: [RtkPlugin] = self.rtkClient.plugins.active
let arrButtons = [RtkPluginScreenShareTabButton]()

for plugin in plugins {
let button = RtkPluginScreenShareTabButton(image: plugin.picture, title: plugin.name, id: plugin.id)
arrButtons.append(button)
}

To show arrButtons created from above code on the RtkPluginsView, We will be using below API.

self.pluginView.setButtons(buttons: arrButtons, selectedIndex: 0) { [weak self] button, pluginIsClicked in
guard let self = self else {return}
// We are having plugin button tapped by the user.
// So to load this plugin inside PluginsView we need to call this API.
self.pluginView.show(pluginView: button.plugin.getPluginView())
}