Skip to content
This repository was archived by the owner on Nov 10, 2022. It is now read-only.

Commit 1b6a28b

Browse files
author
xia ning
authored
Update README.md
1 parent 8df4489 commit 1b6a28b

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

README.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,38 @@ private LrcView mLrcView;
7676
}
7777
}
7878
```
79+
80+
## 打分回调
81+
82+
```
83+
public interface OnActionListener {
84+
/** 咪咕歌词原始参考pitch值回调, 用于开发者自行实现打分逻辑. 歌词每个tone回调一次
85+
* pitch: 当前tone的pitch值
86+
* totalCount: 整个xml的tone个数, 用于开发者方便自己在app层计算平均分.
87+
*/
88+
void onOriginalPitch(double pitch, int totalCount);
89+
90+
91+
/** paas组件内置的打分回调, 每句歌词结束的时候提供回调(句指xml中的sentence节点), 并提供totalScore参考值用于按照百分比方式显示分数
92+
* score: 这次回调的分数 40-100之间
93+
* cumulativeScore: 累计的分数 初始分累计到当前的分数
94+
* total: 总分 = 初始分(默认值0分) + xml中sentence的个数 * 100
95+
* 当开启分数回调后, 可拖动功能失效
96+
*/
97+
void onScore(double score, double cumulativeScore, double totalScore);
98+
99+
}
100+
101+
102+
初始分默认为0分, 如果要重定义在下面:
103+
<io.agora.lrcview.LrcView
104+
android:id="@+id/lrcView"
105+
app:lrcDefaultScore="0"
106+
app:lrcEnableDrag="true"
107+
app:lrcScore="true"
108+
/>
109+
```
110+
79111
核心 API 参考如下:
80112

81113
| API | 实现功能 |
@@ -93,4 +125,4 @@ private LrcView mLrcView;
93125
| loadLrc(mainLrcText, secondLrcText) | 加载本地歌词文件。 支持加载 LRC 格式的双语歌词,mainLrcText 是中文歌词对象,secondLrcText 是英文歌词对象。对于非双语歌词, 将 mainLrcText 或 secondLrcText 设置为 null。|
94126
| onLoadLrcCompleted | 歌词文件加载完成回调。 |
95127
| updateTime | 根据当前歌曲播放进度更新歌词进度,单位为毫秒。 |
96-
| hasLrc | 获取歌词文件状态。 true:歌词有效 false:歌词无效,无法播放 reset 重置内部状态,清空已经加载的歌词。|
128+
| hasLrc | 获取歌词文件状态。 true:歌词有效 false:歌词无效,无法播放 reset 重置内部状态,清空已经加载的歌词。|

0 commit comments

Comments
 (0)