Skip to content

How plugins work

Qianze Zhang edited this page Aug 24, 2019 · 4 revisions

How To Develop A Plugin

  1. Create a Xcode project & Visual Studio project, for Mac Plugin and VS Plugin respectively. You may take https://github.com/AgoraIO-Community/Agora-Electron-FaceUnity-Plugin as an example start project. You may alternatively use cmake to configure your own lib project for both platform together.

  2. Create your main Plugin source. The source needs to implement IAVFramePlugin.h interfaces including:

    Video/Audio filter middleware APIs

    API Note
    onPluginCaptureVideoFrame Called with Video data captured by SDK
    onPluginRecordAudioFrame Called wit Audio Data recorded by SDK
    onPluginMixedAudioFrame Called with mixed record and playback Audio Frame
    onPluginPlaybackAudioFrame Called with playback audio frame

    Plugin lifecycle apis

    API Note
    Load Handle your plugin registration, load dependencies
    Unload Handle your plugin unregistration
    Enable Called when this plugin is enabled
    Disable Called when this plugin is disabled
    setParameter Call to pass config parameters as string josn format, plugin is responsible to process the parameters and do corresponding works
    Release Release plugin & cleanup
  3. Build shared libraries, i.e. dylib on macOS and dll on windows. Use registerPlugin api provided by Electron-SDK to load libs into memory, the video/audio frame will start going through your plugin after you initialize and enable your plugin.

Clone this wiki locally