UNPKG

1.88 kBTypeScriptView Raw
1import { ComponentType } from 'react'
2import { CommonEventFunction, StandardProps } from './common'
3interface VoipRoomProps extends StandardProps {
4 /** 对话窗口类型,自身传入 camera,其它用户传入 video
5 * @default camera
6 * @supported weapp
7 */
8 mode?: keyof VoipRoomProps.Mode
9 /** 仅在 mode 为 camera 时有效,前置或后置,值为front, back
10 * @default front
11 * @supported weapp
12 */
13 devicePosition?: keyof VoipRoomProps.DevicePosition
14 /** 进入房间用户的 openid
15 * @default "none"
16 * @supported weapp
17 */
18 openId?: string
19 /** 画面与容器比例不一致时,画面的表现形式
20 * @supported weapp
21 * @default "fill"
22 */
23 objectFit?: 'fill' | 'contain' | 'cover'
24 /** 创建对话窗口失败时触发
25 * @supported weapp
26 */
27 onError?: CommonEventFunction
28}
29declare namespace VoipRoomProps {
30 /** 对话窗口类型 */
31 interface Mode {
32 camera
33 video
34 }
35 /** 摄像头类型 */
36 interface DevicePosition {
37 front
38 back
39 }
40}
41/** 多人音视频对话
42 *
43 * 需用户授权 `scope.camera`、`scope.record`。相关接口: [Taro.joinVoIPChat](/docs/apis/media/voip/joinVoIPChat)
44 * 开通该组件权限后,开发者可在 joinVoIPChat 成功后,获取房间成员的 openid,传递给 voip-room 组件,以显示成员画面。
45 * @classification media
46 * @supported weapp
47 * @example
48 * ```tsx
49 * export default class PageView extends Component {
50 * constructor() {
51 * super(...arguments)
52 * }
53 *
54 * render() {
55 * return (
56 * <VoipRoom
57 * openId="{{item}}"
58 * mode="{{selfOpenId === item ? 'camera' : 'video'}}">
59 * </VoipRoom>
60 * )
61 * }
62 * }
63 * ```
64 * @see https://developers.weixin.qq.com/miniprogram/dev/component/voip-room.html
65 */
66declare const VoipRoom: ComponentType<VoipRoomProps>
67export { VoipRoom, VoipRoomProps }