5.1.3 • Published 10 months ago

@rongcloud/plugin-call-engine v5.1.3

Weekly downloads
-
License
LGPL 2.1
Repository
-
Last release
10 months ago

初始化

// CallLib 内部代码
import { RCCallEngine } from '@rongcloud/call-engine'

const callInstaller = {
  tag: 'RCCALL',
  verify () {
    //...
  },
  setup(context: PluginContext,) {
    const callEngine = new RCCallEngine(
      context, 
      logger, // engine 日志模块
      // 收到邀请
      onInvite (callId, crtList, inviteList) {

      }
    )
  }
}

CallSession 获取

// rtc 房间 ID
const callId = ''
const { code, session: callSession } = callEngine.createSession(callId, {
  onSessionStateChange(state, summary?: any) {
    // 
  },
  onUserStateChange(info: {id: string, state: number}[]) {
    // 用户不存在于通话中 | 等待接听 | 通话中
  },
  onRinging(sender) {
    // 收到被叫 响铃
  },
  onMediaModify (sender) {
    // 收到媒体类型更改
  }
})

CallSession 实例方法

// 单呼
const { code } = await callSession.call(channelId, targetId, mediaType)

// 群呼
const { code } = await callSession.callInGroup(channelId, targetId, mediaType)

// 群呼叫中继续邀请
const { code } = await callSession.invite(['user1', 'user2'])

// 接听
const { code } = await callSession.accept()

// 挂断
const { code } = await callSession.hungup()

// 通话媒体类型修改 (callEngine 层支持 音频转视频 视频转音频 消息,calllib 内部做业务限制)
const { code } = await callSession.changeMediaType(type)

/**
 * rtc userJoin 事件触发时调用 
 * (用于未收到被叫发送的 accept 消息情况下 补偿处理 callSession 内部人员列表及状态)
 */
callSession.userJoin([''])

/**
 *  rtc userLeft、userKickOff 事件触发时调用
 *  (用于为收到主叫或被叫发送的 hungup 消息情况下 补偿不理 callSession 内部人员列表及状态)
 */
callSession.userLeave([''])

// session 相关信息获取
callSession.getSessionId()

callSession.getChannelId()

callSession.getTargetId()

callSession.getConversationType()

callSession.getRemoteUsers()

callSession.getSessionState()

callSession.getCallerId()

callSession.getSummary()
5.1.2-enterprise.4

10 months ago

5.1.3

1 year ago

5.1.2

1 year ago

5.1.2-alpha.3

1 year ago

5.0.11-alpha.1

1 year ago

5.1.2-alpha.2

1 year ago

5.1.2-alpha.1

1 year ago

5.0.10

1 year ago

5.0.9

2 years ago

5.0.8

2 years ago

5.0.7

2 years ago

5.0.6

2 years ago

5.0.5

2 years ago

5.0.4

2 years ago

5.0.5-alpha.1

2 years ago

5.0.1-alpha.16

2 years ago

5.0.1-alpha.17

2 years ago

5.0.3

3 years ago

5.0.2

3 years ago

5.0.1

3 years ago

5.0.0

3 years ago

5.0.1-alpha.14

3 years ago

5.0.1-alpha.15

3 years ago

5.0.1-alpha.13

3 years ago

5.0.1-alpha.12

3 years ago

5.0.1-alpha.11

3 years ago

5.0.1-alpha.10

3 years ago

5.0.1-alpha.9

3 years ago

5.0.1-alpha.8

3 years ago

5.0.1-alpha.7

3 years ago

5.0.1-alpha.6

3 years ago

5.0.1-alpha.5

3 years ago

5.0.1-alpha.4

3 years ago

5.0.1-alpha.3

3 years ago

5.0.1-alpha.2

3 years ago

5.0.1-alpha.1

3 years ago