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 %}