Home/docs

Developer documentation

Developer Documentation

liberika is an embeddable playback kernel for cross-platform audio and video apps. This documentation is for engineering teams integrating liberika into their apps and for developers working on the kernel itself. It describes v0.3.8. The project is now named liberika; the erika crate, the erika_* C ABI, and SDK package names stay compatible.

0.3.8 update#

Windows D3D11 screenshots, response validation and stall recovery for HTTP sources, cancellable opens, and faster software-decode uploads and subtitle atlases. Version 0.3.7 added the four Linux packages and Bilibili mode 7 advanced danmaku.

Core, Flutter, Swift SDK and OHPM 0.3.8 are publicly available, and the Web runtime is on npm as @aimessoft/liberika-web, verified on 2026-11-26. There is also a live demo. Release notes

What is new in 0.3.1#

Open at a requested position, receive a natural-ended event, adjust subtitle timing and query the current line. A separate capture includes danmaku, native frame textures can be exported, and OpenHarmony text subtitles are fixed. The original capture still excludes danmaku.

Core and Flutter 0.3.1 are released; as of 2026-10-31 the public Swift SDK and OHPM package remain at 0.3.0. Release notes

0.3.0 upgrade notes#

Default behavior changes: Subtitle and danmaku supersampling is now on by default on native and Web. Native software video decoding now uses FFmpeg multithreading by default. Set ERIKA_VIDEO_DECODE_THREADS=1 to restore single-threaded decoding.

New in 0.3.0: the Web / WASM backend, standalone frame export, diagnostics snapshots, and chapter queries. Version 0.3.0 has been released for Flutter, SwiftPM, and OHPM. See the changelog for the full list of changes.

Integration guide#

Integrate liberika into your app from scratch. Start with the Quick start, then pick the guide that matches your host platform and programming language.

01
Quick startQuickstart
An overview of the main integration paths: prebuilt artifacts, Flutter, SwiftPM, OpenHarmony OHPM, Rust, the C ABI, and Web / WASM.
02
Flutter integrationFlutter Embedding
The official plugin covers seven platforms and provides native video layers, Flutter textures, and compatibility views. Linux x64 / ARM64 offers bundled and system packages; extract the chosen package and set ERIKA_LIBRARY_DIR, or build from source.
03
Swift integrationSwift & Apple
liberika-swift, the native SwiftPM package for macOS, iOS, and tvOS: CAMetalLayer binding, event polling, and lifecycle management.
04
The native OpenHarmony ArkTS SDK: XComponent native surface binding, renderTick frame scheduling, and lifecycle management.
05
Rust integrationRust Embedding
Use Player and PresenterRuntime from the erika crate: open media, subscribe to events, and receive decoded frames through a channel.
06
C ABI integrationC ABI Embedding
Integrate through erika.h. Use ErikaPresenterHandle (recommended) for managed rendering and audio, or ErikaHandle for lightweight headless control.
07
Linux integrationLinux / WSLg
Experimental Linux support: FFmpeg 8, X11 / Wayland, PulseAudio, and Flutter integration. Prebuilt x64 / ARM64 bundles are available in bundled and system modes; source builds remain supported.
08
Web / WASM integrationBrowser Playback
WebCodecs, FFmpeg WASM, libass, and Rust danmaku: local MKV files, subtitle fonts, multiple tracks, chapters, and PNG screenshots.

Kernel design#

The full architecture and core subsystems, from demuxing and hardware decoding to presentation on screen.

09
Crate layering, module breakdown, threading model, and pipeline data flow.
10
VideoToolbox, D3D11VA, MediaCodec, AVCodec, and NVDEC / VA-API decoding, with software fallback.
11
Zero-copy importZero-copy Import
Import decoded frames directly as GPU textures: CVPixelBuffer, DirectX shared handles, AHardwareBuffer, and OHNativeBuffer.
12
Rendering pipelineRender Pipeline
Color conversion, Dolby Vision, tone mapping, and subtitle and danmaku compositing.
13
Output negotiation for Apple EDR, HDR10 PQ, and extended-linear scRGB, plus dynamic headroom adjustment.
14
Neural upscalingNeural Upscaling
ArtCNN anime upscaling, accelerated by Metal SIMDGroup Matrix and wgpu compute.
15
Subtitles and danmakuSubtitle & Danmaku
libass vector-effect subtitle rendering and DFM+, an in-house danmaku layout engine with collision avoidance.
16
Clock and schedulingClock & Scheduling
High-precision audio master clock, ring buffer, VSync-quantized frame scheduling, and adaptive frame dropping.

Project and builds#

Engineering guides for kernel developers and advanced customizers: building, releasing, and contribution conventions.

17
xtask automates C/C++ dependency management, with a cross-compilation matrix for all platforms and local smoke tests.
18
CI pipelines, per-platform prebuilt archives, and version naming conventions.
19
ContributingContributing
Code style, C ABI compatibility guarantees, platform backend conventions, and testing requirements.
20
ChangelogChangelog
Full version history and detailed release notes.

Reference#

A complete index of the exported C ABI functions. erika.h is authoritative for signatures and type definitions.

21
C ABI overviewC ABI Overview
Status code conventions, thread-local error handling, memory ownership, and all basic struct definitions.
22
ErikaHandle referenceErikaHandle Reference
Headless player control, event polling, and shared utility functions.
23
ErikaPresenterHandle referenceErikaPresenterHandle Reference
The full Presenter exports: surface binding, render loop, audio control, danmaku management, and screenshots.
24
JSON bridgeJSON Bridge
The cross-language dynamic bridge protocol built on invoke_json and render_tick_json.