... | ... | @@ -1151,3 +1151,49 @@ DWMediaPlayer player = new DWMediaPlayer(boolen force); |
|
|
MarqueeInfo marqueeInfo = player.setCustomMarqueeData(JsonUtil.getLocalJson(this, "marquee.json"));
|
|
|
setMarqueeView(marqueeInfo);
|
|
|
```
|
|
|
## 4.31 admin配置知识点
|
|
|
|
|
|
1.开发者可自行选择知识点的数据源,admin配置的相关数据或自定义数据源。
|
|
|
注:自定义数据源请保持demo中示例的json格式。
|
|
|
2.注册KnowledgeListener监听获取admin配置的数据源。
|
|
|
//使用点播admin配置的知识点相关信息
|
|
|
```
|
|
|
player.setKnowledgeListener(new KnowledgeListener() {
|
|
|
@Override
|
|
|
public void onKnowledge(final KnowledgeBean knowledgeBean) {
|
|
|
SpeedPlayActivity.this.knowledgeBean = knowledgeBean;
|
|
|
runOnUiThread(new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
sb_progress.setTimeAxisStatus(knowledgeBean.isTimeAxisStatus());
|
|
|
if (!TextUtils.isEmpty(knowledgeBean.getTitle())) {
|
|
|
tvKnowledge.setText(knowledgeBean.getTitle());
|
|
|
tvKnowledge.setVisibility(View.VISIBLE);
|
|
|
} else {
|
|
|
tvKnowledge.setVisibility(View.GONE);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onError(int errorCode, String errorMessage, String errorDetail) {
|
|
|
tvKnowledge.setVisibility(View.GONE);
|
|
|
Log.e(TAG, "onKnowledgeError,errorCode:" + errorCode + ",errorMessage:" + errorMessage + ",errorDetail:" + errorDetail);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
//使用自定义数据源
|
|
|
String localJson = JsonUtil.getLocalJson(this, "knowledge.json");
|
|
|
this.knowledgeBean = new Gson().fromJson(localJson, KnowledgeBean.class);
|
|
|
if (knowledgeBean != null) {
|
|
|
if (!TextUtils.isEmpty(knowledgeBean.getTitle())) {
|
|
|
tvKnowledge.setVisibility(View.VISIBLE);
|
|
|
tvKnowledge.setText(knowledgeBean.getTitle());
|
|
|
} else {
|
|
|
tvKnowledge.setVisibility(View.GONE);
|
|
|
}
|
|
|
sb_progress.setTimeAxisStatus(knowledgeBean.isTimeAxisStatus());
|
|
|
}
|
|
|
``` |
|
|
\ No newline at end of file |