cordova-plugin-trtc/README.md
2021-12-28 11:13:14 +08:00

63 lines
1.2 KiB
Markdown

# cordova-plugin-trtc
腾讯实时音视频(TRTC)封装cordova插件
## 使用方法
```bash
cordova plugin add git+http://m.shuto.cn:8680/public/cordova-plugin-trtc.git
```
## 内置方法
### 加入视频会议
```javascript
cordova.plugin.trtc.joinChannel(
{
ROOM_ID: 123123, // 房间号
USER_ID: '', // 用户id
SDK_APP_ID: '', // TRTC app id
USER_SIG: '' // 用户签名
},
res => { console.log(res); },
err => { console.log(err); },
);
```
### 用户信息变更
```javascript
cordova.plugin.trtc.userInfoChange(
{
room: 123123, // 房间号
userId: '', // 用户id
displayName: '', // 用户名
},
res => { console.log(res); },
err => { console.log(err); },
);
```
### 主播窗口变更事件
```typescript
document.addEventListener(
cordova.plugin.trtc.Constant.EVENT_ON_LAYOUT_CHANGE,
(event: {room:string,userId:string}) => {
},
false
);
```
### 用户加入房间事件
```typescript
document.addEventListener(
cordova.plugin.trtc.Constant.EVENT_ON_USER_VIDEO_AVAILABLE,
(event: {room:string,userId:string,available:boolean}) => {
},
false
);
```