Skip to content

Introduction to adapters: knowing your format

Alexander Cerutti edited this page Mar 11, 2023 · 3 revisions

As we were saying previously, the architecture expects some adapters to be sent to @sub37/server. By doing this way, we can narrow most of the features of a subtitles format to the adapter scope itself. In fact, if some features require getting out of the adapter scope, some changes in the server and in the renderer will be for sure required.

A specific example case of what was reported above is the "metadata cues", a WebVTT feature that (at the moment of writing) is not supported. This feature would require some extension of CueNode or, generally speaking, of the server.

One adapter for one format

Adapters are designed to be single units and, for this reason, they should be used to support only one format per adapter. This is not a strict rule, but as you will see in the next pages, each adapter owns a mime-type. You could technically support several formats under the same mime-type...

but why?

Knowing your format

Of course, building an adapter requires a good knowledge level of the format your want to support so that you can make the adapter evolve. It doesn't matter if the format is a standard one or a private one, you can build an adapter that supports any format you desire.

Adapters should follow a specific set of rules

An adapter, to be considered one by a @sub37/server, should observe some rules. These are described at Adapters Guidelines and rules.