提交 caa84463 编写于 作者: Q qiang

feat(app): uni.getVideoInfo

上级 1c5f9bc0
......@@ -52,6 +52,7 @@ const media = [
'chooseFile',
'previewImage',
'getImageInfo',
'getVideoInfo',
'saveImageToPhotosAlbum',
'compressImage',
'compressVideo',
......
......@@ -58,6 +58,7 @@
"uni.chooseFile": true,
"uni.previewImage": true,
"uni.getImageInfo": true,
"uni.getVideoInfo": true,
"uni.saveImageToPhotosAlbum": true,
"uni.compressImage": true,
"uni.compressVideo": true,
......
import getRealPath from 'uni-platform/helpers/get-real-path'
export const getVideoInfo = {
src: {
type: String,
required: true,
validator (src, params) {
params.src = getRealPath(src)
}
}
}
......@@ -32,6 +32,7 @@ export * from './media/choose-video'
export * from './media/compress-image'
export * from './media/compress-video'
export * from './media/get-image-info'
export * from './media/get-video-info'
export * from './media/preview-image'
export * from './media/recorder'
export * from './media/save-image-to-photos-album'
......
import {
warpPlusMethod
} from '../util'
export const getVideoInfo = warpPlusMethod('io', 'getVideoInfo', options => {
options.filePath = options.src
return options
}, data => {
return {
duration: data.duration,
fps: data.fps || 30,
height: data.height,
width: data.width,
size: data.size
}
})
......@@ -208,7 +208,7 @@ export function warpPlusErrorCallback (callbackId, name, errMsg) {
}
}
export function warpPlusMethod (module, name, before) {
export function warpPlusMethod (module, name, before, after) {
return function (options, callbackId) {
if (typeof before === 'function') {
options = before(options)
......@@ -217,6 +217,9 @@ export function warpPlusMethod (module, name, before) {
success (data = {}) {
delete data.code
delete data.message
if (typeof after === 'function') {
data = after(data)
}
invoke(callbackId, Object.assign({}, data, {
errMsg: `${name}:ok`
}))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册