The first comment to my article about
the IPTV head station was “I would like to hear more about middleware. What is it like, how does it work? ” Well, I'll try.

Middleware is a server software for managing all components of the IPTV complex, it is a
key component, since it is the face of the whole system — the user interface (in IPTV it is usually called the “Subscriber Portal”).
Subscriber Portal
STB
Set-Top-Box - subscriber device consists of two main software parts: player and browser. The bottom layer is always a video player, and above it is a translucent browser that works with Middleware.
')
When loading, STB sends its identification data (this can be MAC address, username / password, serial number) to the Middleware server address that is stored in memory or received via the network, which already in turn loads the portal or offers to load.
Usually, the browser using JavaScript transmits commands from Middleware to the internal video player API (channel address, volume, audio track switching) along the way displaying the channel name, television program, sound level, and so on.
PC
Fundamentally, the PC-interface does not differ from the STB-version, it is just sharpened to control with a mouse.
Other applications
Middleware provides a programming interface (API) for any other applications. You can write a client for Android / iOS, which will not load the web portal, but will only display the necessary information in a native application, which saves traffic and speeds up the interface.
Widgets
This element requests data from news resources, social networks, etc., and provides them to the user in a convenient form for reading from the TV screen. Here, Middleware acts as a proxy server for STB (which do not have direct access to the Internet).
The providers themselves can add functionality, for example, by creating a version of the personal account for the console, where you can see the status of services, the phone number of the technical support, the “promised payment” button, the change of the tariff plan, etc.
Other systems
CAS
To access paid content encrypted by the provider, the CAS client in the STB player must contact the CAS server to obtain access keys. Middleware controls access of consoles to the CAS-server by transferring to it a list of devices and TV channels available on this device, according to its tariff plan.
Conditional Access System (conditional access system) is a hardware-software mechanism for accessing paid coded digital satellite, terrestrial and cable TV channels and radio stations (radio channels).
VOD
The MW (Middleware) database stores movie titles, descriptions, posters, actor's list, etc., for display on the subscriber portal. She also keeps the path to the file on the video server, to give it to the client if he decides to watch the movie.
EPG
This module downloads a TV program for TV channels from various sources and stores it in its database for display on client devices and for other internal services, for example, nPVR.
nPVR
MW plans to record TV channels on a video server according to the TV program, which allows users to schedule the recording of TV programs, as well as pause the current program.
When the subscriber pauses viewing, the set-top box automatically switches to the RTSP stream and waits for a command from the subscriber to continue viewing.
Recorded MW shows in the subscriber portal menu and automatically deletes from the video server after a certain time to save space.
Billing
Billing informs Middleware about new customers, transfers the status of services, connects and removes TV packages.
MW reports billing on VOD purchases.
Middleware delegates billing management of clients through a software interface, and it can also manage clients.
Core
The kernel manages and monitors all the processes that I described above, collecting the statistics necessary for managers and marketers, provides a single administrative interface for managing tariff plans, TV channels, VOD, EPG, customers.
Stops data in a cache to reduce the load on the database. Monitors the work of all components. This is where the magic happens, understandable only to developers.
Conclusion
Unfortunately, I don’t know any fully open Middleware, so that we can consider its work under the hood, and the review of paid Middleware will be either advertising or disclosure of secrets.
What topics IPTV is not yet disclosed on Habré? Should I try to review commercial middleware?