FinClip 提供的插件参数说明

网友投稿 44 2024-06-30

FinClip 提供的插件

当您使用 FinClip SaaS 环境时,可看到来源为平台的插件,此类型插件由 FinClip 自身或合作生态伙伴开发,供您进行调用使用。

#3.1 单向视频录制插件

#3.1.1 快速开始

// pages/video/video.jsPage({

  data: {
    recordTime: 30000,
    top: 20,
    stepList: [
      {
        audioSrc: 'https://devtest-1252553964.cos.ap-guangzhou.myqcloud.com/1.mp3',
        showTime: 0,
        textList: [{
          text: '第一行文本',
          margin: '0 0 6rpx 0'
        }, {
          text: [{
            text: '第二行'
          }, {
            text: '高亮高亮',
            color: '#ee6f2d',
            fontWeight: 'bold',
            margin: '0 6rpx'
          }, {
            text: '文本文本文本文本文本'
          }]
        }, {
          text: '第三行文本文本文本文本文本',
          color: '#ee6f2d',
          margin:  '6rpx'
        }]
      },
      {
        audioSrc: 'https://devtest-1252553964.cos.ap-guangzhou.myqcloud.com/2.mp3',
        showTime: 8000,
        textList: [{
          text: '第二个文本',
          margin: '0 0 6rpx 0'
        }, {
          text: [{
            text: '文本'
          }, {
            text: '高亮',
            color: '#ee6f2d',
            fontWeight: 'bold',
            margin: '0 6rpx'
          }, {
            text: '文本文本文本文本文本'
          }, {
            text: '高亮',
            color: '#ee6f2d',
            fontWeight: 'bold',
            margin: '0 6rpx'
          }]
        }]
      },
      {
        audioSrc: 'https://devtest-1252553964.cos.ap-guangzhou.myqcloud.com/3.mp3',
        showTime: 18000,
        textList: [{
          text: '3第三个文本',
          margin: '0 0 6rpx 0'
        }, {
          text: [{
            text: '3第二行'
          }, {
            text: '3高亮3',
            color: '#ee6f2d',
            fontWeight: 'bold',
            margin: '0 6rpx'
          }, {
            text: '333文本文本文本文本文本文本333'
          }]
        }]
      }
    ],
    buttonStyle: {
      width: '16vw',
      height: '16vw',
      bottom: '80rpx'
    }
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    wx.showLoading()
  },

  onRecordReady() {
    wx.hideLoading()
  },

  onRecordStart() {
    wx.showToast({
      title: '录制开始',
      icon: 'none'
    })
  },

  onRecordEnd(res) {
    const { tempVideoPath } = res.detail
    wx.showToast({
      title: '录制结束,地址:' + tempVideoPath,
      icon: 'none'
    })
    setTimeout(() => {
      wx.navigateTo({
        url: '/pages/index/index?url=' + encodeURIComponent(tempVideoPath)
      })
    }, 3500)
  },

  onRecordError(res) {
    const { errMsg } = res.detail
    wx.showToast({
      title: errMsg,
      icon: 'none'
    })
  }})
        已复制代码
// pages/video/video.json"usingComponents": {
    "video-recognition": "plugin://video/video-recognition"}
        已复制代码
// pages/video/video.fxml<view style="width: 100vw;height: 100vh;">
  <video-recognition recordTime="{{recordTime}}"
                     top="{{top}}"
                     stepList="{{stepList}}"
                     buttonStyle="{{buttonStyle}}"
                     mask="/assets/img_mask_person@3x.png"
                     resolution="low"
                     bind:onRecordReady="onRecordReady"
                     bind:onRecordStart="onRecordStart"
                     bind:onRecordEnd="onRecordEnd"
                     bind:onRecordError="onRecordError">

  </video-recognition></view>
        已复制代码

#3.1.2 参数

属性类型是否必传默认值说明
resolutionStringmedium分辨率,可选值:low、medium、high 只在初始化时有效,不能动态变更
maskString-取景区域的遮罩资源路径,建议使用小程序内资源的相对路径,https 地址会有加载耗时, 遮罩会按 width 100% height 100% 的尺寸放在 camera 上,注意和组件尺寸相匹配
recordTimeNumber30000录制时间,单位为毫秒
topNumber20单位 rpx 文本提示距顶部的距离, 也可修改 video-recognition 组件内的 wxss,自定义文本的 position
stepListArray[Object]-见下方
buttonStyleObject-控制录制按钮的样式,可对按钮进行位置上的微调目前仅支持以下字段:width、height、left、top、bottom、right 只在初始化时有效,不能动态变更
onRecordReadyEventHandler-通过 onRecordReady 绑定 ready 前会进行一些异步资源的-,资源准备好后触发可用于使用组件的 page 页面判断是否准备完毕,从而控制 loading 展示
onRecordStartEventHandler-通过 bind:onRecordStart 绑定录制开始时触发
onRecordEndEventHandler-通过 bind:onRecordEnd 绑定录制结束时触发回调方法参数 res:tempVideoPath 录制视频的本地文件地址
onRecordErrorEventHandler-通过 bind:onRecordError 绑定录制报错时触发回调方法参数 res:errMsg 发生错误时的报错信息

setpList 每步的语和提示案配置,最大支持长度为 3,数据元素结构如下:

{
    "audioSrc": "https://xxxxx.mp3",
    "showTime": 0,
    "textList": []}
        已复制代码
  • audioSrc - 音频链接,建议使用 https 链接,组件 attached 会-音频资源,若-失败会执行 error 回调,报资源加载错误(注意:mp3 的域名需在管理后台添加到白名单内,否则会-失败);

  • showTime - 文本提示和音频的展示时间,毫秒数,0 表示初始展示,2000 表示录制开始 2s 时展示;

  • textList - 文本提示,数组类型,参数对象如下;


{
    "text": '请用普通话大声朗读'}
        已复制代码
  • text - 文本内容 可添加 width|height|padding|margin|color|fontSize|fontWeight|textAlign 等样式属性简单控制文本样式:


{
    "text": "文本",
    "color": "red",
    "fontWeight": "bold",
    "margin": "0 20rpx"}
        已复制代码

注意,一个textList子元素,展示时会以单行不换行展示,可按需拆分成多行多个子元素; 另外,如果单行内容内需要个别词语高亮展示,text属性可以传入数组,属性与上述对象参数一致,如下:

{
    "text": [{
        "text": "文本"
    }, {
        "text": "高亮文本",
        "color": "red",
        "fontWeight": "bold",
        "margin": "0 20rpx"
    }, {
        "text": "文本"
    }]}
        已复制代码

只在初始化时有效,不能动态变更.

#3.2 虚拟键盘

#3.2.1 快速开始

// component.json"usingComponents": {
    "keyboard": "plugin://virtual-keyboard/keyboard"}
        已复制代码
// wxml<keyboard show="{{ show }}" closeButtonText="完成" bindinput="changeInput" binddelete="changeDetete" />
        已复制代码

#3.2.2 参数

属性类型默认值说明
titlestring
键盘上方显示的标题
showbooleanfalse控制键盘是否显示
themestringdefaultdefault/custom 当为 custom 时右侧增加删除和完成按钮
themeColorstring#2e7cff设置主题色
zIndexnumber/string999层级
isRandomLetterbooleanfalse乱序字符
isRandomNumberbooleanfalse乱序数字
normalTypestringnumbernumber/letter/symbol 控制显示的键盘类型
closeButtonTextstring
关闭按钮的文字
extraKey[string]
额外的按键
iconstring
标题栏 icon 的路径


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:小程序的插件使用操作说明(附代码)
下一篇:小程序都可以有自己的本地缓存
相关文章

 发表评论

暂时没有评论,来抢沙发吧~