Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【harmony-hybrid】chooseMedia适配两种实现方式,由sizeType控制 #584

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions examples/mini-program-example/src/pages/api/media/video/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,36 +220,6 @@ export default class Index extends React.Component {
})
},
},
{
id: 'chooseMedium',
inputData: {
count: 9,
mediaType: ['image'],
sourceType: ['album', 'camera'],
maxDuration: 30,
sizeType: ['original', 'compressed'],
camera: 'back',
mediaId: '',
takingSupported: false,
editSupported: false,
searchSupported: false,
},
func: (apiIndex, data) => {
TestConsole.consoleTest('chooseMedium')
// @ts-ignore
Taro.chooseMedium({
...data,
success: (res) => {
TestConsole.consoleSuccess.call(this, res, apiIndex)
},
fail: (res) => {
TestConsole.consoleFail.call(this, res, apiIndex)
},
}).then((res) => {
TestConsole.consoleResult.call(this, res, apiIndex)
})
},
},
{
id: 'createVideoContext',
func: (apiIndex) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Taro from '@tarojs/taro'
import { showActionSheet } from '@tarojs/taro-h5'

import native from '../../NativeApi'
import { shouldBeObject } from '../../utils'
import { MethodHandler } from '../../utils/handler'
import native from '../../../NativeApi'
import { shouldBeObject } from '../../../utils'
import { MethodHandler } from '../../../utils/handler'

/**
* 拍摄或从手机相册中选择图片或视频
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { showActionSheet } from '@tarojs/taro-h5'

import native from '../../NativeApi'
import { shouldBeObject } from '../../utils'
import { MethodHandler } from '../../utils/handler'
import native from '../../../NativeApi'
import { shouldBeObject } from '../../../utils'
import { MethodHandler } from '../../../utils/handler'

namespace chooseMedium {
export interface Option {
Expand Down Expand Up @@ -85,12 +85,6 @@ namespace chooseMedium {
thumbTempFilePath: string
/** 选择的文件的类型 */
fileType: string
/** 相册中是否支持拍照 */
takingSupported?: boolean
/** 相册中是否支持编辑照片 */
editSupported?: boolean
/** 相册中是否支持搜索 */
searchSupported?: boolean
}
export interface mediaType {
/** 只能拍摄视频或从相册选择视频 */
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { chooseMedia as chooseMediaAlbum } from './chooseMedia'
import { chooseMedium as chooseMediaPicker } from './chooseMedium'

export const chooseMedia = (options: any, usePicker: boolean = true) => {
return usePicker ? chooseMediaPicker(options) : chooseMediaAlbum(options)
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ export { createVideoContext } from '@tarojs/taro-h5'
/**
* 拍摄视频或从手机相册中选视频。
*/
export * from './chooseMedia'
export * from './chooseMedium'
export * from './chooseMedia/index'

/**
* VideoContext 实例
Expand Down