UNPKG

1.73 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
10 /** 仅在 mode 为 camera 时有效,前置或后置,值为front, back
11 * @default front
12 * @supported weapp
13 */
14 devicePosition?: keyof VoipRoomProps.DevicePosition
15
16 /** 进入房间用户的 openid
17 * @default "none"
18 * @supported weapp
19 */
20 openId?: string
21
22 /** 创建对话窗口失败时触发
23 * @supported weapp
24 */
25 onError?: CommonEventFunction
26}
27declare namespace VoipRoomProps {
28 /** 对话窗口类型 */
29 interface Mode {
30 camera
31 video
32 }
33
34 /** 摄像头类型 */
35 interface DevicePosition {
36 front
37 back
38 }
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 }