Skip to content

获取音频时长

方法名

getDuration

用法

  • 用法如下:
    js
    module.getDuration({
      path: "/storage/emulated/0/Download/WeiXin/赵雷-成都.mp3"
    }, res => {
      console.log(res)
    });
  • 参数说明
    参数名参数类型是否必填默认值参数描述
    pathString本地绝对路径或网络地址

回调

  • 示例
    json
    {
        "data": {
            "duration": 445518
        },
        "message": "",
        "code": 0
    }
  • 回调说明:
    参数名参数类型参数描述
    messageString消息提示
    dataObject数据对象
    data.durationInteger音频总时长,单位:毫秒
    codeInteger返回类型,0.成功,其他:失败