Skip to content

Commit

Permalink
Merge pull request #15850 from heweishui/main
Browse files Browse the repository at this point in the history
【harmony-hybrid】chooseMedia适配两种实现方式
  • Loading branch information
qican777 authored Jun 6, 2024
2 parents 851500f + aad0992 commit e05149f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 44 deletions.
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

0 comments on commit e05149f

Please sign in to comment.