一款利用游戏引擎理念打造的原生弹幕库

Overview

license Platform

AkDanmaku

简介

灵感来源于 AcFun 视频弹幕场景,基于游戏引擎架构思想打造的一款 Android Native 弹幕引擎。
主要针对移动平台视频(直播)播放中的弹幕场景提供包含弹幕流程与数据处理、弹幕展现以及特效处理等功能的全场景解决方案。

主要功能

  • 基于 libGDX - 跨平台 Java 游戏开发框架和 ECS 架构实现 Android Native 图形处理框架,提供上层的弹幕 UI 和动效处理等能力。
  • 多线程调度模型,将渲染、逻辑处理分离,保证性能。
  • 具备缓存机制,提升性能和空间利用率
  • 支持基本的弹幕处理和显示能力、倍速播放等
  • 支持弹幕悬停等交互响应操作
  • 支持丰富弹幕的文本样式,以及自定义样式扩展
  • 支持丰富的运动动画效果

Demo 展示

设计思想

开源弹幕库 AkDanmaku

使用指南

AkDanmaku 接入指南

License

AkDanmaku 以 MIT 证书开源,详情参见 LICENSE

版本历史

具体版本历史请参看 CHANGELOG.md

参与贡献

如果你有兴趣参与贡献,可以参考 CONTRIBUTING.md

问题 & 反馈

欢迎提 issues 提问反馈。

联系我们

项目负责人
Changyi

项目核心成员
Changyi
Xana

You might also like...
Comments
  • 生成的用户头像不能针对每条弹幕单独定制吗?怎么都是整体设置的

    生成的用户头像不能针对每条弹幕单独定制吗?怎么都是整体设置的

    private val renderer by lazy { TypedDanmakuRenderer( simpleRenderer, DanmakuItemData.DANMAKU_STYLE_USER_AVATAR to UpLogoRenderer( ResourcesCompat.getDrawable(resources, R.drawable.icon_danmaku_input_text_up_icon, theme)!! ) ) } 相当于这个DanmaPlayer都得用这个user_avatar,不是应该不同的弹幕各自设置自己的icon吗? 每次自己发送弹幕时,设置的danmakuStyle使用的icon都是事先设置好的

    opened by HpBoss 2
  • RenderSystem中得到的弹幕集合顺序有问题(亲身验证)

    RenderSystem中得到的弹幕集合顺序有问题(亲身验证)

    image 如果在相邻时间内有五条弹幕,每当消失一条弹幕,弹幕集合内容发生变化,正常逻辑应该是index为0的弹幕元素被移除,可是在RenderSystem中的entities中获取到的弹幕集合,不仅仅是最前面的弹幕被清除了,而且也把最后的弹幕放到了最前面;表现:如果允许overlap,那么可能一开始一直在最上层的弹幕,当有弹幕完全消失时,弹幕层级会发生变化; eg: 五条弹幕:A、B、C、D、E; 此时第一条弹幕消失后entities集合元素顺序:E、B、C、D; 此时第二条弹幕消失后entities集合元素顺序:E、D、C; 这个ECS其中具体怎样实现元素remove和sort的,在其它入口(DanmakuSortedSystem、DataSystem)我也都查看了弹幕集合sort顺序,发现都是正常的,请问原作者了解这个问题根源在哪吗?

    opened by HpBoss 1
  • 存在内存泄漏,在sample上添加leakcanary也同样~~

    存在内存泄漏,在sample上添加leakcanary也同样~~

    只要频繁开启、关闭SampleFullScreenActivity就会复现。

    2022-06-20 17:05:10.866 18034-18034/com.kuaishou.akdanmaku.sample D/LeakCanary: ​ ┬─── │ GC Root: Thread object │ ├─ android.os.HandlerThread instance │ Leaking: UNKNOWN │ Retaining 7.2 MB in 144245 objects │ Thread name: 'ActionThread' │ ↓ Thread.threadLocals │ ~~~~~~~~~~~~ ├─ java.lang.ThreadLocal$ThreadLocalMap instance │ Leaking: UNKNOWN │ Retaining 788 B in 26 objects │ ↓ ThreadLocal$ThreadLocalMap.table │ ~~~~~ ├─ java.lang.ThreadLocal$ThreadLocalMap$Entry[] array │ Leaking: UNKNOWN │ Retaining 768 B in 25 objects │ ↓ ThreadLocal$ThreadLocalMap$Entry[5] │ ~~~ ├─ java.lang.ThreadLocal$ThreadLocalMap$Entry instance │ Leaking: UNKNOWN │ Retaining 416 B in 15 objects │ ↓ ThreadLocal$ThreadLocalMap$Entry.value │ ~~~~~ ├─ android.view.Choreographer instance │ Leaking: UNKNOWN │ Retaining 388 B in 14 objects │ ↓ Choreographer.mCallbackQueues │ ~~~~~~~~~~~~~~~ ├─ android.view.Choreographer$CallbackQueue[] array │ Leaking: UNKNOWN │ Retaining 132 B in 7 objects │ ↓ Choreographer$CallbackQueue[1] │ ~~~ ├─ android.view.Choreographer$CallbackQueue instance │ Leaking: UNKNOWN │ Retaining 48 B in 2 objects │ ↓ Choreographer$CallbackQueue.mHead │ ~~~~~ ├─ android.view.Choreographer$CallbackRecord instance │ Leaking: UNKNOWN │ Retaining 32 B in 1 objects │ ↓ Choreographer$CallbackRecord.action │ ~~~~~~ ├─ com.kuaishou.akdanmaku.ui.DanmakuPlayer$FrameCallback instance │ Leaking: UNKNOWN │ Retaining 12 B in 1 objects │ ↓ DanmakuPlayer$FrameCallback.handler │ ~~~~~~~ ├─ com.kuaishou.akdanmaku.ui.DanmakuPlayer$ActionHandler instance │ Leaking: UNKNOWN │ Retaining 32 B in 1 objects │ ↓ DanmakuPlayer$ActionHandler.this$0 │ ~~~~~~ ├─ com.kuaishou.akdanmaku.ui.DanmakuPlayer instance │ Leaking: UNKNOWN │ Retaining 7.2 MB in 144196 objects │ ↓ DanmakuPlayer.danmakuView │ ~~~~~~~~~~~ ├─ com.kuaishou.akdanmaku.ui.DanmakuView instance │ Leaking: YES (View.mContext references a destroyed activity) │ Retaining 463.7 kB in 6551 objects │ View is part of a window view hierarchy │ View.mAttachInfo is null (view detached) │ View.mID = R.id.danmakuView │ View.mWindowAttachCount = 1 │ mContext instance of com.kuaishou.akdanmaku.sample.SampleFullScreenActivity with mDestroyed = true │ ↓ View.mContext ╰→ com.kuaishou.akdanmaku.sample.SampleFullScreenActivity instance ​ Leaking: YES (ObjectWatcher was watching this because com.kuaishou.akdanmaku.sample.SampleFullScreenActivity ​ received Activity#onDestroy() callback and Activity#mDestroyed is true) ​ Retaining 10.8 kB in 288 objects ​ key = d5c9958a-0d58-43f8-bb83-3cf76d306c52 ​ watchDurationMillis = 25669 ​ retainedDurationMillis = 20669 ​ mApplication instance of android.app.Application ​ mBase instance of androidx.appcompat.view.ContextThemeWrapper

    METADATA
    
    Build.VERSION.SDK_INT: 30
    Build.MANUFACTURER: deltainno
    LeakCanary version: 2.9.1
    App process name: com.kuaishou.akdanmaku.sample
    Class count: 18433
    Instance count: 581210
    Primitive array count: 123341
    Object array count: 44375
    Thread count: 29
    Heap total bytes: 32675955
    Bitmap count: 590
    Bitmap total bytes: 31502554
    Large bitmap count: 0
    Large bitmap total bytes: 0
    Stats: LruCache[maxSize=3000,hits=100857,misses=458594,hitRate=18%]
    RandomAccess[bytes=21134172,reads=458594,travel=136475745955,range=44553460,size=50633639]
    Analysis duration: 25892 ms
    
    improvement 
    opened by wosika 0
  • 运行不起来

    运行不起来

    Execution failed for task ':samples:app:mergeDebugResources'.

    Could not resolve all files for configuration ':samples:app:debugRuntimeClasspath'. Cannot resolve external dependency com.kuaishou:akdanmaku:1.0.3 because no repositories are defined. Required by:

    opened by androidTH 0
Owner
KwaiAppTeam
Kwai App Teams ❤️ Open Source
KwaiAppTeam