xujiaji / Dmview2
Licence: apache-2.0
轻量级弹幕,三步即可展示弹幕;也可作为公告的动态展示用途
Stars: ✭ 70
Programming Languages
java
68154 projects - #9 most used programming language
Labels
Projects that are alternatives of or similar to Dmview2
Ocbarrage
iOS 弹幕库 OCBarrage, 同时渲染5000条弹幕也不卡, 轻量, 可拓展, 高度自定义动画, 超高性能, 简单易上手; A barrage render-engine with high performance for iOS. At the same time, rendering 5000 barrages is also very smooth, lightweight, scalable, highly custom animation, ultra high performance, simple and easy to use!
Stars: ✭ 294 (+320%)
Mutual labels: danmu
Danmaku
A high-performance JavaScript danmaku engine. 高性能弹幕引擎库
Stars: ✭ 446 (+537.14%)
Mutual labels: danmu
Kikoplay
KikoPlay - NOT ONLY A Full-Featured Danmu Player 不仅仅是全功能弹幕播放器
Stars: ✭ 313 (+347.14%)
Mutual labels: danmu
Artplayer
🎨 ArtPlayer.js is a modern and full featured HTML5 video player
Stars: ✭ 484 (+591.43%)
Mutual labels: danmu
DouyuBarrage-Pro
(2020年最新)斗鱼弹幕抓取及可视化管理平台第二版,提供弹幕抓取、弹幕实时发送速度可视化、抓取记录查询、弹幕下载、自定义关键词统计、铁粉统计、高光时刻自动捕获、高频弹幕词云等功能,起飞~~~
Stars: ✭ 139 (+98.57%)
Mutual labels: danmu
Real Url
获取斗鱼&虎牙&哔哩哔哩&抖音&快手等 58 个直播平台的真实流媒体地址(直播源)和弹幕,直播源可在 PotPlayer、flv.js 等播放器中播放。
Stars: ✭ 3,748 (+5254.29%)
Mutual labels: danmu
Abplayerhtml5
Video Player for danmaku comments. ABPlayer in HTML5. ABPlayer核心构件以动态HTML编写的版本。向HTML5进发!HTML5弹幕播放器
Stars: ✭ 858 (+1125.71%)
Mutual labels: danmu
Ocbarrage
iOS 弹幕库 OCBarrage, 同时渲染5000条弹幕也不卡, 轻量, 可拓展, 高度自定义动画, 超高性能, 简单易上手; A barrage render-engine with high performance for iOS. At the same time, rendering 5000 barrages is also very smooth, lightweight, scalable, highly custom animation, ultra high performance, simple and easy to use!
Stars: ✭ 589 (+741.43%)
Mutual labels: danmu
DMView2
建议下载主分支类库dmlib2导入项目,由于项目目前并不稳定,并伴随经常修改,短时间不会继续发布远程仓库版本
介绍
该项目是为了弃用DMView,因为当时刚刚进入实习用RecyclerView动画实现的,性能很差。后来我离职后又再也没管了,不过有很多朋友又使用了DMView
,本着写出来就要负责的态度,于是写了这个续集。
-
DMView2
不是单纯的只有文字的弹幕,可图文一起; -
DMView2
目前通过两种方式实现,SurfaceView
和TextureView
。大家在使用的时候可以自行选择; -
DMView2
只是展示您设置好的View模板,模板可通过写xml布局,并且可以同时添加多种模板; - 如果是视频弹幕的话那么建议用bilibili开源的弹幕更好点;
- 本库适合轻量级弹幕,弹幕样式高度自定义(你可以理解为该框架就是个展示传输带,你把要展示的图片扔上去就行了)
- 该类库还可以用来展示动态的公告消息
测试效果演示
方法参照表
xml参数 | 值 | 作用 |
---|---|---|
dm_direction |
right_left 、left_right up_down 、down_up
|
down_up :弹幕从下往上跑;up_down :弹幕从上往下跑;left_right :弹幕从左往右跑;right_left :弹幕从右往左跑 |
dm_span |
dp |
刷新一次界面弹幕所移动的跨度 |
dm_span_time |
int |
每个跨度需要的时间,单位:ms(毫秒) |
dm_sleep |
int |
|
dm_v_space |
dp |
弹幕之间的垂直方向间距 |
dm_h_space |
dp |
弹幕之间的横向间距 |
注意: dm_span
和dm_sleep
可配合使用,调整弹幕运动速度
添加依赖
build.gradle文件中添加依赖
implementation 'com.github.xujiaji:dmlib2:0.0.6'
如何使用?
步骤一
在布局xml文件中添加(或使用
DMSurfaceView
):
<com.xujiaji.dmlib2.widget.DMTextureView
android:id="@+id/dmView"
android:layout_width="match_parent"
android:layout_height="200dp"
app:dm_direction="right_left"
app:dm_span="2dp"
app:dm_v_space="8dp"
app:dm_h_space="16dp"
app:dm_span_time="16" />
步骤二
创建弹幕模板布局,可参考
barrage.xml
announcement_image_text.xml
barrage_down_up.xml
等
步骤三
获取DMSurfaceView实例,通过add方法添加弹幕,弹幕为步骤2设置好数据的模板。
View view = LayoutInflater.from(this).inflate(R.layout.announcement_text, null);
mDMSurfaceView.getController().add(view);
或者子线程中添加
dmSurfaceView.getController().add(new ViewCreator() {
@Override
public View build() {
return LayoutInflater.from(MainActivity.this).inflate(R.layout.barrage_other, null);
}
});
注意:
最好在Activity或Fragment的onPause周期中调用下暂停,如下:
@Override
protected void onPause() {
super.onPause();
dmSurfaceView.getController().pause();
}
该代码只展示了DMSurfaceView,查看DMTexutureView使用请参考 TestTextureActivity.java
更新
- 0.0.6
- 低分辨率设备无法显示弹幕
- TextureView销毁时释放surface
- 0.0.5
- 修复锁屏打开App弹幕卡死又重新创建
- 重构内部所有实现逻辑
- 新增跨度和睡眠时间来控制速度
- 修改在xml中使用的属性名
- 修改测试案例,添加公告的测试案例
- 0.0.4
License
Copyright 2018 XuJiaji
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].