npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tuicall-engine-wxmini

v1.0.2

Published

TUICallEngine API 是音视频通话组件的**无 UI 接口**,如果 TUICallKit 的交互并不满足您的需求,您可以使用这套接口自己封装交互。 由于小程序开发的限制,需要先给live-pusher[绑定事件](#bind),具体可以参照TUICallkit。

Downloads

5

Readme

TUICallEngine API 简介

TUICallEngine API 是音视频通话组件的无 UI 接口,如果 TUICallKit 的交互并不满足您的需求,您可以使用这套接口自己封装交互。 由于小程序开发的限制,需要先给live-pusher绑定事件,具体可以参照TUICallkit。

创建实例和事件回调

| API | 描述 | |-----|-----| | createInstance | 创建 TUICallEngine 实例(静态方法)| | destroyInstance | 销毁 TUICallEngine 实例(静态方法)| | on | 增加事件监听| | off | 取消事件监听|

通话操作相关接口函数

| API | 描述 | |-----|-----| | call | 发起 1v1 通话| | accept | 接听通话 | | reject | 拒绝通话 | | hangup | 结束通话| | switchCallMediaType | 切换通话媒体类型,比如视频通话切音频通话|

设备控制相关接口函数

| API | 描述 | |-----|-----| | openCamera | 开启摄像头| | closeCamera | 关闭摄像头| | switchCamera | 切换前后摄像头| | openMicrophone | 打开麦克风| | closeMicrophone | 关闭麦克风| | selectAudioPlaybackDevice | 选择音频播放设备(听筒/扬声器)|

其他接口函数

| API | 描述 | |-----|-----| | setSelfInfo | 设置用户的头像、昵称|

createInstance

创建 TUICallEngine 的单例(class上的static方法)

TUICallEngine.createInstance({
    sdkAppID:'xxxxxxx',
    tim,
})

说明

| 参数 | 是否必传 | 说明 | |-----|-----|-----| | sdkAppID | 必传 | SDKAppId是腾讯云用于区分客户的唯一标识 | | tim | 非必传 | TIM 是 IM Web SDK 的命名空间,提供了创建 SDK 实例的静态方法 |

destroyInstance

销毁 TUICallEngine 的单例(class上的static方法)

TUICallEngine.destroyInstance()

on

添加回调接口,您可以通过这个接听,监听TRTC相关的事件回调

on(EventCode, handler, context);

说明

| 参数 | 类型 | 说明 | |-----|-----|-----| | Eventlist | String | 事件表 | | handler | Function | 监听函数 | | context | Object | 当前执行上下文 |

off

移除回调接口

off(EventCode, handler);

说明

| 参数 | 类型 | 说明 | |-----|-----|-----| | EventCode | String | 事件表 | | handler | Function | 监听函数 | | context | Object | 当前执行上下文 |

call

C2C邀请通话,被邀请方会收到的回调,如果当前处于通话中,可以调用该函数以邀请第三方进入通话

call({
    userID:"xxxxxxx",
    type:MEDIA_TYPE.AUDIO
})

参数如下表所示:

| 参数 | 类型 | 含义 | |-----|-----|-----| | userID | String | 目标用户的userId | | type | MEDIA_TYPE | 通话的媒体类型,AUDIO-语音通话,VIDEO-视频通话|

accept

当您作为被邀请方收到的回调时,可以调用该函数接听来电

accept();

reject

当您作为被邀请方收到的回调时,可以调用该函数拒绝来电

reject();

hangup

当您处于通话中,可以调用该函数挂断通话 当您发起通话时,可用去了取消通话

hangup();

switchCallMediaType

切换通话媒体类型,比如视频通话切音频通话

switchCallMediaType(MEDIA_TYPE.VIDEO);

| 参数 | 类型 | 含义 | |-----|-----|-----| | type| MEDIA_TYPE |通话的媒体类型,AUDIO-语音通话,VIDEO-视频通话 |

openCamera

您可以调用该函数开启摄像头

openCamera();

closeCamera

您可以调用该函数关闭摄像头,处于通话中的用户会收到回调

closeCamera();

switchCamera

切换前后摄像头

switchCamera();

openMicrophone

您可以调用该函数打开麦克风 处于通话中的用户会收到回调

openMicrophone();

closeMicrophone

您可以调用该函数关闭麦克风 处于通话中的用户会收到回调

closeMicrophone();

selectAudioPlaybackDevice

选择音频播放设备,目前支持听筒、扬声器,在通话场景中,可以使用这个接口来开启/关闭免提模式。

selectAudioPlaybackDevice(AUDIO_PLAYBACK_DEVICE.EAR);

参数如下表所示:

| 参数 | 类型 | 含义 | |-----|-----|-----| | type | AUDIO_PLAYBACK_DEVICE| speaker:扬声器 ear:听筒 |

setSelfInfo

设置用户头像、昵称的接口

setSelfInfo('xxxxxxx','头像.png') ;

参数如下表所示:

| 参数 | 类型 | 含义 | |-----|-----|-----| | nickName | String | 设置昵称 | | avatar | String | 头像地址 |

事件表

| 事件名 | 说明 | |-----|-----| | INVITED | 被邀请通话 | | USER_ACCEPT | 用户接听 | | USER_ENTER | 用户进入通话 | | USER_LEAVE | 用户离开通话 | | USER_UPDATE | 用户更新 | | REJECT | 用户拒绝通话 | | NO_RESP | 用户无响应 | | LINE_BUSY | 用户忙线 | | CALLING_CANCEL | 通话被取消 | | CALLING_TIMEOUT | 通话超时未应答 | | CALL_END | 通话结束 | | SDK_READY | SDK Ready 回调 | | KICKED_OUT | 被踢下线 | | CALL_MODE | 切换通话模式 |

INVITED

被邀请通话

let handleNewInvitationReceived=function(event){
    console.log('被邀请通话')
  }
tuiCallEngine.on(EVENT.INVITED, this.handleNewInvitationReceived, this);

USER_ACCEPT

用户接听

let handleUserAccept=function(event) {
    console.log('用户接听')
}
tuiCallEngine.on(EVENT.USER_ACCEPT, this.handleUserAccept, this);

USER_ENTER

用户进入通话

let handleUserEnter=function(event) {
    console.log('用户进入通话')
}
tuiCallEngine.on(EVENT.USER_ENTER, this.handleUserEnter, this);

USER_LEAVE

用户离开通话

let handleUserLeave=function(event) {
    console.log('用户离开通话')
}
tuiCallEngine.on(EVENT.USER_LEAVE, this.handleUserLeave, this);

USER_UPDATE

用户更新

let handleUserUpdate=function(event) {
    console.log('用户更新')
}
tuiCallEngine.on(EVENT.USER_UPDATE, this.handleUserUpdate, this)

REJECT

用户拒绝通话

let handleInviteeReject=function(event) {
    console.log('用户拒绝通话')
}
tuiCallEngine.on(EVENT.REJECT, this.handleInviteeReject, this);

NO_RESP

用户无响应

let handleNoResponse=function(event) {
    console.log('用户无响应')
}
tuiCallEngine.on(EVENT.NO_RESP, this.handleNoResponse, this);

LINE_BUSY

用户忙线

let handleLineBusy=function(event) {
    console.log('用户忙线')
}
tuiCallEngine.on(EVENT.LINE_BUSY, this.handleLineBusy, this);

CALLING_CANCEL

通话被取消

let handleCallingCancel=function(event) {
    console.log('通话被取消')
}
tuiCallEngine.on(EVENT.CALLING_CANCEL, this.handleCallingCancel, this);

CALLING_TIMEOUT

通话超时未应答

let handleCallingTimeout=function(event) {
    console.log('通话超时未应答')
}
tuiCallEngine.on(EVENT.CALLING_TIMEOUT, this.handleCallingTimeout, this);

CALL_END

通话结束

let handleCallingEnd=function(event) {
    console.log('通话结束')
}
tuiCallEngine.on(EVENT.CALL_END, this.handleCallingEnd, this);

SDK_READY

SDK Ready 回调

let handleSDKReady=function(event) {
    console.log('SDK Ready 回调')
}
tuiCallEngine.on(EVENT.SDK_READY, this.handleSDKReady, this);

KICKED_OUT

被踢下线

let handleKickedOut=function(event) {
    console.log('被踢下线')
}
tuiCallEngine.on(EVENT.KICKED_OUT, this.handleKickedOut, this);

CALL_MODE

切换通话模式

let handleCallMode=function(event) {
    console.log('切换通话模式')
}
tuiCallEngine.on(EVENT.CALL_MODE, this.handleCallMode, this);

通话的类型

| MEDIA_TYPE | 说明 | |-----|-----| | AUDIO | 音频 | | VIDEO | 视频 |

声音的播放设备

| AUDIO_PLAYBACK_DEVICE | 说明 | |-----|-----| | EAR | 听筒 | | SPEAKER | 扬声器 |

通话中的事件处理

| 事件名 | 说明 | |-----|-----| | _pusherNetStatus | pusher 的网络状况 | | _playNetStatus | player 的网络状况 | | _pusherStateChangeHandler | live-pusher 改变状态事件处理 | | _pusherAudioVolumeNotify | live-pusher 麦克风采集的音量大小事件处理 | | _playerStateChange | live-player 状态事件处理 | | _playerAudioVolumeNotify | live-player 麦克风采集的音量大小事件处理 | | _pusherAudioHandler | 订阅 / 取消订阅 Audio | | _pusherVideoHandler | 订阅 / 取消订阅 Video |