Keyboard shortcuts

Press ← or → to navigate between chapters

Press ? to show this help

Press Esc to hide this help

mc.getVideoInfo(Object object)

获取视频详细信息。

Object object 参数

属性类型默认值必填说明
srcString是视频文件本地路径
successFunction否接口调用成功的回调函数
failFunction否接口调用失败的回调函数
completeFunction否接口调用结束的回调函数(调用成功、失败都会执行)

Object.success(Object res) 回调函数

属性类型说明
orientationString画面方向
typeString视频格式
durationNumber视频长度, 单位 s
sizeNumber视频大小,单位 kB
heightNumber视频的长,单位 px
widthNumber视频的宽,单位 px
fpsNumber视频帧率
bitrateNumber视频码率,单位 kbps

res.orientation 的合法值

值说明最低版本
up默认
down180度旋转
left逆时针旋转90度
right顺时针旋转90度
up-mirrored同up,但水平翻转
down-mirrored同down,但水平翻转
left-mirrored同left,但垂直翻转
right-mirrored同right,但垂直翻转 

示例代码:

mc.chooseVideo({
  sourceType: ['album'],
  compressed: false,
  success: function(res){
    mc.getVideoInfo({
      src: res.tempFilePath,
      complete: (res) => {
        console.log('大小', res.size);
        console.log('时长', res.duration);
      }
    })
  }
})