Film
Make MP4 videos from a film page your plugin builds, saved into the plugin's own data folder.
Availability: Webview only (Omniscio.film). There is no ctx.film. Required Permission: film.
Permissions
film is a standard-tier permission. Omniscio shows it to the user as "Make videos: Make MP4 videos from a film it builds, saved only in its own folder. The film cannot reach the internet or read your other files."
{
"permissions": ["film"]
}How the page runs
The page is played in a hidden, sealed window and recorded one frame at a time, so renderFrame(t) must paint the film at t seconds and resolve once it is painted. The window cannot reach the internet, cannot open a popup, and can read only two kinds of file: the page itself, and the assets you list. Both are copied into a private working folder before the page opens, so a page that asks for a path it did not declare gets nothing. Each file keeps its path relative to the page, so a page at films/intro.html that loads <img src="pic.png"> finds the asset you listed as films/pic.png, and a URL that only names a file the page never declared is refused.
The stage you declare must be 1920 x 1080 or 1080 x 1920. The finished video is encoded at that size.
Shape of a job
start() answers at once with a job id and the job's place in the queue. One video is made at a time for a plugin; a second start() from the same plugin while one is running or waiting is refused rather than queued, and films from other plugins wait behind it. Read progress with status(), and stop a job with cancel().
Progress runs 0 to 1: the frames fill it to 0.8, and the share copy is the rest.
Methods
start(request: BridgeFilmStartRequest): Promise<BridgeFilmStartResult>
interface BridgeFilmStartRequest {
page: string // a .html or .htm file, relative to your data folder
assets?: string[] // up to 500 files the page loads, by relative path
audio?: { // up to 8 tracks, .wav or .mp3
path: string
volume?: number // 0 to 4; 1 leaves the track as it is
startSeconds?: number // wait this long before the track starts
}[]
durationSeconds: number // 0.5 to 900
shareMaxBytes: number // at least 1 MB, at most 12 MB
outputDir?: string // a folder inside your data folder, created if missing; defaults to its root
name: string // letters, digits, "-" and "_", up to 64
}The film page must define window.__deckFilm with version: 1, its width and height, duration, fps, ready, renderFrame(t) and soundtrack(). Nothing about it travels over the network.
On success the answer is { ok: true, jobId, queuePosition }. A refusal is { ok: false, reason }, where reason is a sentence a person can read.
status(request: { jobId: string }): Promise<BridgeFilmStatusResult>
type BridgeFilmState =
| 'queued' | 'rendering' | 'encoding' | 'sharing'
| 'done' | 'failed' | 'cancelled'A running answer is { ok: true, state, progress, queuePosition?, files?, reason? }. On done, files names the two videos it saved and their sizes:
[{ name: 'my-film-1080p.mp4', bytes: 41_000_000 },
{ name: 'my-film-share.mp4', bytes: 9_100_000 }]Both names are relative to the plugin's data folder. status() never returns an absolute path.
A job id this plugin does not own reads as { ok: false, reason }.
cancel(request: { jobId: string }): Promise<{ ok: true } | { ok: false, reason }>
Stop a queued or running job. A queued job answers cancelled immediately; a running one is stopped as soon as it can be. Cancelling a job that already finished changes nothing and leaves its files alone.
Saving the full video
files from status() is ready to hand to export.saveDataFile:
const job = await Omniscio.film.start({ page: 'film.html', durationSeconds: 42, shareMaxBytes: 9_000_000, name: 'my-film' })
// ... poll status() until state is 'done'
const full = status.files?.find((file) => file.name.endsWith('-1080p.mp4'))
if (full) await Omniscio.export.saveDataFile({ name: full.name })