An app that plays your own library has a problem on the first launch: the library is not there yet. A new viewer opens it and sees an empty screen, and an empty screen cannot show what Home, Browse, Up next or a title page look like. So Yonto Player opens on a small demo library, and I want to describe how that library is put together, because the constraints turned out to be more interesting than the screens.
The constraints
The demo has to satisfy a few things at once:
- It has to play real video from the first second, with no setup and no account.
- Everything in it has to be licensed for showing, with the credit the licence asks for.
- It has to look like a real library, so the posters and backdrops matter as much as the files.
- It should exercise the player for real: picking up where you left off, and Up next in a series.
A series needs episodes that feel like episodes, so the demo needs actual films.
Open films
The library lists short open films from the Blender Foundation and its studios: Spring, Coffee Run, Wing It!, Big Buck Bunny and Glass Half, plus the three Caminandes episodes as one series. They are released under Creative Commons Attribution licences, CC BY 3.0 for some and CC BY 4.0 for others.
The licences and credits are taken from each film's own credits and project page. They are listed in the app's open-source licences screen and on the site's licences page.
CC BY asks for attribution, so each title page ends its synopsis with the credit line in the rights holder's own words, then the licence name and address. Here is a simplified sketch of how that line is put together (not the app's exact code):
// Simplified sketch: the credit appended to a title's synopsis. class Credit(val holder: String, val licence: Licence) { fun line() = "$holder · ${licence.label} ${licence.url}" } // Big Buck Bunny's line reads: // (c) copyright 2008, Blender Foundation / www.bigbuckbunny.org · CC BY 3.0 https://creativecommons.org/licenses/by/3.0/ The credit is data, not a translated string. The plot before it is translated into the app's languages, but the credit quotes the rights holder, so it reads the same everywhere.
Whole films, re-encoded
Each film plays from its first frame to its last card. Big Buck Bunny's terms ask that a whole showing keeps the credit roll, and a viewer should get the film anyway. A build check compares every encoded file's length with its source's length and fails if they differ by more than a fraction of a second.
The sources are pinned. A catalogue file names each film's download address and its sha256, and the build stops if the file it fetched is a different one. That means the same input on every machine.
The encode is plain ffmpeg:
- H.264 video up to 1920 pixels wide and stereo AAC audio in an mp4, which the apps play without the software player.
-
-crf 22, capped at 4.5 Mbit/s. - A keyframe every 96 frames, so seeking over the network lands close to where you point.
- One thread per encode, so the bytes are reproducible.
Wider films keep their shape instead of being squeezed to 16:9, and a larger source is scaled down. The manifests record the size, length and hash of every output. A rebuild with the same ffmpeg gives the same bytes, and the check fails if a different ffmpeg gives different ones.
Art cut from the films
Official posters carry logos, and the projects keep their logos out of the Creative Commons licence. So no official poster is used. Instead each poster is a frame from the film itself.
A catalogue entry names the second of the film to take the frame from and how far across the frame to centre the crop. The poster is a 600x900 crop under a shade, with the title set in an open-licensed font and the director, studio and year under it. The backdrop is a 1920x1080 frame with nothing on it, because the apps draw their own scrim under the title.
The lettering is drawn from the font files directly, through Pango pointed at those files alone, never at whatever fonts the machine happens to have. The fonts are pinned by commit and hash like the films are. So the art, like the video, comes out the same on every machine with the same tools.
To pick frames, I make a contact sheet from the source with its real timestamps burned in, then choose from that. The notices describe the art: posters, backdrops and stills are frames of the film, cropped, with our own lettering on the poster.
The demo goes through the usual path
The app's one architectural rule is that the content source is a black box: every source, whether a media server, a plugin or a folder, answers the same few questions about categories, lists, details and search. The demo library answers them too. Here is a simplified sketch of its catalogue, with generic names:
// Simplified sketch: a catalogue that lists categories and details. class Catalogue(private val entries: List<Entry>) { fun categories(): List<Category> = listOf(Category("films", "Films"), Category("series", "Series")) fun detail(id: String): Detail = entries.first { it.id == id }.let { entry -> Detail( title = entry.title, synopsis = entry.synopsis + "\n\n" + entry.credit.line(), poster = "$BASE/${entry.id}.poster.jpg", backdrop = "$BASE/${entry.id}.backdrop.jpg", stream = "$BASE/${entry.id}.mp4", ) } } The titles, categories and filters live in memory. The posters, backdrops and videos are plain files served over HTTPS from the player's own site. Home, Search, Browse and the title page use the same path for the demo as for a library you add yourself, so the screens a new viewer meets are the ones they keep using.
Scripted clips
The demo also lists a category of short clips about adding a source of your own. Those clips, and the setup clip on the website, are produced by scripts rather than by hand.
- Capture scripts drive a device or emulator and record it, with a ring drawn on each tap where the platform does not show one.
- A compose step frames the recording in a device outline, adds a caption per step, and writes an mp4, a webm and a poster.
- The music under them is composed in code: a slow pad in D major with a bell arpeggio and a soft sub, from plain arithmetic with no randomness. It is normalised to -20 LUFS, faded in over 1.5 seconds and out over 2.5, and a check fails the build if a clip's music strays more than 1 LU from that.
Because the captures and the compose step are scripts, a clip can be taken again when a screen changes, and the check confirms the output matches its manifest.
What I take from it
A demo is a feature with its own requirements: licensing, art, size, reproducibility and credit. Routing it through the ordinary source path keeps the demo-specific work in the data and the build. And making every file reproducible, from the video to the lettering to the music, means the whole library can be rebuilt and checked rather than trusted.
