提交 a663bb20 编写于 作者: inkwalk's avatar inkwalk

fix: getImageInfo,getVideoInfo

上级 e30923f4
......@@ -10,12 +10,16 @@ import {
warpPlusSuccessCallback,
warpPlusErrorCallback,
} from '../../../helpers/plus'
import { TEMP_PATH } from '../constants'
export const getImageInfo = defineAsyncApi<API_TYPE_GET_IMAGE_INFO>(
API_GET_IMAGE_INFO,
(options, { resolve, reject }) => {
const path = TEMP_PATH + '/download/'
plus.io.getImageInfo(
extend(options, {
savePath: path,
filename: path,
success: warpPlusSuccessCallback(resolve),
fail: warpPlusErrorCallback(reject),
})
......
import { extend } from '@vue/shared'
import {
defineAsyncApi,
API_GET_VIDEO_INFO,
......@@ -6,20 +5,27 @@ import {
GetVideoInfoOptions,
GetVideoInfoProtocol,
} from '@dcloudio/uni-api'
import {
warpPlusSuccessCallback,
warpPlusErrorCallback,
} from '../../../helpers/plus'
import { warpPlusErrorCallback } from '../../../helpers/plus'
export const getVideoInfo = <API_TYPE_GET_VIDEO_INFO>defineAsyncApi(
API_GET_VIDEO_INFO,
(options, { resolve, reject }) => {
plus.io.getVideoInfo(
extend(options, {
success: warpPlusSuccessCallback(resolve),
fail: warpPlusErrorCallback(reject),
})
)
plus.io.getVideoInfo({
filePath: options.src,
success: (data: any) => {
return {
orientation: data.orientation,
type: data.type,
duration: data.duration,
size: data.size,
height: data.height,
width: data.width,
fps: data.fps || 30,
bitrate: data.bitrate,
}
},
fail: warpPlusErrorCallback(reject),
})
},
GetVideoInfoProtocol,
GetVideoInfoOptions
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册