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 DytePluginsView

Creating plugin view

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

Use above code to create instance of DytePluginsView 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: [DytePlugin] = self.dyteMobileClient.plugins.active
let arrButtons = [DytePluginScreenShareTabButton]()

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

To show arrButtons created from above code on the DytePluginsView, 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())
}