processPetForegroundMediaByTemplate(params: Object)

版本要求:
AIKit≥1.4.3@ray-js/ray≥1.7.27
支持平台:
iOSAndroid
import { ai } from '@ray-js/ray';

const { processPetForegroundMediaByTemplate } = ai;

// Promise 调用
try {
  const res = await processPetForegroundMediaByTemplate({ ...params });
  console.log(res);
} catch (err) {
  console.log(err.errorMsg);
}

描述

基于模板进行宠物前景媒体合成处理

参数

属性类型必填说明
是模板对象
mediaSourcestring是输入媒体数据源
否输出配置
否扩展参数
complete() => void否接口调用结束的回调函数(调用成功、失败都会执行)
success(params: Object) => void否接口调用成功的回调函数
fail(params: Object) => void否接口调用失败的回调函数
success 回调参数
属性类型说明
outputPathstring输出前景媒体的路径
扩展数据
fail 回调参数
属性类型说明
errorMsgstring错误信息
errorCodestring | number错误码
错误扩展

返回值

无

示例代码

import { ai } from '@ray-js/ray'

ai.processPetForegroundMediaByTemplate({
  templateObject: {
    type: "xx",
    effect: {
      code: "xx",
      name: "xx",
      ouputDuration: 3000,
      outputDuration: 3000,
      image: "xx",
      resource: "xx",
    },
  },
  mediaSource: "xx",
  outputConfig: {},
  extendParam: {},
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});