提交 1c5f9bc0 编写于 作者: Q qiang

feat(app): uni.compressVideo

上级 cb238828
......@@ -54,6 +54,7 @@ const media = [
'getImageInfo',
'saveImageToPhotosAlbum',
'compressImage',
'compressVideo',
'getRecorderManager',
'getBackgroundAudioManager',
'createAudioContext',
......
......@@ -60,6 +60,7 @@
"uni.getImageInfo": true,
"uni.saveImageToPhotosAlbum": true,
"uni.compressImage": true,
"uni.compressVideo": true,
"uni.getRecorderManager": true,
"uni.getBackgroundAudioManager": true,
"uni.createInnerAudioContext": true,
......
import getRealPath from 'uni-platform/helpers/get-real-path'
export const compressVideo = {
src: {
type: String,
required: true,
validator (src, params) {
params.src = getRealPath(src)
}
},
quality: {
type: String
},
bitrate: {
type: Number
},
fps: {
type: Number
},
resolution: {
type: Number
}
}
......@@ -30,6 +30,7 @@ export * from './media/audio'
export * from './media/choose-image'
export * from './media/choose-video'
export * from './media/compress-image'
export * from './media/compress-video'
export * from './media/get-image-info'
export * from './media/preview-image'
export * from './media/recorder'
......
import {
TEMP_PATH
} from '../constants'
import {
warpPlusSuccessCallback,
warpPlusErrorCallback,
getFileName
} from '../util'
export function compressVideo (options, callbackId) {
const dst = `${TEMP_PATH}/compressed/${Date.now()}_${getFileName(options.src)}`
const successCallback = warpPlusSuccessCallback(callbackId, 'compressVideo')
const errorCallback = warpPlusErrorCallback(callbackId, 'compressVideo')
plus.zip.compressVideo(Object.assign({}, options, {
dst
}), successCallback, errorCallback)
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册