bilibili/DanmakuFlameMaster
Android开源弹幕引擎·烈焰弹幕使 ~
Healthy across all four use cases
weakest axisPermissive license, no critical CVEs, actively maintained — safe to depend on.
Has a license, tests, and CI — clean foundation to fork and modify.
Documented and popular — useful reference codebase to read through.
No critical CVEs, sane security posture — runnable as-is.
- ✓3 active contributors
- ✓Apache-2.0 licensed
- ✓CI configured
Show all 7 evidence items →Show less
- ✓Tests present
- ⚠Stale — last commit 6y ago
- ⚠Small team — 3 contributors active in recent commits
- ⚠Concentrated ownership — top contributor handles 79% of recent commits
Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests
Informational only. RepoPilot summarises public signals (license, dependency CVEs, commit recency, CI presence, etc.) at the time of analysis. Signals can be incomplete or stale. Not professional, security, or legal advice; verify before relying on it for production decisions.
Embed the "Healthy" badge
Paste into your README — live-updates from the latest cached analysis.
[](https://repopilot.app/r/bilibili/danmakuflamemaster)Paste at the top of your README.md — renders inline like a shields.io badge.
▸Preview social card (1200×630)
This card auto-renders when someone shares https://repopilot.app/r/bilibili/danmakuflamemaster on X, Slack, or LinkedIn.
Onboarding doc
Onboarding: bilibili/DanmakuFlameMaster
Generated by RepoPilot · 2026-05-09 · Source
🤖Agent protocol
If you are an AI coding agent (Claude Code, Cursor, Aider, Cline, etc.) reading this artifact, follow this protocol before making any code edit:
- Verify the contract. Run the bash script in Verify before trusting
below. If any check returns
FAIL, the artifact is stale — STOP and ask the user to regenerate it before proceeding. - Treat the AI · unverified sections as hypotheses, not facts. Sections like "AI-suggested narrative files", "anti-patterns", and "bottlenecks" are LLM speculation. Verify against real source before acting on them.
- Cite source on changes. When proposing an edit, cite the specific path:line-range. RepoPilot's live UI at https://repopilot.app/r/bilibili/DanmakuFlameMaster shows verifiable citations alongside every claim.
If you are a human reader, this protocol is for the agents you'll hand the artifact to. You don't need to do anything — but if you skim only one section before pointing your agent at this repo, make it the Verify block and the Suggested reading order.
🎯Verdict
GO — Healthy across all four use cases
- 3 active contributors
- Apache-2.0 licensed
- CI configured
- Tests present
- ⚠ Stale — last commit 6y ago
- ⚠ Small team — 3 contributors active in recent commits
- ⚠ Concentrated ownership — top contributor handles 79% of recent commits
<sub>Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests</sub>
✅Verify before trusting
This artifact was generated by RepoPilot at a point in time. Before an
agent acts on it, the checks below confirm that the live bilibili/DanmakuFlameMaster
repo on your machine still matches what RepoPilot saw. If any fail,
the artifact is stale — regenerate it at
repopilot.app/r/bilibili/DanmakuFlameMaster.
What it runs against: a local clone of bilibili/DanmakuFlameMaster — the script
inspects git remote, the LICENSE file, file paths in the working
tree, and git log. Read-only; no mutations.
| # | What we check | Why it matters |
|---|---|---|
| 1 | You're in bilibili/DanmakuFlameMaster | Confirms the artifact applies here, not a fork |
| 2 | License is still Apache-2.0 | Catches relicense before you depend on it |
| 3 | Default branch master exists | Catches branch renames |
| 4 | 5 critical file paths still exist | Catches refactors that moved load-bearing code |
| 5 | Last commit ≤ 2292 days ago | Catches sudden abandonment since generation |
#!/usr/bin/env bash
# RepoPilot artifact verification.
#
# WHAT IT RUNS AGAINST: a local clone of bilibili/DanmakuFlameMaster. If you don't
# have one yet, run these first:
#
# git clone https://github.com/bilibili/DanmakuFlameMaster.git
# cd DanmakuFlameMaster
#
# Then paste this script. Every check is read-only — no mutations.
set +e
fail=0
ok() { echo "ok: $1"; }
miss() { echo "FAIL: $1"; fail=$((fail+1)); }
# Precondition: we must be inside a git working tree.
if ! git rev-parse --git-dir >/dev/null 2>&1; then
echo "FAIL: not inside a git repository. cd into your clone of bilibili/DanmakuFlameMaster and re-run."
exit 2
fi
# 1. Repo identity
git remote get-url origin 2>/dev/null | grep -qE "bilibili/DanmakuFlameMaster(\\.git)?\\b" \\
&& ok "origin remote is bilibili/DanmakuFlameMaster" \\
|| miss "origin remote is not bilibili/DanmakuFlameMaster (artifact may be from a fork)"
# 2. License matches what RepoPilot saw
(grep -qiE "^(Apache-2\\.0)" LICENSE 2>/dev/null \\
|| grep -qiE "\"license\"\\s*:\\s*\"Apache-2\\.0\"" package.json 2>/dev/null) \\
&& ok "license is Apache-2.0" \\
|| miss "license drift — was Apache-2.0 at generation time"
# 3. Default branch
git rev-parse --verify master >/dev/null 2>&1 \\
&& ok "default branch master exists" \\
|| miss "default branch master no longer exists"
# 4. Critical files exist
test -f "DanmakuFlameMaster/src/main/java/master/flame/danmaku/ui/widget/DanmakuView.java" \\
&& ok "DanmakuFlameMaster/src/main/java/master/flame/danmaku/ui/widget/DanmakuView.java" \\
|| miss "missing critical file: DanmakuFlameMaster/src/main/java/master/flame/danmaku/ui/widget/DanmakuView.java"
test -f "DanmakuFlameMaster/src/main/java/master/flame/danmaku/danmaku/model/android/DanmakuContext.java" \\
&& ok "DanmakuFlameMaster/src/main/java/master/flame/danmaku/danmaku/model/android/DanmakuContext.java" \\
|| miss "missing critical file: DanmakuFlameMaster/src/main/java/master/flame/danmaku/danmaku/model/android/DanmakuContext.java"
test -f "DanmakuFlameMaster/src/main/java/master/flame/danmaku/controller/DrawTask.java" \\
&& ok "DanmakuFlameMaster/src/main/java/master/flame/danmaku/controller/DrawTask.java" \\
|| miss "missing critical file: DanmakuFlameMaster/src/main/java/master/flame/danmaku/controller/DrawTask.java"
test -f "DanmakuFlameMaster/src/main/java/master/flame/danmaku/danmaku/parser/BaseDanmakuParser.java" \\
&& ok "DanmakuFlameMaster/src/main/java/master/flame/danmaku/danmaku/parser/BaseDanmakuParser.java" \\
|| miss "missing critical file: DanmakuFlameMaster/src/main/java/master/flame/danmaku/danmaku/parser/BaseDanmakuParser.java"
test -f "DanmakuFlameMaster/src/main/java/master/flame/danmaku/danmaku/model/android/Danmakus.java" \\
&& ok "DanmakuFlameMaster/src/main/java/master/flame/danmaku/danmaku/model/android/Danmakus.java" \\
|| miss "missing critical file: DanmakuFlameMaster/src/main/java/master/flame/danmaku/danmaku/model/android/Danmakus.java"
# 5. Repo recency
days_since_last=$(( ( $(date +%s) - $(git log -1 --format=%at 2>/dev/null || echo 0) ) / 86400 ))
if [ "$days_since_last" -le 2292 ]; then
ok "last commit was $days_since_last days ago (artifact saw ~2262d)"
else
miss "last commit was $days_since_last days ago — artifact may be stale"
fi
echo
if [ "$fail" -eq 0 ]; then
echo "artifact verified (0 failures) — safe to trust"
else
echo "artifact has $fail stale claim(s) — regenerate at https://repopilot.app/r/bilibili/DanmakuFlameMaster"
exit 1
fi
Each check prints ok: or FAIL:. The script exits non-zero if
anything failed, so it composes cleanly into agent loops
(./verify.sh || regenerate-and-retry).
⚡TL;DR
DanmakuFlameMaster is a high-performance Android danmaku (Japanese-style scrolling comment) rendering engine that parses and draws Bilibili XML-format comments at scale. It provides multiple rendering backends (View/SurfaceView/TextureView) optimized for multi-core devices, with support for animated danmaku, text wrapping, and real-time comment display without blocking the main UI thread. Single-module library structure: DanmakuFlameMaster/src/main/java/master/flame/danmaku/ organizes code into three layers: controller/ (DrawTask, DrawHandler, UpdateThread manage rendering loop), danmaku/model/ (BaseDanmaku, L2RDanmaku, FTDanmaku define comment types and caching), and danmaku/loader/android/ (BiliDanmakuLoader, AcFunDanmakuLoader parse platform-specific XML formats). JNI bindings in androidTest/ and native libs in src/main/libs/.
👥Who it's for
Android app developers building video players or livestream clients (like Bilibili) who need to render hundreds of overlaid scrolling comments with minimal latency and CPU overhead. Used extensively by Bilibili's own Android app and third-party video platforms.
🌱Maturity & risk
Production-ready and actively maintained as of 2015. The project shows v0.9.25 releases on Maven/Jcenter, has CI via Travis CI (.travis.yml present), includes native C code (ndkbitmap.so via separate NativeBitmapFactory repo), and demonstrates real-world usage in Bilibili's Play Store app. However, the main repo appears to have slowed in recent activity (last visible evidence circa 2015).
Low dependency footprint (pure Android SDK) reduces supply-chain risk, but the project is aging—last significant updates appear pre-2016, which may cause compatibility issues with modern Android (currently targets SDK 25). Native JNI code (libndkbitmap.so) adds maintenance burden for ARM/x86 architecture support. Single maintainer (Chen Hui) with no evidence of active issue triage or recent PRs.
Active areas of work
No active development visible in provided snapshot. Project appears stable/archived. Latest version (0.9.25) on Maven suggests no breaking changes expected, but no evidence of open PRs, milestones, or ongoing feature work.
🚀Get running
Clone: git clone https://github.com/bilibili/DanmakuFlameMaster.git. Install: cd DanmakuFlameMaster && ./gradlew build (Gradle wrapper required). Consume as library: add to build.gradle: dependencies { implementation 'com.github.ctiao:DanmakuFlameMaster:0.9.25' } and implementation 'com.github.ctiao:ndkbitmap-armv7a:0.9.21' for native bitmap rendering.
Daily commands:
Not a runnable app—library only. To test: ./gradlew androidTest runs NativeBitmapFactoryTest in src/androidTest/java/tv/cjump/jni/. To integrate: create an Android Activity implementing IDanmakuView, instantiate DanmakuController, call showDanmaku(baseDanmaku) in a loop.
🗺️Map of the codebase
DanmakuFlameMaster/src/main/java/master/flame/danmaku/ui/widget/DanmakuView.java— Primary UI entry point for danmaku rendering; all integrations start hereDanmakuFlameMaster/src/main/java/master/flame/danmaku/danmaku/model/android/DanmakuContext.java— Core configuration holder for danmaku display parameters and rendering optionsDanmakuFlameMaster/src/main/java/master/flame/danmaku/controller/DrawTask.java— Main rendering loop executor; orchestrates frame-by-frame danmaku drawingDanmakuFlameMaster/src/main/java/master/flame/danmaku/danmaku/parser/BaseDanmakuParser.java— Abstract parser for all danmaku formats; subclassed by Bili/AcFun implementationsDanmakuFlameMaster/src/main/java/master/flame/danmaku/danmaku/model/android/Danmakus.java— Data structure managing danmaku collection with iteration and filtering logicDanmakuFlameMaster/src/main/java/master/flame/danmaku/danmaku/renderer/android/DanmakuRenderer.java— Implements rendering pipeline for converting danmaku models to canvas outputDanmakuFlameMaster/src/main/java/master/flame/danmaku/danmaku/model/android/DrawingCache.java— Cache layer for pre-rendered danmaku to avoid redundant text layout calculations
🛠️How to make changes
Add Support for a New Danmaku Format
- Create a new loader class extending BaseDanmakuParser in the parser package (
DanmakuFlameMaster/src/main/java/master/flame/danmaku/danmaku/parser/BaseDanmakuParser.java) - Implement XML/JSON parsing logic following BiliDanmakuLoader pattern (
DanmakuFlameMaster/src/main/java/master/flame/danmaku/danmaku/loader/android/BiliDanmakuLoader.java) - Register your loader in DanmakuLoaderFactory.createLoader() (
DanmakuFlameMaster/src/main/java/master/flame/danmaku/danmaku/loader/android/DanmakuLoaderFactory.java) - Use DanmakuFactory to convert parsed data to Danmaku model objects (
DanmakuFlameMaster/src/main/java/master/flame/danmaku/danmaku/model/android/DanmakuFactory.java)
Add Custom Danmaku Type or Rendering Effect
- Create a new model class extending BaseDanmaku or one of R2LDanmaku/FBDanmaku/FTDanmaku (
DanmakuFlameMaster/src/main/java/master/flame/danmaku/danmaku/model/BaseDanmaku.java) - Define rendering properties (duration, path, animation) in your model (
DanmakuFlameMaster/src/main/java/master/flame/danmaku/danmaku/model/SpecialDanmaku.java) - Implement custom paint logic in DanmakuRenderer.drawDanmaku() (
DanmakuFlameMaster/src/main/java/master/flame/danmaku/danmaku/renderer/android/DanmakuRenderer.java) - Configure cache stuffer if custom rendering uses text/views (
DanmakuFlameMaster/src/main/java/master/flame/danmaku/danmaku/model/android/BaseCacheStuffer.java)
Integrate Danmaku into an Android Activity
- Add DanmakuView, DanmakuSurfaceView, or DanmakuTextureView to your layout (
DanmakuFlameMaster/src/main/java/master/flame/danmaku/ui/widget/DanmakuView.java) - Create DanmakuContext with desired font, size, speed, and color settings (
DanmakuFlameMaster/src/main/java/master/flame/danmaku/danmaku/model/android/DanmakuContext.java) - Load danmaku data using DanmakuLoaderFactory or custom parser (
DanmakuFlameMaster/src)
🪤Traps & gotchas
Native library requirement: builds require NDK and pre-built libndkbitmap.so from separate NativeBitmapFactory repo—missing .so files cause silent bitmap rendering failures. Android SDK 25 assumption: minSdkVersion 9 stated but targets SDK 25; untested on modern Android (30+). Thread safety: UpdateThread and DrawTask run asynchronously—danmaku object state can race; mutations must go through synchronous DanmakuController methods. Memory leaks: IDrawingCache bitmaps not always released if exception occurs mid-draw; review try-finally in DrawTask. XML parsing fragility: BiliDanmakuLoader assumes precise Bilibili XML schema; malformed danmaku files cause silent drops without error logging.
💡Concepts to learn
- Draw command buffering / render task queue — DrawTask batches danmaku positioning/rendering commands to avoid per-frame allocation and thrashing the main Android UI thread; core to the 'flame' (high-throughput) design
- Spatial indexing / on-screen culling — IDanmakus collection avoids iterating 1000+ queued danmaku each frame—indexes by row/y-coordinate to only draw visible comments, crucial for 60fps at scale
- Bitmap caching / glyph pre-rasterization — CacheManagingDrawTask converts text to bitmaps once, reuses them across frames; avoids expensive Paint.measureText/Canvas.drawText in hot loop
- JNI native bitmap blitting — libndkbitmap.so provides native memcpy-based pixel operations faster than Java Canvas for alpha-blended comment overlays; Android lacks exposed GPU blit calls in API 9-25
- XML schema parsing with type inference — BiliDanmakuLoader/AcFunDanmakuLoader extract danmaku properties (mode, color, size, lifetime) from platform-specific XML; requires robustness against malformed/missing fields
- Multi-threaded synchronization with timer-based state — UpdateThread and DrawTask coordinate via DanmakuTimer (elapsed time) rather than blocking locks; enables decoupled update/render rates and smooth playback scrubbing
- SurfaceView/TextureView dual rendering modes — Library supports both Android View (main thread canvas) and offscreen Surface (background thread) rendering; SurfaceView cheaper but TextureView allows transformations (rotation, scaling) without redraw
🔗Related repos
bilibili/NativeBitmapFactory— Companion JNI library providing libndkbitmap.so for native bitmap rendering—required dependency for efficient glyph rasterizationctiao/DanmakuFlameMaster— Original author's fork (Chen Hui); reference for v0.9.25+ development if upstream stallsyangchong211/YCDanmaku— Modern alternative danmaku engine for Android with similar feature set; useful for comparing architectural decisions post-2015zzhold/xcDanmaku— Lightweight danmaku library; smaller footprint if you only need text scrolling without media renderingandroid/AndroidX— Ecosystem dependency—DanmakuFlameMaster uses legacy android.app, android.view APIs; may need migration for modern support library compat
🪄PR ideas
To work on one of these in Claude Code or Cursor, paste:
Implement the "<title>" PR idea from CLAUDE.md, working through the checklist as the task list.
Add comprehensive unit tests for DanmakuContext and DanmakuFactory
The core model classes in src/main/java/master/flame/danmaku/danmaku/model/android/ (DanmakuContext.java, DanmakuFactory.java, Danmakus.java) lack test coverage. Only NativeBitmapFactoryTest.java exists in androidTest. Adding unit tests for these factories and context management would improve reliability of danmaku creation and lifecycle management, which is critical for the rendering pipeline.
- [ ] Create src/androidTest/java/master/flame/danmaku/model/DanmakuContextTest.java to test context initialization, configuration, and state management
- [ ] Create src/androidTest/java/master/flame/danmaku/model/DanmakuFactoryTest.java to test danmaku object creation for different types (L2RDanmaku, R2LDanmaku, FBDanmaku, FTDanmaku)
- [ ] Create src/androidTest/java/master/flame/danmaku/model/DanmakusTest.java to test collection operations, iteration, and caching behavior
- [ ] Add tests for edge cases like null inputs, capacity limits, and concurrent access patterns
Add GitHub Actions CI workflow to replace Travis CI
The project uses .travis.yml for CI (referenced in README), but this is outdated. GitHub Actions is now standard for GitHub-hosted projects. A modern workflow would provide faster, more reliable builds with native GitHub integration and better visibility of Android-specific build issues (gradle, SDK versions, NDK compilation).
- [ ] Create .github/workflows/android-build.yml with steps to: checkout code, setup JDK 8+, install Android SDK/NDK, run './gradlew build' and './gradlew androidTest'
- [ ] Configure the workflow to run on push and pull_request events for all branches
- [ ] Add caching for gradle dependencies (.gradle directory) to speed up builds
- [ ] Update README.md to reference the new GitHub Actions badge instead of Travis CI badge
Add integration tests for danmaku loading and filtering pipeline
The loader classes (BiliDanmakuLoader.java, AcFunDanmakuLoader.java) and DanmakuFilters.java are critical for parsing and filtering danmaku, but have no test coverage. Integration tests would validate the end-to-end flow from XML parsing through filtering to rendering, catching format regressions early.
- [ ] Create src/androidTest/java/master/flame/danmaku/loader/DanmakuLoaderTest.java with sample XML fixture files (Bilibili and AcFun formats) in src/androidTest/assets/
- [ ] Test BiliDanmakuLoader parsing various danmaku types (scroll, bottom, top, special mode7) from real-world XML samples
- [ ] Create src/androidTest/java/master/flame/danmaku/controller/DanmakuFiltersTest.java to test filtering logic (by type, by text, by user)
- [ ] Add tests verifying that loader output correctly initializes Danmaku objects with position, duration, and display properties
🌿Good first issues
- Add JUnit test coverage for DanmakuFilters.java—currently no unit tests visible; create tests for text/user/regex filtering logic in src/androidTest/java
- Implement missing OpenGL ES rendering backend mentioned in TODO—create GLDrawTask implementing IDrawTask to test compat with View/SurfaceView/TextureView backends
- Add support for AcFun danmaku format parity with Bilibili—AcFunDanmakuLoader exists but no integration tests; add test cases in androidTest/ to ensure feature/timecode/color fields parse correctly
⭐Top contributors
Click to expand
Top contributors
- @ctiao — 79 commits
- @ChenSiLiang — 11 commits
- @succlz123 — 10 commits
📝Recent commits
Click to expand
Recent commits
e284646— v0.9.25 (ctiao)744e8f5— CacheManagingDrawTask: set remeasure|invalidate flag in invalidateDanmaku(..) (ctiao)52754e2— v0.9.24 (ctiao)54592ea— CacheManagingDrawTask.CacheManager: remove all messages of Handler in end() (ctiao)26e42e6— build.gradle: add google() in repositories (ctiao)fdc84ed— gradle: downgrade sdkVersion to 25 (ctiao)317a997— gradle: add new maven repo of Google (ctiao)8a9df41— Update .travis.yml (ctiao)892d263— v0.9.21 (ctiao)b413f46— gradle: upgrade version && targetSdkVersion && compileSdkVersion (ctiao)
🔒Security observations
- High · Outdated Compile SDK Version —
DanmakuFlameMaster/build.gradle. The project uses compileSdkVersion 25 (Android 7.1.1, released 2016) and buildToolsVersion 26.0.2. These are significantly outdated and lack security patches from recent Android versions. Current standard is API 34+. Fix: Update compileSdkVersion to at least 34 (Android 14) and buildToolsVersion to the latest available version (currently 34.x.x). This ensures access to the latest security patches and security features. - High · Low Minimum SDK Version —
DanmakuFlameMaster/build.gradle. The project targets minSdkVersion 9 (Android 2.3, released 2010). This is an extremely old API level that has not received security updates in over a decade. Supporting such old versions exposes users to numerous known vulnerabilities. Fix: Increase minSdkVersion to at least 21 (Android 5.0) or higher. This allows the application to use modern Android security features and removes support for obsolete, unpatched operating systems. - High · Outdated Java Compilation Target —
DanmakuFlameMaster/build.gradle (compileOptions section). The project uses Java 1.7 (released 2011) as both source and target compatibility. Java 7 reached end of life in July 2019 and no longer receives security updates. Fix: Update sourceCompatibility and targetCompatibility to at least JavaVersion.VERSION_1_8 or higher (ideally VERSION_11 or above). This enables access to modern Java security features and bug fixes. - Medium · Native Library Integration Without Verification —
DanmakuFlameMaster/src/main/libs and NativeBitmapFactory dependency. The project includes native JNI libraries (libndkbitmap.so) and references external native code from https://github.com/Bilibili/NativeBitmapFactory. There is no indication of code signing verification, checksum validation, or security review of these native libraries. Fix: Implement integrity verification for native libraries (e.g., checksum validation). Conduct security audits of native code. Consider pinning specific versions and verifying their authenticity. Document the security review process for native dependencies. - Medium · No Explicit Permissions Validation —
DanmakuFlameMaster/src/main/AndroidManifest.xml. The AndroidManifest.xml file is present but not included in the analysis. Given the project's nature (video playback with file I/O), permissions handling should be explicitly validated for the principle of least privilege. Fix: Review and document all requested permissions. Ensure runtime permission handling for Android 6.0+ (API 23+). Request only necessary permissions and implement proper permission checking before accessing sensitive resources. - Medium · Potential XXE Vulnerability in XML Parsing —
DanmakuFlameMaster/src/main/java/master/flame/danmaku/danmaku/loader/android/BiliDanmakuLoader.java. The project parses Bilibili XML danmaku format (BiliDanmakuLoader.java). If XML parsing is not configured securely, it may be vulnerable to XML External Entity (XXE) attacks. Fix: Disable XML external entity processing in all XML parsers. Use SAXParserFactory with: factory.setFeature('http://apache.org/xml/features/disallow-doctype-decl', true); factory.setFeature('http://xml.org/sax/features/external-general-entities', false); factory.setFeature('http://xml.org/sax/features/external-parameter-entities', false); - Low · Missing ProGuard/R8 Configuration —
DanmakuFlameMaster/build.gradle. No build.gradle configuration visible for ProGuard/R8 obfuscation. This makes reverse engineering easier and may expose sensitive code logic. Fix: Add ProGuard/R8 configuration with appropriate rules. Enable minification for release builds: buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.
LLM-derived; treat as a starting point, not a security audit.
👉Where to read next
- Open issues — current backlog
- Recent PRs — what's actively shipping
- Source on GitHub
Generated by RepoPilot. Verdict based on maintenance signals — see the live page for receipts. Re-run on a new commit to refresh.