rtcManage#
rtcManage#
音视频管理
- rtcManage
- .initRTCEngine(params) ⇒
null - .destroy() ⇒
null - .sendRTCMessage(msg) ⇒
number - .joinRoom(params) ⇒
null - .leaveRoom() ⇒
null - .publish(type, hasVideo, hasAudio) ⇒
null - .unPublish() ⇒
null - .subscribe(sources) ⇒
null - .unSubscribe(id) ⇒
null - .muteLocalAudio(mute) ⇒
null - .muteLocalVideo(mute) ⇒
null - .muteRemoteAudio(stream, mute) ⇒
null - .muteRemoteVideo(stream, mute) ⇒
null - .getJanusObject() ⇒
object - .getPublishHandler() ⇒
object - .getSubscribeHandler() ⇒
object
rtcManage.initRTCEngine(params) ⇒ null#
发起端发起音视频呼叫
Kind: static method of rtcManage
| Param | Type | Description |
|---|---|---|
| params | object | 初始化参数 |
| params.server | string | RTC服务器地址 |
| params.id | number | 音视频用户id |
| params.caller | boolean | 是否为呼叫发起者 |
| params.receiver | number | 音视频用户对方id |
| params.pin | string | 房间加入pin码(caller为true时发起者需要创建新的pin码) |
| params.hasVideo | boolean | 是否存在视频流 |
| params.hasAudio | boolean | 是否存在音频流 |
| params.attachStream | function | 音视频通话信息流处理函数 |
| params.getThrough | function | 音视频通话是否接通 |
| params.hangupCall | function | 音视频通话是否挂断 |
| params.getHangUpStatus | function | 获取挂断状态函数 以下是caller为 true 的必须参数(被呼叫者必须参数) |
| params.roomId | number | 被呼叫者邀请加入的 room id 以下是caller为 true 的必须参数(呼叫者必须参数) |
| params.secret | string | 创建的房间操作密码 |
| params.callId | string | 创建音视频呼叫时音视频 callid 以下时视频会话必须的参数(视频宽度和高度设置函数) |
| params.width | number | 视频流画面宽度 |
| params.height | number | 视频流画面高度 |
Example
{% lanying_code_snippet repo="lanying-im-web",class="rtcManage",function="initRTCEngine" %}{% endlanying_code_snippet %}
rtcManage.destroy() ⇒ null#
销毁操作(在关闭音视频界面时使用)
Kind: static method of rtcManage
| Type |
|---|
null |
Example
{% lanying_code_snippet repo="lanying-im-web",class="rtcManage",function="destroy" %}{% endlanying_code_snippet %}
rtcManage.sendRTCMessage(msg) ⇒ number#
发送音视频消息
Kind: static method of rtcManage
Returns: number - 客户端生成的消息ID
| Param | Type | Description |
|---|---|---|
| msg | object | 消息体 |
| msg.uid | string | 接收者ID |
| msg.content | string | 消息内容 |
| msg.config | string | object | 扩展字段 |
Example
{% lanying_code_snippet repo="lanying-im-web",class="rtcManage",function="sendRTCMessage" %}{% endlanying_code_snippet %}
rtcManage.joinRoom(params) ⇒ null#
加入房间操作
Kind: static method of rtcManage
| Param | Type | Description |
|---|---|---|
| params | object | 初始化参数 |
Example
{% lanying_code_snippet repo="lanying-im-web",class="rtcManage",function="joinRoom" %}{% endlanying_code_snippet %}
rtcManage.leaveRoom() ⇒ null#
离开加入房间操作
Kind: static method of rtcManage
| Type |
|---|
null |
Example
{% lanying_code_snippet repo="lanying-im-web",class="rtcManage",function="leaveRoom" %}{% endlanying_code_snippet %}
rtcManage.publish(type, hasVideo, hasAudio) ⇒ null#
发布本地流操作
Kind: static method of rtcManage
| Param | Type | Description |
|---|---|---|
| type | enum | 禁止标记 |
| hasVideo | boolean | 是否发布视频 |
| hasAudio | boolean | 是否发布音频 |
Example
{% lanying_code_snippet repo="lanying-im-web",class="rtcManage",function="publish" %}{% endlanying_code_snippet %}
rtcManage.unPublish() ⇒ null#
取消发布流操作
Kind: static method of rtcManage
| Type |
|---|
null |
Example
{% lanying_code_snippet repo="lanying-im-web",class="rtcManage",function="publish" %}{% endlanying_code_snippet %}
rtcManage.subscribe(sources) ⇒ null#
订阅流信息操作
Kind: static method of rtcManage
| Param | Type |
|---|---|
| sources | Array |
Example
{% lanying_code_snippet repo="lanying-im-web",class="rtcManage",function="subscribe" %}{% endlanying_code_snippet %}
rtcManage.unSubscribe(id) ⇒ null#
取消订阅流操作
Kind: static method of rtcManage
| Param | Type | Description |
|---|---|---|
| id | number | 取消订阅的流id |
Example
{% lanying_code_snippet repo="lanying-im-web",class="rtcManage",function="unSubscribe" %}{% endlanying_code_snippet %}
rtcManage.muteLocalAudio(mute) ⇒ null#
禁止本地发布音频流操作
Kind: static method of rtcManage
| Param | Type | Description |
|---|---|---|
| mute | boolean | 禁止标记 |
Example
{% lanying_code_snippet repo="lanying-im-web",class="rtcManage",function="muteLocalAudio" %}{% endlanying_code_snippet %}
rtcManage.muteLocalVideo(mute) ⇒ null#
禁止本地发布视频流操作
Kind: static method of rtcManage
| Param | Type | Description |
|---|---|---|
| mute | boolean | 禁止标记 |
Example
{% lanying_code_snippet repo="lanying-im-web",class="rtcManage",function="muteLocalVideo" %}{% endlanying_code_snippet %}
rtcManage.muteRemoteAudio(stream, mute) ⇒ null#
禁止远程订阅音频流操作
Kind: static method of rtcManage
| Param | Type | Description |
|---|---|---|
| stream | object | 订阅流对象 |
| mute | boolean | 禁止标记 |
Example
{% lanying_code_snippet repo="lanying-im-web",class="rtcManage",function="muteRemoteAudio" %}{% endlanying_code_snippet %}
rtcManage.muteRemoteVideo(stream, mute) ⇒ null#
禁止远程订阅视频流操作
Kind: static method of rtcManage
| Param | Type | Description |
|---|---|---|
| stream | object | 订阅流对象 |
| mute | boolean | 禁止标记 |
Example
{% lanying_code_snippet repo="lanying-im-web",class="rtcManage",function="muteRemoteVideo" %}{% endlanying_code_snippet %}
rtcManage.getJanusObject() ⇒ object#
获取Janus对象句柄
Kind: static method of rtcManage
| Type |
|---|
null |
Example
{% lanying_code_snippet repo="lanying-im-web",class="rtcManage",function="getJanusObject" %}{% endlanying_code_snippet %}
rtcManage.getPublishHandler() ⇒ object#
获取发布操作对象句柄
Kind: static method of rtcManage
| Type |
|---|
null |
Example
{% lanying_code_snippet repo="lanying-im-web",class="rtcManage",function="getPublishHandler" %}{% endlanying_code_snippet %}
rtcManage.getSubscribeHandler() ⇒ object#
获取订阅操作对象句柄
Kind: static method of rtcManage
| Type |
|---|
null |
Example
{% lanying_code_snippet repo="lanying-im-web",class="rtcManage",function="getSubscribeHandler" %}{% endlanying_code_snippet %}