rtcManage

rtcManage

RTC management

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.name string user name
params.receiver number receiver id
params.caller boolean user is caller or not
params.secret string create rtc room secret
params.pin string join room pin code
params.hasVideo boolean has video stream
params.hasAudio boolean has audio stream
params.width number video width
params.height number video height
params.localVideo string local video document id
params.remoteVideo string remote video document id
params.remoteAudio string remote audio document id
params.getThrough boolean getThrough process function
params.hangupCall boolean hangupCall process function

Example

const app_id = this.$store.state.im.userManage.getAppid();
const info = this.getCallInviteInfo;
if (info) {
  this.caller = false;
  this.refreshUserInfo(info.initiator);
} else {
  this.caller = true;
  this.refreshUserInfo(this.getSid);
  this.startPhoneRing();
}
document.getElementById('roster_remote_only_audio').muted = false;
this.$store.getters.im.rtcManage.initRTCEngine({
  server: this.$store.state.im.sysManage.getServers(app_id).rtc,
  id: this.$store.state.im.userManage.getUid(),
  caller: this.caller,
  receiver: this.caller ? this.getSid : info.initiator,
  roomId: this.caller ? 0 : info.roomId,
  secret: this.caller ? this.randomString(8) : '',
  callId: this.getCallId,
  pin: this.caller ? this.randomString(8) : info.pin,
  hasVideo: false,
  hasAudio: true,
  getThrough: this.getThrough,
  hangupCall: this.hangupCall,
  getHangUpStatus: this.getHangUpStatus,
  att...
const app_id = this.$store.state.im.userManage.getAppid();
const info = this.getCallInviteInfo;
if (info) {
  this.caller = false;
  this.refreshUserInfo(info.initiator);
} else {
  this.caller = true;
  this.refreshUserInfo(this.getSid);
  this.startPhoneRing();
}
document.getElementById('roster_remote_audio').muted = false;
this.$store.getters.im.rtcManage.initRTCEngine({
  server: this.$store.state.im.sysManage.getServers(app_id).rtc,
  id: this.$store.state.im.userManage.getUid(),
  caller: this.caller,
  receiver: this.caller ? this.getSid : info.initiator,
  roomId: this.caller ? 0 : info.roomId,
  secret: this.caller ? this.randomString(8) : '',
  callId: this.getCallId,
  pin: this.caller ? this.randomString(8) : info.pin,
  hasVideo: true,
  hasAudio: true,
  width: 360,
  height: 640,
  getThrough: this.getThrough,
  hangupCall: this.hangupCall,
  getHangUpStatus: ...

rtcManage.destroy() ⇒ null

Destroy function(destroy rtc environment)

Kind: static method of rtcManage

Type
null

Example

if (!this.doHangup) {
  this.hangupCall(false);
}
this.$store.getters.im.rtcManage.destroy();
if (!this.doHangup) {
  this.hangupCall(false);
}
this.$store.getters.im.rtcManage.destroy();

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 message config fields

Example

this.$store.getters.im.rtcManage.sendRTCMessage({
  uid: fromUid,
  content: 'busy',
  config: JSON.stringify({
    action: 'hangup',
    callId: config.callId,
    initiator: config.initiator,
    pushMessageLocKey: 'callee_busy'
  })
});
let pickupTime = this.getCallPickupTime;
let content = '';
let pushlocKey = 'call_duration';
let callTime = [0, 0];
if (pickupTime) {
  content = (Date.now() - this.getCallPickupTime).toString();
  let intervalMsec = parseInt(content);
  let intervalSec = intervalMsec / 1000;
  callTime[0] = parseInt(intervalSec / 60);
  callTime[1] = parseInt(intervalSec - callTime[0] * 60);
} else {
  if (timeout) {
    content = 'timeout';
    pushlocKey = 'callee_not_responding';
  } else {
    content = 'canceled';
    pushlocKey = 'call_canceled_by_caller';
  }
}
this.$store.getters.im.rtcManage.sendRTCMessage({
  uid: this.userInfo.user_id,
  content: content,
  config: JSON.stringify({
    action: 'hangup',
    callId: this.getCallId,
    initiator: toNumber(this.getCallId.split('_')[0...
this.$store.getters.im.rtcManage.sendRTCMessage({
  uid: this.userInfo.user_id,
  content: 'rejected',
  config: JSON.stringify({
    action: 'hangup',
    callId: this.getCallId,
    initiator: toNumber(this.getCallId.split('_')[0]),
    pushMessageLocKey: 'call_rejected_by_callee'
  })
});
this.stopPhoneRing();
this.$store.dispatch('layer/actionSetShowing', '');
this.$store.dispatch('layer/actionSetShowmask', false);
this.$store.dispatch('contact/actionSetCallInviteInfo', null);
this.$store.dispatch('contact/actionSetCallId', '');
this.$store.dispatch('contact/actionSetCallPickupTime', 0);
this.camera = !this.camera;
this.$store.getters.im.rtcManage.muteLocalVideo(!this.camera);
this.$store.getters.im.rtcManage.sendRTCMessage({
  uid: this.userInfo.user_id,
  content: '',
  ext: JSON.stringify({
    callId: this.getCallId,
    mute_video: !this.camera
  })
});
let pickupTime = this.getCallPickupTime;
let content = '';
let pushlocKey = 'call_duration';
let callTime = [0, 0];
if (pickupTime) {
  content = (Date.now() - this.getCallPickupTime).toString();
  let intervalMsec = parseInt(content);
  let intervalSec = intervalMsec / 1000;
  callTime[0] = parseInt(intervalSec / 60);
  callTime[1] = parseInt(intervalSec - callTime[0] * 60);
} else {
  if (timeout) {
    content = 'timeout';
    pushlocKey = 'callee_not_responding';
  } else {
    content = 'canceled';
    pushlocKey = 'call_canceled_by_caller';
  }
}
this.$store.getters.im.rtcManage.sendRTCMessage({
  uid: this.userInfo.user_id,
  content: content,
  config: JSON.stringify({
    action: 'hangup',
    callId: this.getCallId,
    initiator: toNumber(this.getCallId.split('_')[0...

rtcManage.joinRoom(params) ⇒ null

Join RTC room

Kind: static method of rtcManage

Param Type Description
params object initialization parameters

Example

this.$store.getters.im.rtcManage.joinRoom();

rtcManage.leaveRoom() ⇒ null

Leave RTC room

Kind: static method of rtcManage

Type
null

Example

if (active) {
  let pickupTime = this.getCallPickupTime;
  let content = '';
  let pushlocKey = 'call_duration';
  let callTime = [0, 0];
  if (pickupTime) {
    content = (Date.now() - this.getCallPickupTime).toString();
    let intervalMsec = parseInt(content);
    let intervalSec = intervalMsec / 1000;
    callTime[0] = parseInt(intervalSec / 60);
    callTime[1] = parseInt(intervalSec - callTime[0] * 60);
  } else {
    if (timeout) {
      content = 'timeout';
      pushlocKey = 'callee_not_responding';
    } else {
      content = 'canceled';
      pushlocKey = 'call_canceled_by_caller';
    }
  }
  this.$store.getters.im.rtcManage.sendRTCMessage({
    uid: this.userInfo.user_id,
    content: content,
    config: JSON.stringify({
      action: 'hangup',
      callId: this.getCallId,
      initiator: toNumber(this.ge...
if (active) {
  let pickupTime = this.getCallPickupTime;
  let content = '';
  let pushlocKey = 'call_duration';
  let callTime = [0, 0];
  if (pickupTime) {
    content = (Date.now() - this.getCallPickupTime).toString();
    let intervalMsec = parseInt(content);
    let intervalSec = intervalMsec / 1000;
    callTime[0] = parseInt(intervalSec / 60);
    callTime[1] = parseInt(intervalSec - callTime[0] * 60);
  } else {
    if (timeout) {
      content = 'timeout';
      pushlocKey = 'callee_not_responding';
    } else {
      content = 'canceled';
      pushlocKey = 'call_canceled_by_caller';
    }
  }
  this.$store.getters.im.rtcManage.sendRTCMessage({
    uid: this.userInfo.user_id,
    content: content,
    config: JSON.stringify({
      action: 'hangup',
      callId: this.getCallId,
      initiator: toNumber(this.ge...

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

rtcManage.unPublish() ⇒ null

Unpublish operation

Kind: static method of rtcManage

Type
null

Example

rtcManage.subscribe(sources) ⇒ null

Subscribe remote video/audio streams

Kind: static method of rtcManage

Param Type
sources Array

Example

rtcManage.unSubscribe(id) ⇒ null

UnSubscribe stream operation

Kind: static method of rtcManage

Param Type Description
id number unSubscribe stream id

Example

rtcManage.muteLocalAudio(mute) ⇒ null

Mute local audio or not

Kind: static method of rtcManage

Param Type Description
mute boolean mute flag

Example

this.mic = !this.mic;
this.$store.getters.im.rtcManage.muteLocalAudio(!this.mic);
this.mic = !this.mic;
this.$store.getters.im.rtcManage.muteLocalAudio(!this.mic);

rtcManage.muteLocalVideo(mute) ⇒ null

Mute local video or not

Kind: static method of rtcManage

Param Type Description
mute boolean mute flag

Example

this.camera = !this.camera;
this.$store.getters.im.rtcManage.muteLocalVideo(!this.camera);
this.$store.getters.im.rtcManage.sendRTCMessage({
  uid: this.userInfo.user_id,
  content: '',
  ext: JSON.stringify({
    callId: this.getCallId,
    mute_video: !this.camera
  })
});

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

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

rtcManage.getJanusObject() ⇒ object

Get janus object handler

Kind: static method of rtcManage

Type
null

Example

rtcManage.getPublishHandler() ⇒ object

Get publisher object handler

Kind: static method of rtcManage

Type
null

Example

rtcManage.getSubscribeHandler() ⇒ object

Get subscriber object handler

Kind: static method of rtcManage

Type
null

Example

© 2019-2024 MaximTop | Homepage | Site Map Last modified time: 2024-09-26 03:17:35

results matching ""

    No results matching ""