Top Related Projects
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
- 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);
- 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);
- Controlling danmaku playback:
mDanmakuView.start();
mDanmakuView.pause();
mDanmakuView.resume();
mDanmakuView.stop();
mDanmakuView.release();
Getting Started
- 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'
}
- 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" />
- 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
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.
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 designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
DanmakuFlameMaster
androidä¸å¼æºå¼¹å¹è§£æç»å¶å¼æ项ç®ã
DFM Inside:
- libndkbitmap.so(ndk)æºç ï¼https://github.com/Bilibili/NativeBitmapFactory
- å¼å交æµç¾¤ï¼314468823 (å å ¥è¯·æ³¨æDFMå¼å交æµ)
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");
Top Related Projects
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot