Brussels / 3 & 4 February 2018


Writing a Janus plugin in Lua

C can be a scary world, let us come to the rescue!

Janus is written in C, and so are its plugins. That said, we recently implemented a Janus Lua plugin, that allows developers to use Lua scripts to drive the media/application logic instead.

Janus is a general purpose and modular WebRTC server. It can be easily extended by writing new plugins, whether for new transports for the Janus API, or for handling the media related to a PeerConnection in a custom way. Out of the box, Janus ships several plugins implementing different features (e.g., an SFU, an audio MCU, a SIP gateway, etc.), but developers interested in adding custom functionality can write their own plugins to handle media their own way. That said, Janus is written in C, which means that plugins are typically expected to be written in C as well. This can be an impediment for those not proficient with C as a programming language. As such, we recently released a new Janus plugin that acts as a bridge between the C code and Lua scripts: developers can write their logic in Lua, while leaving the media manipulation and routing to C helper methods that are exposed as Lua functions scripts can take advantage of. This presentation will introduce this plugin, how it works, and how it can be used to write custom logic with different Lua scripts: a couple of real use cases will be presented as a proof of concept.


Photo of Lorenzo Miniero Lorenzo Miniero