Urgent.News

What's breaking now, across thousands of outlets.

Tech

Why I moved a TV app's source contract into JavaScript plugins on QuickJS

Yonto Player talks to a media server, or to a folder, through one interface: ContentSourceAdapter . The rule itself is covered in the opening post of the series. This one is about what sits behind the interface, and how it changed. The short version is that the source contract started out as an HTTP API, moved into the app as JavaScript plugins, and is now the way every Jellyfin, Plex and Emby…

The Jellyfin app originally used an HTTP API to communicate with media servers, but this created issues when media servers changed their data structures. To address this, the contract was kept as JSON, while the transport was made an implementation detail. This allowed the app to use JavaScript plugins instead of Kotlin code. A plugin is a single JavaScript file with a manifest comment and exports functions required by the app, such as getCategories, getMediaList, getMediaDetail and search.

The app provides a global yonto object for making requests, accessing settings and handling errors. Plugins are checked using a command-line tool that runs them against the same contract as the app. QuickJS was chosen as the JavaScript engine for plugins due to its JVM compatibility and ability to be tested on a laptop.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

More from Tuesday 10 November →