cordova-plugin-trtc/README.md

63 lines
1.2 KiB
Markdown
Raw Normal View History

2021-12-21 16:17:40 +08:00
# cordova-plugin-trtc
2021-12-27 11:25:27 +08:00
腾讯实时音视频(TRTC)封装cordova插件
2021-12-21 16:35:16 +08:00
2021-12-27 11:25:27 +08:00
## 使用方法
2021-12-21 16:35:16 +08:00
2021-12-27 11:25:27 +08:00
```bash
cordova plugin add git+http://m.shuto.cn:8680/public/cordova-plugin-trtc.git
```
2021-12-21 16:35:16 +08:00
2021-12-27 11:25:27 +08:00
## 内置方法
2021-12-21 16:35:16 +08:00
2021-12-27 11:25:27 +08:00
### 加入视频会议
2021-12-21 16:35:16 +08:00
2021-12-27 11:25:27 +08:00
```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.joinChannel(
{
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
ocument.addEventListener(
cordova.plugin.trtc.Constant.EVENT_ON_USER_VIDEO_AVAILABLE,
(event: {room:string,userId:string,available:boolean}) => {
},
false
);
```