更新时间 : 2021-07-09 11:43:13
替换方法需要根据规范组织参数内容,请先点击以下链接了解
/**
* 设置模板替换素材信息
*
* 参考 https://www.seeshiontech.com/docs/page_103.html
*
* @param renderId, render id
* @param json, 素材信息
* @return bool
*
* */
func RenderProcessSetReplaceableJson(renderId string, json string) bool {
}
assetPaths := [5]string{
basedir + "/workspace/assets/1.jpeg",
basedir + "/workspace/assets/2.jpeg",
basedir + "/workspace/assets/3.jpeg",
basedir + "/workspace/assets/4.jpeg",
basedir + "/workspace/assets/6.jpeg",
}
var assets []vesdk.Asset
// 添加指定前缀文字替换素材
asset := vesdk.Asset{MainFile: assetPaths[0]}
vesdk.AddPrefixTextAsset(&asset, "文字1", "dtext")
vesdk.AddPrefixTextAsset(&asset, "文字2", "dtext")
assets = append(assets, asset)
// 添加默认前缀(dtext)文字替换素材
asset2 := vesdk.Asset{MainFile: assetPaths[1]}
vesdk.AddPrefixTextAsset(&asset2, "文字3", "")
assets = append(assets, asset2)
// 添加精确文字替换元素
asset3 := vesdk.Asset{}
vesdk.AddTextAsset(&asset3, "相册名称", "title")
assets = append(assets, asset3)
// 添加指定前缀文字替换素材
asset4 := vesdk.Asset{MainFile: assetPaths[2]}
vesdk.AddPrefixFileAsset(&asset4, basedir+"/workspace/assets/235_41_text1.png", "dtext")
assets = append(assets, asset4)
jsonStr1, err := json.Marshal(assets)
// 设置替换素材
vesdk.RenderProcessSetReplaceableJson(renderId, string(jsonStr1))
替换方法需要根据规范组织参数内容,请先点击以下链接了解
/**
* 设置模板替换素材信息
*
* 参考 https://www.seeshiontech.com/docs/page_103.html
*
* @param renderId, render id
* @param json, 素材信息
* @return bool
*
* */
func RenderProcessSetReplaceableJson(renderId string, json string) bool {
}
assetPaths := [5]string{
basedir + "/workspace/assets/1.jpeg",
basedir + "/workspace/assets/2.jpeg",
basedir + "/workspace/assets/3.jpeg",
basedir + "/workspace/assets/4.jpeg",
basedir + "/workspace/assets/6.jpeg",
}
var assets []vesdk.Asset
// 添加指定前缀文字替换素材
asset := vesdk.Asset{MainFile: assetPaths[0]}
vesdk.AddPrefixTextAsset(&asset, "文字1", "dtext")
vesdk.AddPrefixTextAsset(&asset, "文字2", "dtext")
assets = append(assets, asset)
// 添加默认前缀(dtext)文字替换素材
asset2 := vesdk.Asset{MainFile: assetPaths[1]}
vesdk.AddPrefixTextAsset(&asset2, "文字3", "")
assets = append(assets, asset2)
// 添加精确文字替换元素
asset3 := vesdk.Asset{}
vesdk.AddTextAsset(&asset3, "相册名称", "title")
assets = append(assets, asset3)
// 添加指定前缀文字替换素材
asset4 := vesdk.Asset{MainFile: assetPaths[2]}
vesdk.AddPrefixFileAsset(&asset4, basedir+"/workspace/assets/235_41_text1.png", "dtext")
assets = append(assets, asset4)
jsonStr1, err := json.Marshal(assets)
// 设置替换素材
vesdk.RenderProcessSetReplaceableJson(renderId, string(jsonStr1))