更新时间 : 2021-08-02 10:13:28
//如果无需替换素材,可以用渲染引擎直接渲染
String path = "";//模板根目录
String json = "";//替换资源json
SXTemplate mTemplate = new SXTemplate(path, SXTemplate.TemplateUsage.kForRender);
mTemplate.setReplaceableJson(json);
SXTemplateRender render = new SXTemplateRender(mTemplate, null, outputPath);
render.setRenderListener(new SXRenderListener() {
@Override
public void onStart() {
//开始渲染
}
@Override
public void onUpdate(int progress) {
//进度回调,progress为第几帧
}
@Override
public void onFinish(boolean success, String msg) {
//success为true渲染成功,为false时渲染失败,msg是失败原因
}
@Override
public void onCancel() {
//渲染取消
}
});
render.start();
//如果无需替换素材,可以用渲染引擎直接渲染
String path = "";//模板根目录
String json = "";//替换资源json
SXTemplate mTemplate = new SXTemplate(path, SXTemplate.TemplateUsage.kForRender);
mTemplate.setReplaceableJson(json);
SXTemplateRender render = new SXTemplateRender(mTemplate, null, outputPath);
render.setRenderListener(new SXRenderListener() {
@Override
public void onStart() {
//开始渲染
}
@Override
public void onUpdate(int progress) {
//进度回调,progress为第几帧
}
@Override
public void onFinish(boolean success, String msg) {
//success为true渲染成功,为false时渲染失败,msg是失败原因
}
@Override
public void onCancel() {
//渲染取消
}
});
render.start();