Convert Figma logo to code with AI

bilibili logoDanmakuFlameMaster

Android开源弹幕引擎·烈焰弹幕使 ~

9,541
2,105
9,541
259

Top Related Projects

32,488

Android/iOS video player based on FFmpeg n3.4, with MediaCodec, VideoToolbox support.

22,922

HTML5 FLV Player

Quick Overview

DanmakuFlameMaster is an Android library for displaying danmaku (bullet comments) on video players. It provides a high-performance, customizable solution for integrating danmaku functionality into Android applications, particularly for video streaming and playback scenarios.

Pros

  • High performance and efficient rendering, capable of handling large volumes of danmaku
  • Customizable appearance and behavior of danmaku
  • Easy integration with various video players
  • Active development and maintenance by Bilibili, a major video-sharing platform

Cons

  • Limited to Android platform
  • May require additional setup for complex use cases
  • Documentation primarily in Chinese, which may be challenging for non-Chinese speakers
  • Potential learning curve for developers unfamiliar with danmaku systems

Code Examples

  1. Basic danmaku setup:
IDanmakuView mDanmakuView = (IDanmakuView) findViewById(R.id.sv_danmaku);
DanmakuContext mContext = DanmakuContext.create();
mDanmakuView.prepare(parser, mContext);
mDanmakuView.showFPS(true);
mDanmakuView.enableDanmakuDrawingCache(true);
  1. Adding a custom danmaku:
BaseDanmaku danmaku = mContext.mDanmakuFactory.createDanmaku(BaseDanmaku.TYPE_SCROLL_RL);
danmaku.text = "This is a custom danmaku";
danmaku.padding = 5;
danmaku.textSize = 25f * (mParser.getDisplayer().getDensity() - 0.6f);
danmaku.textColor = Color.RED;
danmaku.setTime(mDanmakuView.getCurrentTime() + 1200);
mDanmakuView.addDanmaku(danmaku);
  1. Controlling danmaku playback:
mDanmakuView.start();
mDanmakuView.pause();
mDanmakuView.resume();
mDanmakuView.stop();
mDanmakuView.release();

Getting Started

  1. Add the dependency to your build.gradle:
dependencies {
    implementation 'com.github.ctiao:DanmakuFlameMaster:0.9.25'
    implementation 'com.github.ctiao:ndkbitmap-armv7a:0.9.21'
}
  1. Add the DanmakuView to your layout:
<master.flame.danmaku.ui.widget.DanmakuView
    android:id="@+id/sv_danmaku"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />
  1. Initialize and configure the DanmakuView in your Activity or Fragment:
IDanmakuView mDanmakuView = (IDanmakuView) findViewById(R.id.sv_danmaku);
DanmakuContext mContext = DanmakuContext.create();
mDanmakuView.prepare(parser, mContext);
mDanmakuView.showFPS(true);
mDanmakuView.enableDanmakuDrawingCache(true);
mDanmakuView.start();

Competitor Comparisons

32,488

Android/iOS video player based on FFmpeg n3.4, with MediaCodec, VideoToolbox support.

Pros of ijkplayer

  • Comprehensive multimedia player with support for various formats and protocols
  • Cross-platform compatibility (iOS, Android, macOS)
  • Highly customizable and extensible

Cons of ijkplayer

  • Larger codebase and more complex implementation
  • Steeper learning curve for integration and customization
  • May include unnecessary features for projects only requiring basic video playback

Code Comparison

DanmakuFlameMaster (Java):

mDanmakuView = (IDanmakuView) findViewById(R.id.sv_danmaku);
mDanmakuView.enableDanmakuDrawingCache(true);
mDanmakuView.setCallback(new DrawHandler.Callback() {
    @Override
    public void prepared() {
        mDanmakuView.start();
    }
});

ijkplayer (Java):

IjkMediaPlayer ijkMediaPlayer = new IjkMediaPlayer();
ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "mediacodec", 1);
ijkMediaPlayer.setDataSource(videoPath);
ijkMediaPlayer.prepareAsync();
ijkMediaPlayer.start();

Summary

DanmakuFlameMaster is a specialized library for rendering danmaku (bullet comments) on video players, while ijkplayer is a full-featured multimedia player. ijkplayer offers broader functionality and cross-platform support but comes with increased complexity. DanmakuFlameMaster is more focused and easier to integrate for projects specifically requiring danmaku functionality.

22,922

HTML5 FLV Player

Pros of flv.js

  • Focuses on FLV playback in HTML5, providing a specialized solution for this format
  • Lightweight and easy to integrate into web applications
  • Supports live streaming and video-on-demand (VOD) playback

Cons of flv.js

  • Limited to FLV format, while DanmakuFlameMaster supports multiple video formats
  • Lacks built-in danmaku (bullet comments) functionality, which is a core feature of DanmakuFlameMaster
  • May require additional plugins or libraries for advanced features like subtitles or custom controls

Code Comparison

DanmakuFlameMaster (Java):

DanmakuContext config = DanmakuContext.create();
config.setDanmakuStyle(IDisplayer.DANMAKU_STYLE_STROKEN, 3)
      .setDuplicateMergingEnabled(false)
      .setScrollSpeedFactor(1.2f)
      .setScaleTextSize(1.2f);

flv.js (JavaScript):

var flvPlayer = flvjs.createPlayer({
    type: 'flv',
    url: 'http://example.com/flv/video.flv'
});
flvPlayer.attachMediaElement(videoElement);
flvPlayer.load();

Both libraries provide easy-to-use APIs for their respective functionalities. DanmakuFlameMaster focuses on danmaku rendering and customization, while flv.js emphasizes FLV video playback configuration.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

DanmakuFlameMaster

android上开源弹幕解析绘制引擎项目。Build Status

DFM Inside:

bili

Features

  • 使用多种方式(View/SurfaceView/TextureView)实现高效绘制

  • B站xml弹幕格式解析

  • 基础弹幕精确还原绘制

  • 支持mode7特殊弹幕

  • 多核机型优化,高效的预缓存机制

  • 支持多种显示效果选项实时切换

  • 实时弹幕显示支持

  • 换行弹幕支持/运动弹幕支持

  • 支持自定义字体

  • 支持多种弹幕参数设置

  • 支持多种方式的弹幕屏蔽

TODO:

  • 增加OpenGL ES绘制方式

Download

Download the latest version or grab via Maven:

<dependency>
  <groupId>com.github.ctiao</groupId>
  <artifactId>dfm</artifactId>
  <version>0.9.25</version>
</dependency>

or Gradle:

repositories {
    jcenter()
}

dependencies {
    compile 'com.github.ctiao:DanmakuFlameMaster:0.9.25'
    compile 'com.github.ctiao:ndkbitmap-armv7a:0.9.21'

    # Other ABIs: optional
    compile 'com.github.ctiao:ndkbitmap-armv5:0.9.21'
    compile 'com.github.ctiao:ndkbitmap-x86:0.9.21'
}

Snapshots of the development version are available in Sonatype's snapshots repository.

License

Copyright (C) 2013-2015 Chen Hui <calmer91@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");