Skip to content

Commit 57fdb60

Browse files
committed
Cleanup
1 parent 2284bd6 commit 57fdb60

19 files changed

+146
-619
lines changed

BUILDING.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
Building 编译项目
2-
==============================
3-
本项目采用 grunt 管理编译,有关 Grunt 系统的使用请参考[官方文档](http://gruntjs.com/getting-started)
4-
脚本弹幕部分的编译还需要 [TypeScript](http://www.typescriptlang.org/) 。这些库还会依赖于
5-
NodeJS环境。
1+
# Building 编译项目
62

7-
### 确定你是否需要编译 (Do I need to build CCL?)
3+
本项目采用 grunt 管理编译,有关 Grunt 系统的使用请参考
4+
[官方文档](http://gruntjs.com/getting-started) 脚本弹幕部分的编译需要
5+
[TypeScript](http://www.typescriptlang.org/)
6+
这些库还会依赖于NodeJS环境。
7+
8+
### 确定你是否需要编译 Do I need to build CCL?
89
CommentCoreLibrary在库外提供了很多可扩展的空间,你可以相对简单的增加新的弹幕格式的支持,新的弹幕
910
运行模式的支持和挂载各种不同的定时元件。CCL提供了丰富的扩展支持,通过预处理过滤器和运行时过滤器可以
1011
实现非常多的特殊功能支持。编译库意味着你可能需要一些默认环境没有的软件,比如 NodeJS 平台,为此需要
@@ -13,8 +14,8 @@ CommentCoreLibrary在库外提供了很多可扩展的空间,你可以相对
1314
当然自己编译也会带来一些优势,比如更小的库大小和更加专注的功能支持。还有,希望帮助CCL实现更多支持的
1415
开发者们也需要知道如何有效的编译。
1516

16-
### 配置编译环境(Setup Build Environment
17-
初次编译请确保你安装了 `node>=0.8.0`,为全局系统安装 grunt 请执行:
17+
### 配置编译环境Setup Build Environment
18+
初次编译请确保你安装了 `node>=1.0.0`,为全局系统安装 grunt 请执行:
1819

1920
npm install -g grunt-cli
2021

@@ -32,7 +33,7 @@ CommentCoreLibrary在库外提供了很多可扩展的空间,你可以相对
3233
即可按照默认模板编译。除此之外,你还可以改变编译目标:
3334

3435
- `build` : 只编译项目,不会clean掉build文件夹下的产物
35-
- `build:core_only` : 只编译弹幕核心,不包括CommentProvider和parsers里面的解析器。
36+
- `build:core` : 只编译弹幕核心,不包括CommentProvider和parsers里面的解析器。
3637
这个更加适用不需要已有的弹幕格式的各种二次开发
3738
- `build:scripting` : 只编译代码弹幕支持
3839

README.md

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
[![Build Status: Linux](https://travis-ci.org/jabbany/CommentCoreLibrary.svg?branch=master)](https://travis-ci.org/jabbany/CommentCoreLibrary)
77
[![Coverage Status](https://img.shields.io/coveralls/jabbany/CommentCoreLibrary.svg)](https://coveralls.io/r/jabbany/CommentCoreLibrary?branch=master)
88

9+
Other Languages: [简体中文](README.zh_cn.md)
10+
911
The CommentCoreLibrary is a set of Javascript modules that make up the
1012
core controller for comments streaming on top of timed media (video or audio).
1113
It is intended as a catalyst for the development of timed "danmaku" comments
@@ -55,33 +57,4 @@ Also, feel free to have a look at our sister project
5557
[ABPlayerHTML5](https://github.com/jabbany/ABPlayerHTML5) for a reference
5658
implementation of a video player with CommentCoreLibrary.
5759

58-
# 弹幕核心通用构件
59-
弹幕核心通用构件是一套基于JavaScript构建的弹幕控制器,意在催化HTML5下弹幕播放器的发展。同时方便
60-
希望了解弹幕播放器运作原理的开发者,提供简单但是深入的入门。开发者们可以根据弹幕核心通用构件来自定义
61-
自己的流媒体注释播放模式。
62-
63-
不管你在开发基于Javascript的Web服务,还是其他的需要弹幕播放功能服务,都可以参考弹幕核心
64-
的实现代码。我们以简单的方法构建了 (1) 时间轴管理 (2) 基础空间规划 (3) 弹幕过滤 (4)
65-
高级弹幕效果 (5) 基础格式解析 (6) 代码弹幕支持。
66-
67-
## 测试
68-
你可以在[这里](http://jabbany.github.io/CommentCoreLibrary/demo) 访问到测试页面。
69-
我们欢迎各种[BUG报告](CONTRIBUTING.md)
70-
71-
## 许可
72-
本项目采取非常宽松的MIT许可。该许可允许你把本项目运用在任何开源或是闭源的,非营利或商业性的项目中。
73-
您只需在使用到的地方添加下面一行注释:
74-
75-
CommentCoreLibrary (//github.com/jabbany/CommentCoreLibrary) - Licensed under the MIT license
76-
77-
## 使用
78-
- 有关本项目的[文档](docs/) 可以在 `docs/` 文件夹里面找到。
79-
- 一些实验性模块在 `experimental/` 里。
80-
- 测试数据在 `test/` 里。
81-
82-
## 做出贡献
83-
非常欢迎提交问题报告和意见建议,同时你也可以在GitHub上Fork本工程,并发送Pull请求来提交
84-
你对项目的贡献。我们非常欢迎二次开发哟!有关具体介绍请参考 [CONTRIBUTING](CONTRIBUTING.md)
8560

86-
我们欢迎对项目任何细节处的针对性研发,尤其比如:解析功能、高级弹幕/代码弹幕和CSS优化等。
87-
如果希望研发播放器的构造和功能,请参考姊妹项目 ABPlayerHTML5。

README.zh_cn.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# 弹幕核心通用构件 CommentCoreLibrary
2+
[![NPM version](https://badge.fury.io/js/comment-core-library.svg)](http://badge.fury.io/js/comment-core-library)
3+
[![Bower version](https://badge.fury.io/bo/comment-core-library.svg)](http://badge.fury.io/bo/comment-core-library)
4+
[![Built with Grunt](https://cdn.gruntjs.com/builtwith.png)](http://gruntjs.com/)
5+
[![License](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT)
6+
[![Build Status: Linux](https://travis-ci.org/jabbany/CommentCoreLibrary.svg?branch=master)](https://travis-ci.org/jabbany/CommentCoreLibrary)
7+
[![Coverage Status](https://img.shields.io/coveralls/jabbany/CommentCoreLibrary.svg)](https://coveralls.io/r/jabbany/CommentCoreLibrary?branch=master)
8+
9+
其它语言: [English](README.md)
10+
11+
弹幕核心通用构件是一套基于JavaScript构建的弹幕控制器,意在催化HTML5下弹幕播放器的发展。同时方便
12+
希望了解弹幕播放器运作原理的开发者,提供简单但是深入的入门。开发者们可以根据弹幕核心通用构件来自定义
13+
自己的流媒体注释播放模式。
14+
15+
不管你在开发基于Javascript的Web服务,还是其他的需要弹幕播放功能服务,都可以参考弹幕核心
16+
的实现代码。我们以简单的方法构建了 (1) 时间轴管理 (2) 基础空间规划 (3) 弹幕过滤 (4)
17+
高级弹幕效果 (5) 基础格式解析 (6) 代码弹幕支持。
18+
19+
## 测试
20+
你可以在[这里](http://jabbany.github.io/CommentCoreLibrary/demo) 访问到测试页面。
21+
我们欢迎各种[BUG报告](CONTRIBUTING.md)
22+
23+
## 许可
24+
本项目采取非常宽松的MIT许可。该许可允许你把本项目运用在任何开源或是闭源的,非营利或商业性的项目中。
25+
您只需在使用到的地方添加下面一行注释:
26+
27+
CommentCoreLibrary (//github.com/jabbany/CommentCoreLibrary) - Licensed under the MIT license
28+
29+
## 使用
30+
- 有关本项目的[文档](docs/) 可以在 `docs/` 文件夹里面找到。
31+
- 一些实验性模块在 `experimental/` 里。
32+
- 测试数据在 `test/` 里。
33+
34+
## 做出贡献
35+
非常欢迎提交问题报告和意见建议,同时你也可以在GitHub上Fork本工程,并发送Pull请求来提交
36+
你对项目的贡献。我们非常欢迎二次开发哟!有关具体介绍请参考 [CONTRIBUTING](CONTRIBUTING.md)
37+
38+
我们欢迎对项目任何细节处的针对性研发,尤其比如:解析功能、高级弹幕/代码弹幕和CSS优化等。
39+
如果希望研发播放器的构造和功能,请参考姊妹项目 ABPlayerHTML5。

demo/player-demo.htm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@
3232
cm.time(Math.round(videoPlayer.currentTime * 1000));
3333
}, 10);
3434
}
35-
cm.startTimer();
35+
cm.start();
3636
videoPlayer.play();
3737
}else{
3838
if(cm != null){
39-
cm.stopTimer();
39+
cm.stop();
4040
clearTimeout(timer);
4141
}
4242
videoPlayer.pause();

demo/scripting/ccl.htm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ <h2>Tests</h2>
186186
});
187187
}
188188
function stop(){
189-
cm.stopTimer();
189+
cm.stop();
190190
if(cm.scripting){
191191
cm.scripting.send("Update:TimeUpdate",{
192192
"state":"pause",
@@ -196,7 +196,7 @@ <h2>Tests</h2>
196196
clearTimeout(tmr);
197197
}
198198
function resume(){
199-
cm.startTimer();
199+
cm.start();
200200
start = new Date().getTime() - playhead;
201201
lasthead = playhead;
202202
tmr = setInterval(timeupdate,42);

dist/CommentCoreLibrary.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ var CommentManager = (function() {
10181018
/** Precompute the offset width **/
10191019
this.width = this.stage.offsetWidth;
10201020
this.height = this.stage.offsetHeight;
1021-
this.startTimer = function () {
1021+
this._startTimer = function () {
10221022
if (__timer > 0) {
10231023
return;
10241024
}
@@ -1030,21 +1030,21 @@ var CommentManager = (function() {
10301030
cmMgr.onTimerEvent(elapsed,cmMgr);
10311031
},10);
10321032
};
1033-
this.stopTimer = function () {
1033+
this._stopTimer = function () {
10341034
window.clearInterval(__timer);
10351035
__timer = 0;
10361036
};
10371037
}
10381038

10391039
/** Public **/
10401040
CommentManager.prototype.stop = function(){
1041-
this.stopTimer();
1041+
this._stopTimer();
10421042
// Send stop signal to all comments
10431043
this.runline.forEach(function (c) { c.stop(); });
10441044
};
10451045

10461046
CommentManager.prototype.start = function(){
1047-
this.startTimer();
1047+
this._startTimer();
10481048
};
10491049

10501050
CommentManager.prototype.seek = function(time){

dist/CommentCoreLibrary.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/scripting/api/Display.js

Lines changed: 21 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/scripting/api/Display.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/data-formats/bilibili-xml.md

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,39 @@
1-
Bilibili 弹幕XML 粗略解析定义文档
2-
======================
1+
# Bilibili 弹幕XML 粗略解析定义文档
2+
以下为探索出的 Bilibili 弹幕格式定义。目前 CommentCoreLibrary 可以还原这个格式下的大部分定义。
3+
不过由于有的定义是猜测的,所以还原后效果可能并不完全等同原始播放器。
4+
5+
## 格式范例
6+
7+
<?xml version="1.0" encoding="UTF-8"?>
8+
<i>
9+
<chatserver>chat.bilibili.tv</chatserver>
10+
<chatid>91236</chatid>
11+
<source>k-v</source>
12+
<d p="##,#,##,######,######,#,....,########">...</d>
13+
</i>
14+
15+
## 普通部分
16+
普通弹幕文字为 `d` 标签内的text部分,参数取自 `p` 属性,顺序如下:
17+
18+
1. stime: 弹幕出现时间 (s)
19+
2. mode: 弹幕类型 (`< 7` 时为普通弹幕)
20+
3. size: 字号
21+
4. color: 文字颜色
22+
5. date: 发送时间戳
23+
6. pool: 弹幕池ID
24+
7. author: 发送者ID
25+
8. dbid: 数据库记录ID(单调递增)
26+
27+
## 高级弹幕 `innerText`
28+
`mode >= 7`时,弹幕为高级弹幕,text部分为JSON对象。根对象是一个数组,属性按照出没顺序
29+
30+
### 基础属性
31+
1. x 坐标: 整数时是绝对坐标,浮点时表示相对坐标
32+
2. y 坐标: 整数时是绝对坐标,浮点时表示相对坐标
33+
3. alpha 渐变: 格式 `start-end` 的字符串表示透明度渐变
34+
4. duration 生存周期: 弹幕生存时间,默认 2500ms
35+
5. text: 文字
36+
6. (OPT) rotation Y: 可选,y坐标轴旋转,单位: deg
37+
7. (OPT) rotation Z: 可选,z坐标轴旋转,单位: deg
38+
8.
39+

0 commit comments

Comments
 (0)