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

feat(App): saveVideoToPhotosAlbum

上级 b5a7bba8
import { getRealPath } from '@dcloudio/uni-platform'
export const API_SAVE_VIDEO_TO_PHOTOS_ALBUM = 'saveVideoToPhotosAlbum'
export type API_TYPE_SAVE_VIDEO_TO_PHOTOS_ALBUM =
typeof uni.saveVideoToPhotosAlbum
export const SaveVideoToPhotosAlbumOptions: ApiOptions<API_TYPE_SAVE_VIDEO_TO_PHOTOS_ALBUM> =
{
formatArgs: {
filePath(filePath, params) {
params.filePath = getRealPath(filePath)
},
},
}
export const SaveVideoToPhotosAlbumProtocol: ApiProtocol<API_TYPE_SAVE_VIDEO_TO_PHOTOS_ALBUM> =
{
filePath: {
type: String,
required: true,
},
}
......@@ -13,6 +13,7 @@ export * from './media/getImageInfo'
export * from './media/getVideoInfo'
export * from './media/previewImage'
export * from './media/getRecorderManager'
export * from './media/saveVideoToPhotosAlbum'
export * from './keyboard/keyboard'
......
import {
API_SAVE_VIDEO_TO_PHOTOS_ALBUM,
API_TYPE_SAVE_VIDEO_TO_PHOTOS_ALBUM,
defineAsyncApi,
SaveVideoToPhotosAlbumOptions,
SaveVideoToPhotosAlbumProtocol,
} from '@dcloudio/uni-api'
import {
warpPlusSuccessCallback,
warpPlusErrorCallback,
} from '../../../helpers/plus'
export const saveVideoToPhotosAlbum =
defineAsyncApi<API_TYPE_SAVE_VIDEO_TO_PHOTOS_ALBUM>(
API_SAVE_VIDEO_TO_PHOTOS_ALBUM,
(options, { resolve, reject }) => {
plus.gallery.save(
options.filePath,
(e) => warpPlusSuccessCallback(resolve),
(e) => warpPlusErrorCallback(reject)
)
},
SaveVideoToPhotosAlbumProtocol,
SaveVideoToPhotosAlbumOptions
)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册