rtcManage#
rtcManage#
RTC management
- 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#
Initiate an audio and video call
Kind: static method of rtcManage
| Param | Type | Description |
|---|---|---|
| params | object | initialization parameter |
| params.server | string | RTC server address |
| params.id | number | user id |
| params.caller | boolean | user is caller or not |
| params.receiver | number | receiver id |
| params.pin | string | join room pin code |
| params.hasVideo | boolean | has video stream |
| params.hasAudio | boolean | has audio stream |
| params.attachStream | function | Voice & video call stream handler |
| params.getThrough | function | getThrough process function |
| params.hangupCall | function | hangupCall process function |
| params.getHangUpStatus | function | Hang-up state getter. The following parameters are required when caller is true (callee parameters). |
| params.roomId | number | Room ID that the callee is invited to join. The following parameters are required when caller is true (caller parameters). |
| params.secret | string | create rtc room secret |
| params.callId | string | Required voice & video session parameters when creating a call with a call ID, including the video width and height setters. |
| params.width | number | video width |
| params.height | number | video height |
Example
{% lanying_code_snippet repo="lanying-im-web",class="rtcManage",function="initRTCEngine" %}{% endlanying_code_snippet %}
rtcManage.destroy() ⇒ null#
Destroy function(destroy rtc environment)
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#
Send RTC message
Kind: static method of rtcManage
Returns: number - client generate RTC message id
| Param | Type | Description |
|---|---|---|
| msg | object | message body |
| msg.uid | string | receiver ID |
| msg.content | string | Message content |
| msg.config | string | object | Extension data |
Example
{% lanying_code_snippet repo="lanying-im-web",class="rtcManage",function="sendRTCMessage" %}{% endlanying_code_snippet %}
rtcManage.joinRoom(params) ⇒ null#
Join RTC room
Kind: static method of rtcManage
| Param | Type | Description |
|---|---|---|
| params | object | initialization parameters |
Example
{% lanying_code_snippet repo="lanying-im-web",class="rtcManage",function="joinRoom" %}{% endlanying_code_snippet %}
rtcManage.leaveRoom() ⇒ null#
Leave RTC room
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#
Publish local video/audio streams
Kind: static method of rtcManage
| Param | Type | Description |
|---|---|---|
| type | enum | disable flag |
| hasVideo | boolean | has video stream |
| hasAudio | boolean | has audio stream |
Example
{% lanying_code_snippet repo="lanying-im-web",class="rtcManage",function="publish" %}{% endlanying_code_snippet %}
rtcManage.unPublish() ⇒ null#
Unpublish operation
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#
Subscribe remote video/audio streams
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#
UnSubscribe stream operation
Kind: static method of rtcManage
| Param | Type | Description |
|---|---|---|
| id | number | unSubscribe stream id |
Example
{% lanying_code_snippet repo="lanying-im-web",class="rtcManage",function="unSubscribe" %}{% endlanying_code_snippet %}
rtcManage.muteLocalAudio(mute) ⇒ null#
Mute local audio or not
Kind: static method of rtcManage
| Param | Type | Description |
|---|---|---|
| mute | boolean | mute flag |
Example
{% lanying_code_snippet repo="lanying-im-web",class="rtcManage",function="muteLocalAudio" %}{% endlanying_code_snippet %}
rtcManage.muteLocalVideo(mute) ⇒ null#
Mute local video or not
Kind: static method of rtcManage
| Param | Type | Description |
|---|---|---|
| mute | boolean | mute flag |
Example
{% lanying_code_snippet repo="lanying-im-web",class="rtcManage",function="muteLocalVideo" %}{% endlanying_code_snippet %}
rtcManage.muteRemoteAudio(stream, mute) ⇒ null#
Mute remote audio or not
Kind: static method of rtcManage
| Param | Type | Description |
|---|---|---|
| stream | object | mute stream id |
| mute | boolean | mute flag |
Example
{% lanying_code_snippet repo="lanying-im-web",class="rtcManage",function="muteRemoteAudio" %}{% endlanying_code_snippet %}
rtcManage.muteRemoteVideo(stream, mute) ⇒ null#
Mute remote video or not
Kind: static method of rtcManage
| Param | Type | Description |
|---|---|---|
| stream | object | mute stream id |
| mute | boolean | mute flag |
Example
{% lanying_code_snippet repo="lanying-im-web",class="rtcManage",function="muteRemoteVideo" %}{% endlanying_code_snippet %}
rtcManage.getJanusObject() ⇒ object#
Get janus object handler
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#
Get publisher object handler
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#
Get subscriber object handler
Kind: static method of rtcManage
| Type |
|---|
null |
Example
{% lanying_code_snippet repo="lanying-im-web",class="rtcManage",function="getSubscribeHandler" %}{% endlanying_code_snippet %}