新增功能

This commit is contained in:
Your Name
2026-03-04 15:32:30 +08:00
parent a07e844c47
commit ab77f5488d
2266 changed files with 177942 additions and 3444 deletions
+82
View File
@@ -0,0 +1,82 @@
{
"name": "cllkitsoft",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"node_modules/@tencentcloud/lite-chat": {
"version": "1.6.9",
"resolved": "https://mirrors.cloud.tencent.com/npm/@tencentcloud/lite-chat/-/lite-chat-1.6.9.tgz",
"integrity": "sha512-Pg7Z3YFI+jbv3iQzCZQHlWxBbaTZO2yJ8lFT1fURh5R7JJZz+c8h7Pe/z5NZNdmnsZBKes/s6s+hRXcfwMSbnA=="
},
"node_modules/@tencentcloud/trtc-cloud-wx": {
"version": "1.0.8",
"resolved": "https://mirrors.cloud.tencent.com/npm/@tencentcloud/trtc-cloud-wx/-/trtc-cloud-wx-1.0.8.tgz",
"integrity": "sha512-72TYYt6XNTr9Y401qw23YODfhLC9AGniNqb9ACFTVGDtInApHn139kGhKeudgTYEdTObkG1JjUcdkfcknHGhSA==",
"dependencies": {
"eventemitter3": "^5.0.0",
"trtc-wx-sdk": "^1.1.14"
}
},
"node_modules/@tencentcloud/trtc-component-uniapp": {
"version": "1.0.5",
"resolved": "https://mirrors.cloud.tencent.com/npm/@tencentcloud/trtc-component-uniapp/-/trtc-component-uniapp-1.0.5.tgz",
"integrity": "sha512-vffUArHP9hKsxRgd0R6uC8d538tJimUft/enrT1D9rGpoveRKAFkRpdDH44huNiM2XoS+JnkP6tMUqVCtvyi3g==",
"peerDependencies": {
"@tencentcloud/trtc-cloud-wx": "^1.0.7"
}
},
"node_modules/@tencentcloud/trtc-component-wx": {
"version": "1.0.6",
"resolved": "https://mirrors.cloud.tencent.com/npm/@tencentcloud/trtc-component-wx/-/trtc-component-wx-1.0.6.tgz",
"integrity": "sha512-3m2ZU3/upx3IJAhSPdElJ2AF1D7L/0JOXUpanYJbrtHlwTWDQ6BOc+p6HgsepE67ltpR7UcYF/BcVHEfpcObkA==",
"dependencies": {
"@tencentcloud/trtc-cloud-wx": "^1.0.7"
}
},
"node_modules/@tencentcloud/tui-core-lite": {
"version": "1.0.0",
"resolved": "https://mirrors.cloud.tencent.com/npm/@tencentcloud/tui-core-lite/-/tui-core-lite-1.0.0.tgz",
"integrity": "sha512-+nmOWQ415Kz6aYJDv4EIdnaLk69SPWscZqmIhQp9GhNGFVq4/u+gC/sWvGHEOICJncFjM4dUxBg9EFfzD78rGQ==",
"dependencies": {
"@tencentcloud/lite-chat": "^1.5.0"
}
},
"node_modules/@trtc/call-engine-lite-wx": {
"version": "3.4.13",
"resolved": "https://mirrors.cloud.tencent.com/npm/@trtc/call-engine-lite-wx/-/call-engine-lite-wx-3.4.13.tgz",
"integrity": "sha512-Dv3wREtBi7d368FhRuOFOE+erQrLHMo5lnPBIWXSil6sLO6ZqrSn6J6+e44sp7y6/RIJo+e+SxAyAVVxkLZOOQ==",
"dependencies": {
"@tencentcloud/lite-chat": "^1.5.0",
"@tencentcloud/trtc-component-wx": "^1.0.5",
"eventemitter3": "^4.0.7"
}
},
"node_modules/@trtc/call-engine-lite-wx/node_modules/eventemitter3": {
"version": "4.0.7",
"resolved": "https://mirrors.cloud.tencent.com/npm/eventemitter3/-/eventemitter3-4.0.7.tgz",
"integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw=="
},
"node_modules/@trtc/calls-uikit-wx-uniapp": {
"version": "4.2.7",
"resolved": "https://mirrors.cloud.tencent.com/npm/@trtc/calls-uikit-wx-uniapp/-/calls-uikit-wx-uniapp-4.2.7.tgz",
"integrity": "sha512-Dpgn1kR1UgTP34X9lM1Yf6vXQ4odiTEf5Cc8BLepo7CMYNSvDw80B4bBPTatLT8og818yAVVinS8cZ+n4bxPCA==",
"dependencies": {
"@tencentcloud/lite-chat": "^1.5.0",
"@tencentcloud/trtc-component-uniapp": "^1.0.4",
"@tencentcloud/tui-core-lite": "1.0.0",
"@trtc/call-engine-lite-wx": "~3.4.10"
}
},
"node_modules/eventemitter3": {
"version": "5.0.4",
"resolved": "https://mirrors.cloud.tencent.com/npm/eventemitter3/-/eventemitter3-5.0.4.tgz",
"integrity": "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw=="
},
"node_modules/trtc-wx-sdk": {
"version": "1.1.14",
"resolved": "https://mirrors.cloud.tencent.com/npm/trtc-wx-sdk/-/trtc-wx-sdk-1.1.14.tgz",
"integrity": "sha512-QYV2j5pDlhbM0zykYq8OYaSpjyTn0/YbsK180iNwCLEA61m2KWm2wb1veRBVsTP9Lq0iqbSMU17cOW963vcraA=="
}
}
}
+71
View File
@@ -0,0 +1,71 @@
# Official JavaScript SDK for Tencent Cloud Lite Chat
## About Tencent Cloud Lite Chat
Tencent Cloud Lite Chat provides globally interconnected chat APIs, multi-platform SDKs. Includes message sending/receiving and user management features by default, fulfilling core IM capabilities, with a bundle size under 200 KB. With its flexible plugin architecture, the SDK enables seamless integration of comprehensive IM features. You can selectively include only the features you need, customize plugin combinations, and maintain optimal bundle size.
Lite Chat SDK provides basic version, standard version and professional version. @tencentcloud/lite-chat points to the standard version by default.
## Installation
```javascript
npm install @tencentcloud/lite-chat --save
```
## Getting started
### 1. create an SDK instance
```javascript
import TencentCloudChat from '@tencentcloud/lite-chat';
// Create an SDK instance.
// The `TencentCloudLiteChat.create()` method returns the same instance for the same `SDKAppID`.
// The SDK instance is usually represented by `chat`.
let chat = TencentCloudLiteChat.create({
SDKAppID: 0 // Replace `0` with the `SDKAppID` of your Chat app during access.
});
```
### 2. Generate UserSig
UserSig is a password used to log in to Tencent Cloud Lite Chat. It is the ciphertext obtained after data such as UserID is encrypted. This [document](https://trtc.io/document/34385) describes how to generate a UserSig.
### 3. Login in to the Lite Chat SDK
```javascript
let promise = chat.login({userID: 'your userID', userSig: 'your userSig'});
promise.then(function(imResponse) {
console.log(imResponse.data); // Login successful
if (imResponse.data.repeatLogin === true) {
// Indicates that the account has logged in and that the current login will be a repeated login.
console.log(imResponse.data.errorInfo);
}
}).catch(function(imError) {
console.warn('login error:', imError); // Error information
});
```
## Switch to basic version
```javascript
import TencentCloudChat from '@tencentcloud/lite-chat/baisc';
```
## Switch to professional version
```javascript
import TencentCloudChat from '@tencentcloud/lite-chat/professional';
```
## Supported Browsers
| Browser | Supported versions |
| ---- | ---- |
| Chrome | 16 or higher |
| Edge | 13 or higher |
| Firefox | 11 or higher |
| Safari | 7 or higher |
| Internet Explorer | 10 or higher |
| Opera | 12.1 or higher |
| iOS Safari | 7 or higher |
| Android Browser | 4.4 (Kitkat) or higher |
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
+39
View File
@@ -0,0 +1,39 @@
{
"name": "@tencentcloud/lite-chat",
"version": "1.6.9",
"description": "Tencent Cloud Chat SDK for Web/Mini Program/uni-app/React Native/Donut",
"main": "standard.js",
"types": "index.d.ts",
"exports": {
".": {
"types": "./index.d.ts",
"default": "./standard.js"
},
"./basic": {
"types": "./basic.d.ts",
"default": "./basic.js"
},
"./standard": {
"types": "./index.d.ts",
"default": "./standard.js"
},
"./professional": {
"types": "./professional.d.ts",
"default": "./professional.js"
},
"./plugins/*": {
"types": "./plugins/*.d.ts",
"default": "./plugins/*.js"
}
},
"miniprogram": "./",
"keywords": ["chat", "real-time chat", "uni-app", "React Native", "Donut", "push", "messaging", "IM", "trtc"],
"repository": {
"type": "git",
"url": "https://trtc.io/products/chat"
},
"dependencies": {},
"author": "Tencent Cloud Terminal R&D Center",
"license": "ISC"
}
+8
View File
@@ -0,0 +1,8 @@
declare const avChatRoomPlugin: {
[key: string]: any;
};
export default avChatRoomPlugin;
declare module '@tencentcloud/lite-chat/plugins/avchatroom' {
export default avChatRoomPlugin;
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+9
View File
@@ -0,0 +1,9 @@
declare const cloudSearchPlugin: {
[key: string]: any;
};
export default cloudSearchPlugin;
declare module '@tencentcloud/lite-chat/plugins/cloud-search' {
export default cloudSearchPlugin;
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,8 @@
declare const conversationGroupPlugin: {
[key: string]: any;
};
export default conversationGroupPlugin;
declare module '@tencentcloud/lite-chat/plugins/conversation-group' {
export default conversationGroupPlugin;
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+8
View File
@@ -0,0 +1,8 @@
declare const conversationPlugin: {
[key: string]: any;
};
export default conversationPlugin;
declare module '@tencentcloud/lite-chat/plugins/conversation' {
export default conversationPlugin;
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+8
View File
@@ -0,0 +1,8 @@
declare const followPlugin: {
[key: string]: any;
};
export default followPlugin;
declare module '@tencentcloud/lite-chat/plugins/follow' {
export default followPlugin;
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+8
View File
@@ -0,0 +1,8 @@
declare const friendPlugin: {
[key: string]: any;
};
export default friendPlugin;
declare module '@tencentcloud/lite-chat/plugins/friend' {
export default friendPlugin;
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+8
View File
@@ -0,0 +1,8 @@
declare const groupPlugin: {
[key: string]: any;
};
export default groupPlugin;
declare module '@tencentcloud/lite-chat/plugins/group' {
export default groupPlugin;
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,8 @@
declare const messageEnhancerPlugin: {
[key: string]: any;
};
export default messageEnhancerPlugin;
declare module '@tencentcloud/lite-chat/plugins/message-enhancer' {
export default messageEnhancerPlugin;
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,9 @@
declare const offlineMessageSynchronizer: {
[key: string]: any;
};
export default offlineMessageSynchronizer;
declare module '@tencentcloud/lite-chat/plugins/offline-message-synchronizer' {
export default offlineMessageSynchronizer;
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,8 @@
declare const richMediaMessagePlugin: {
[key: string]: any;
};
export default conversationPlugin;
declare module '@tencentcloud/lite-chat/plugins/rich-media-message' {
export default richMediaMessagePlugin;
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+8
View File
@@ -0,0 +1,8 @@
declare const signalingPlugin: {
[key: string]: any;
};
export default signalingPlugin;
declare module '@tencentcloud/lite-chat/plugins/signaling' {
export default signalingPlugin;
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+8
View File
@@ -0,0 +1,8 @@
declare const topicPlugin: {
[key: string]: any;
};
export default topicPlugin;
declare module '@tencentcloud/lite-chat/plugins/topic' {
export default topicPlugin;
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+14
View File
@@ -0,0 +1,14 @@
{
"name": "@tencentcloud/trtc-cloud-wx",
"version": "1.0.8",
"description": "",
"main": "./trtc-cloud-wx.js",
"type": "module",
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"eventemitter3": "^5.0.0",
"trtc-wx-sdk": "^1.1.14"
}
}
File diff suppressed because it is too large Load Diff
+243
View File
@@ -0,0 +1,243 @@
import b, { translateTRTCStreamId as v } from "@tencentcloud/trtc-cloud-wx";
export * from "@tencentcloud/trtc-cloud-wx";
import { default as H } from "@tencentcloud/trtc-cloud-wx";
import { resolveComponent as m, openBlock as h, createElementBlock as y, createVNode as g, createBlock as _, createCommentVNode as C } from "vue";
const f = (t, o) => {
const r = t.__vccOpts || t;
for (const [n, e] of o)
r[n] = e;
return r;
}, p = b.getTRTCShareInstance(), u = p.trtc, l = p.InterfaceEventEmitter, R = {
name: "TRTCPusher",
data() {
return {
pusher: {},
soundMode: ""
};
},
mounted() {
p.logger.info("trtc-pusher attached"), this.bindTRTCCloudEvent(), l.emit("pusherDomReady", !0);
},
beforeUnmount() {
this.executeCleanup();
},
beforeDestroy() {
this.executeCleanup();
},
methods: {
executeCleanup() {
p.logger.info("trtc-pusher detached"), l.emit("pusherDomReady", !1), this.unbindTRTCCloudEvent(), p.exitRoom();
},
pusherAttributesChange(t) {
const { pusher: o, callback: r } = t;
this.pusher = { ...this.pusher, ...o }, r && this.$nextTick(r);
},
playerAudioRouteChange(t) {
const { soundMode: o, callback: r } = t;
this.soundMode = o, r && r();
},
bindTRTCCloudEvent() {
l.on("pusherAttributesChange", this.pusherAttributesChange), l.on("playerAudioRouteChange", this.playerAudioRouteChange);
},
unbindTRTCCloudEvent() {
l.off("pusherAttributesChange", this.pusherAttributesChange), l.off("playerAudioRouteChange", this.playerAudioRouteChange);
},
handleStateChange(t) {
u.pusherEventHandler(t);
},
handleNetStatus(t) {
u.pusherNetStatusHandler(t);
},
handleError(t) {
u.pusherErrorHandler(t);
},
handleBGMStart(t) {
u.pusherBGMStartHandler(t);
},
handleBGMProgress(t) {
u.pusherBGMProgressHandler(t);
},
handleBGMComplete(t) {
u.pusherBGMCompleteHandler(t);
},
handleAudioVolumeNotify(t) {
p.isEnterRoom && u.pusherAudioVolumeNotify(t);
}
}
}, I = { class: "trtc-pusher-container" };
function A(t, o, r, n, e, a) {
const d = m("live-pusher"), T = m("live-player");
return h(), y("div", I, [
g(d, {
class: "trtc-pusher",
url: e.pusher.url,
mode: "HD",
autopush: e.pusher.autopush,
"enable-camera": e.pusher.enableCamera,
"enable-mic": e.pusher.enableMic,
muted: e.pusher.muted,
"enable-agc": e.pusher.enableAgc,
"enable-ans": e.pusher.enableAns,
"enable-ear-monitor": e.pusher.enableEarMonitor,
"auto-focus": e.pusher.enableAutoFocus,
zoom: e.pusher.enableZoom,
"min-bitrate": e.pusher.minBitrate,
"max-bitrate": e.pusher.maxBitrate,
"video-width": e.pusher.videoWidth,
"video-height": e.pusher.videoHeight,
beauty: e.pusher.beautyLevel,
whiteness: e.pusher.whitenessLevel,
orientation: e.pusher.videoOrientation,
aspect: e.pusher.videoAspect,
"device-position": e.pusher.frontCamera,
"remote-mirror": e.pusher.enableRemoteMirror,
"local-mirror": e.pusher.localMirror,
"background-mute": e.pusher.enableBackgroundMute,
"audio-quality": e.pusher.audioQuality,
"audio-volume-type": e.pusher.audioVolumeType,
"audio-reverb-type": e.pusher.audioReverbType,
"waiting-image": e.pusher.waitingImage,
"beauty-style": e.pusher.beautyStyle,
fps: e.pusher.fps,
filter: e.pusher.filter,
onStatechange: a.handleStateChange,
onNetstatus: a.handleNetStatus,
onError: a.handleError,
onBgmstart: a.handleBGMStart,
onBgmprogress: a.handleBGMProgress,
onBgmcomplete: a.handleBGMComplete,
onAudiovolumenotify: a.handleAudioVolumeNotify
}, null, 8, ["url", "autopush", "enable-camera", "enable-mic", "muted", "enable-agc", "enable-ans", "enable-ear-monitor", "auto-focus", "zoom", "min-bitrate", "max-bitrate", "video-width", "video-height", "beauty", "whiteness", "orientation", "aspect", "device-position", "remote-mirror", "local-mirror", "background-mute", "audio-quality", "audio-volume-type", "audio-reverb-type", "waiting-image", "beauty-style", "fps", "filter", "onStatechange", "onNetstatus", "onError", "onBgmstart", "onBgmprogress", "onBgmcomplete", "onAudiovolumenotify"]),
g(T, {
class: "trtc-player",
"sound-mode": e.soundMode
}, null, 8, ["sound-mode"])
]);
}
const S = /* @__PURE__ */ f(R, [["render", A], ["__scopeId", "data-v-c40920dd"]]);
const s = b.getTRTCShareInstance(), c = s.trtc, i = s.InterfaceEventEmitter, E = {
name: "TRTCPlayer",
props: {
streamId: {
type: String,
default: ""
}
},
data() {
return {
player: {},
TRTCStreamId: "",
soundMode: ""
};
},
watch: {
streamId(t) {
this.setTRTCStreamId(t);
}
},
mounted() {
s.logger.info("trtc-player attached", this.streamId), this.streamId && i.emit("playerDomReady", { isReady: !0, view: this.streamId }), this.TRTCStreamId = this.getTRTCStreamId(this.streamId), this.bindTRTCCloudEvent();
},
beforeUnmount() {
this.executeCleanup();
},
beforeDestroy() {
this.executeCleanup();
},
methods: {
executeCleanup() {
s.logger.info("trtc-player detached", this.streamId), i.emit("playerDomReady", { isReady: !1, streamId: this.streamId }), this.unbindTRTCCloudEvent();
},
setTRTCStreamId(t) {
return s.logger.info("trtc-player setTRTCStreamId", t), new Promise((o, r) => {
try {
this.$emit("update:streamId", t), this.TRTCStreamId = this.getTRTCStreamId(t), this.$nextTick(() => {
s.logger.info("trtc-player setTRTCStreamId success", t), o(), i.emit("playerDomReady", { isReady: !0, view: t });
});
} catch (n) {
s.logger.info("trtc-player setTRTCStreamId fail", t, n), r(n);
}
});
},
// 其他方法保持原有逻辑...
getTRTCStreamId(t) {
const o = t.split("_"), r = o.slice(0, -1).join("_"), n = Number(o[o.length - 1]);
return v(r, n);
},
bindTRTCCloudEvent() {
i.on("playerAttributesChange", this.playerAttributesChange), i.on("playerAudioRouteChange", this.playerAudioRouteChange);
},
unbindTRTCCloudEvent() {
i.off("playerAttributesChange", this.playerAttributesChange), i.off("playerAudioRouteChange", this.playerAudioRouteChange);
},
playerAttributesChange(t) {
const { view: o, playerAttributes: r, callback: n } = t;
o === this.streamId && (this.player = { ...this.player, ...r }, n && n());
},
playerAudioRouteChange(t) {
const { soundMode: o, callback: r } = t;
this.soundMode = o, r && r();
},
_playerStateChange(t) {
c.playerEventHandler(t);
},
_playerFullscreenChange(t) {
c.playerFullscreenChange(t);
},
_playerNetStatus(t) {
c.playerNetStatus(t);
},
_playerAudioVolumeNotify(t) {
try {
t.currentTarget.dataset.streamid = this.player.streamID, c.playerAudioVolumeNotify(t);
} catch (o) {
s.logger.warn(o);
}
}
}
}, M = { class: "trtc-player-container" }, x = {
key: 1,
class: "trtc-dark-mask"
};
function B(t, o, r, n, e, a) {
const d = m("live-player");
return h(), y("div", M, [
r.streamId ? (h(), _(d, {
key: 0,
class: "trtc-player",
id: e.player.streamID,
"data-userid": e.player.userID,
"data-streamid": e.player.streamID,
"data-streamtype": e.player.streamType,
src: e.player.src,
mode: "RTC",
autoplay: e.player.autoplay,
"mute-audio": e.player.muteAudio,
"mute-video": e.player.muteVideo,
orientation: e.player.orientation,
"object-fit": e.player.objectFit,
"background-mute": e.player.enableBackgroundMute,
"min-cache": e.player.minCache,
"max-cache": e.player.maxCache,
"sound-mode": e.soundMode,
"enable-recv-message": e.player.enableRecvMessage,
"auto-pause-if-navigate": e.player.autoPauseIfNavigate,
"auto-pause-if-open-native": e.player.autoPauseIfOpenNative,
debug: e.player.debug,
onStatechange: a._playerStateChange,
onFullscreenchange: a._playerFullscreenChange,
onNetstatus: a._playerNetStatus,
onAudiovolumenotify: a._playerAudioVolumeNotify
}, null, 8, ["id", "data-userid", "data-streamid", "data-streamtype", "src", "autoplay", "mute-audio", "mute-video", "orientation", "object-fit", "background-mute", "min-cache", "max-cache", "sound-mode", "enable-recv-message", "auto-pause-if-navigate", "auto-pause-if-open-native", "debug", "onStatechange", "onFullscreenchange", "onNetstatus", "onAudiovolumenotify"])) : C("", !0),
e.player.stopVideo ? (h(), y("div", x)) : C("", !0)
]);
}
const N = /* @__PURE__ */ f(E, [["render", B], ["__scopeId", "data-v-645a3f31"]]), P = (t) => {
t.component("TRTCPusher", S), t.component("TRTCPlayer", N);
};
export {
N as TRTCPlayer,
S as TRTCPusher,
H as default,
P as install
};
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
.trtc-pusher-container[data-v-c40920dd]{height:100%;width:100%;position:relative}.trtc-pusher[data-v-c40920dd]{height:100%;width:100%}.trtc-player[data-v-c40920dd]{width:0;height:0;display:flex}.trtc-player-container[data-v-645a3f31]{height:100%;width:100%;position:relative}.trtc-player[data-v-645a3f31]{height:100%;width:100%}.trtc-dark-mask[data-v-645a3f31]{width:100%;height:100%;background-color:#000;position:absolute;top:0}
+35
View File
@@ -0,0 +1,35 @@
{
"name": "@tencentcloud/trtc-component-uniapp",
"version": "1.0.5",
"description": "TRTC Uni-app Components for WeChat Mini Program",
"main": "dist/index.js",
"files": [
"dist",
"src"
],
"scripts": {
"dev": "vite",
"build": "vite build",
"prepublishOnly": "npm run build"
},
"peerDependencies": {
"@tencentcloud/trtc-cloud-wx": "^1.0.7"
},
"devDependencies": {
"vue": "^2.6.0 || >=3.0.0",
"@vitejs/plugin-vue": "^4.5.0",
"vite": "^4.5.0",
"typescript": "^5.0.2",
"vue-tsc": "^1.8.5"
},
"keywords": [
"trtc",
"uni-app",
"wechat",
"video-call",
"rtc"
],
"author": "Your Name",
"license": "MIT"
}
@@ -0,0 +1,164 @@
<template>
<div class="trtc-player-container">
<live-player
v-if="streamId"
class="trtc-player"
:id="player.streamID"
:data-userid="player.userID"
:data-streamid="player.streamID"
:data-streamtype="player.streamType"
:src="player.src"
mode="RTC"
:autoplay="player.autoplay"
:mute-audio="player.muteAudio"
:mute-video="player.muteVideo"
:orientation="player.orientation"
:object-fit="player.objectFit"
:background-mute="player.enableBackgroundMute"
:min-cache="player.minCache"
:max-cache="player.maxCache"
:sound-mode="soundMode"
:enable-recv-message="player.enableRecvMessage"
:auto-pause-if-navigate="player.autoPauseIfNavigate"
:auto-pause-if-open-native="player.autoPauseIfOpenNative"
:debug="player.debug"
@statechange="_playerStateChange"
@fullscreenchange="_playerFullscreenChange"
@netstatus="_playerNetStatus"
@audiovolumenotify="_playerAudioVolumeNotify"
/>
<div v-if="player.stopVideo" class="trtc-dark-mask"></div>
</div>
</template>
<script>
import TRTCCloud, { translateTRTCStreamId } from '@tencentcloud/trtc-cloud-wx'
const trtcCloud = TRTCCloud.getTRTCShareInstance()
const trtc = trtcCloud.trtc
const InterfaceEventEmitter = trtcCloud.InterfaceEventEmitter
export default {
name: 'TRTCPlayer',
props: {
streamId: {
type: String,
default: ''
}
},
data() {
return {
player: {},
TRTCStreamId: '',
soundMode: ''
}
},
watch: {
streamId(newVal) {
this.setTRTCStreamId(newVal)
}
},
mounted() {
trtcCloud.logger.info('trtc-player attached', this.streamId)
if (this.streamId) {
InterfaceEventEmitter.emit('playerDomReady', { isReady: true, view: this.streamId })
}
this.TRTCStreamId = this.getTRTCStreamId(this.streamId)
this.bindTRTCCloudEvent()
},
beforeUnmount() {
this.executeCleanup()
},
beforeDestroy() {
this.executeCleanup()
},
methods: {
executeCleanup() {
trtcCloud.logger.info('trtc-player detached', this.streamId)
InterfaceEventEmitter.emit('playerDomReady', { isReady: false, streamId: this.streamId })
this.unbindTRTCCloudEvent()
},
setTRTCStreamId(id) {
trtcCloud.logger.info('trtc-player setTRTCStreamId', id)
return new Promise((resolve, reject) => {
try {
this.$emit('update:streamId', id)
this.TRTCStreamId = this.getTRTCStreamId(id)
this.$nextTick(() => {
trtcCloud.logger.info('trtc-player setTRTCStreamId success', id)
resolve()
InterfaceEventEmitter.emit('playerDomReady', { isReady: true, view: id })
})
} catch (err) {
trtcCloud.logger.info('trtc-player setTRTCStreamId fail', id, err)
reject(err)
}
})
},
// ...
getTRTCStreamId(streamId) {
const tempArray = streamId.split('_')
const userId = tempArray.slice(0, -1).join('_')
const streamType = Number(tempArray[tempArray.length - 1])
return translateTRTCStreamId(userId, streamType)
},
bindTRTCCloudEvent() {
InterfaceEventEmitter.on('playerAttributesChange', this.playerAttributesChange)
InterfaceEventEmitter.on('playerAudioRouteChange', this.playerAudioRouteChange)
},
unbindTRTCCloudEvent() {
InterfaceEventEmitter.off('playerAttributesChange', this.playerAttributesChange)
InterfaceEventEmitter.off('playerAudioRouteChange', this.playerAudioRouteChange)
},
playerAttributesChange(event) {
const { view, playerAttributes, callback } = event
if (view === this.streamId) {
this.player = { ...this.player, ...playerAttributes }
callback && callback()
}
},
playerAudioRouteChange(event) {
const { soundMode, callback } = event
this.soundMode = soundMode
callback && callback()
},
_playerStateChange(event) {
trtc.playerEventHandler(event)
},
_playerFullscreenChange(event) {
trtc.playerFullscreenChange(event)
},
_playerNetStatus(event) {
trtc.playerNetStatus(event)
},
_playerAudioVolumeNotify(event) {
try {
event.currentTarget.dataset.streamid = this.player.streamID
trtc.playerAudioVolumeNotify(event)
} catch (err) {
trtcCloud.logger.warn(err)
}
}
}
}
</script>
<style scoped>
.trtc-player-container {
height: 100%;
width: 100%;
position: relative;
}
.trtc-player {
height: 100%;
width: 100%;
}
.trtc-dark-mask {
width: 100%;
height: 100%;
background-color: black;
position: absolute;
top: 0;
}
</style>
@@ -0,0 +1,142 @@
<template>
<div class="trtc-pusher-container">
<live-pusher
class="trtc-pusher"
:url="pusher.url"
mode="HD"
:autopush="pusher.autopush"
:enable-camera="pusher.enableCamera"
:enable-mic="pusher.enableMic"
:muted="pusher.muted"
:enable-agc="pusher.enableAgc"
:enable-ans="pusher.enableAns"
:enable-ear-monitor="pusher.enableEarMonitor"
:auto-focus="pusher.enableAutoFocus"
:zoom="pusher.enableZoom"
:min-bitrate="pusher.minBitrate"
:max-bitrate="pusher.maxBitrate"
:video-width="pusher.videoWidth"
:video-height="pusher.videoHeight"
:beauty="pusher.beautyLevel"
:whiteness="pusher.whitenessLevel"
:orientation="pusher.videoOrientation"
:aspect="pusher.videoAspect"
:device-position="pusher.frontCamera"
:remote-mirror="pusher.enableRemoteMirror"
:local-mirror="pusher.localMirror"
:background-mute="pusher.enableBackgroundMute"
:audio-quality="pusher.audioQuality"
:audio-volume-type="pusher.audioVolumeType"
:audio-reverb-type="pusher.audioReverbType"
:waiting-image="pusher.waitingImage"
:beauty-style="pusher.beautyStyle"
:fps="pusher.fps"
:filter="pusher.filter"
@statechange="handleStateChange"
@netstatus="handleNetStatus"
@error="handleError"
@bgmstart="handleBGMStart"
@bgmprogress="handleBGMProgress"
@bgmcomplete="handleBGMComplete"
@audiovolumenotify="handleAudioVolumeNotify"
/>
<live-player class="trtc-player" :sound-mode="soundMode"></live-player>
</div>
</template>
<script>
import TRTCCloud from '@tencentcloud/trtc-cloud-wx'
const trtcCloud = TRTCCloud.getTRTCShareInstance()
const trtc = trtcCloud.trtc
const InterfaceEventEmitter = trtcCloud.InterfaceEventEmitter
export default {
name: 'TRTCPusher',
data() {
return {
pusher: {},
soundMode: ''
}
},
mounted() {
trtcCloud.logger.info('trtc-pusher attached')
this.bindTRTCCloudEvent()
InterfaceEventEmitter.emit('pusherDomReady', true)
},
beforeUnmount() {
this.executeCleanup()
},
beforeDestroy() {
this.executeCleanup()
},
methods: {
executeCleanup() {
trtcCloud.logger.info('trtc-pusher detached')
InterfaceEventEmitter.emit('pusherDomReady', false)
this.unbindTRTCCloudEvent()
trtcCloud.exitRoom()
},
pusherAttributesChange(event) {
const { pusher, callback } = event
this.pusher = { ...this.pusher, ...pusher }
callback && this.$nextTick(callback)
},
playerAudioRouteChange(event) {
const { soundMode, callback } = event
this.soundMode = soundMode
callback && callback()
},
bindTRTCCloudEvent() {
InterfaceEventEmitter.on('pusherAttributesChange', this.pusherAttributesChange)
InterfaceEventEmitter.on('playerAudioRouteChange', this.playerAudioRouteChange)
},
unbindTRTCCloudEvent() {
InterfaceEventEmitter.off('pusherAttributesChange', this.pusherAttributesChange)
InterfaceEventEmitter.off('playerAudioRouteChange', this.playerAudioRouteChange)
},
handleStateChange(event) {
trtc.pusherEventHandler(event)
},
handleNetStatus(event) {
trtc.pusherNetStatusHandler(event)
},
handleError(event) {
trtc.pusherErrorHandler(event)
},
handleBGMStart(event) {
trtc.pusherBGMStartHandler(event)
},
handleBGMProgress(event) {
trtc.pusherBGMProgressHandler(event)
},
handleBGMComplete(event) {
trtc.pusherBGMCompleteHandler(event)
},
handleAudioVolumeNotify(event) {
if (!trtcCloud.isEnterRoom) return
trtc.pusherAudioVolumeNotify(event)
}
}
}
</script>
<style scoped>
.trtc-pusher-container {
height: 100%;
width: 100%;
position: relative;
}
.trtc-pusher {
height: 100%;
width: 100%;
}
.trtc-player {
width: 0;
height: 0;
display: flex;
}
</style>
+20
View File
@@ -0,0 +1,20 @@
import TRTCCloud from '@tencentcloud/trtc-cloud-wx'
import TRTCPusher from './components/TRTCPusher.vue'
import TRTCPlayer from './components/TRTCPlayer.vue'
// 导出TRTCCloud所有功能
export * from '@tencentcloud/trtc-cloud-wx'
// 导出Vue组件
export { TRTCPusher, TRTCPlayer }
// 默认导出TRTCCloud实例
export default TRTCCloud
// 添加自动安装功能
const install = (app) => {
app.component('TRTCPusher', TRTCPusher)
app.component('TRTCPlayer', TRTCPlayer)
}
export { install }
+11
View File
@@ -0,0 +1,11 @@
{
"plugins": [
["module-resolver", {
"root": ["./src"],
"alias": {}
}]
],
"presets": [
["env", {"loose": true, "modules": "commonjs"}]
]
}
+101
View File
@@ -0,0 +1,101 @@
module.exports = {
'extends': [
'airbnb-base',
'plugin:promise/recommended'
],
'parser': '@typescript-eslint/parser',
'plugins': ['@typescript-eslint'],
'parserOptions': {
'ecmaVersion': 9,
'ecmaFeatures': {
'jsx': false
},
'sourceType': 'module'
},
'env': {
'es6': true,
'node': true,
'jest': true
},
'plugins': [
'import',
'node',
'promise'
],
'rules': {
'arrow-parens': 'off',
'comma-dangle': [
'error',
'only-multiline'
],
'complexity': ['error', 20],
'func-names': 'off',
'global-require': 'off',
'handle-callback-err': [
'error',
'^(err|error)$'
],
'import/no-unresolved': [
'error',
{
'caseSensitive': true,
'commonjs': true,
'ignore': ['^[^.]']
}
],
'import/prefer-default-export': 'off',
'linebreak-style': 'off',
'no-catch-shadow': 'error',
'no-continue': 'off',
'no-div-regex': 'warn',
'no-else-return': 'off',
'no-param-reassign': 'off',
'no-plusplus': 'off',
'no-shadow': 'off',
'no-multi-assign': 'off',
'no-underscore-dangle': 'off',
'node/no-deprecated-api': 'error',
'node/process-exit-as-throw': 'error',
'object-curly-spacing': [
'error',
'never'
],
'operator-linebreak': [
'error',
'after',
{
'overrides': {
':': 'before',
'?': 'before'
}
}
],
'prefer-arrow-callback': 'off',
'prefer-destructuring': 'off',
'prefer-template': 'off',
'quote-props': [
1,
'as-needed',
{
'unnecessary': true
}
],
'semi': [
'error',
'never'
],
'no-await-in-loop': 'off',
'no-restricted-syntax': 'off',
'promise/always-return': 'off',
},
'globals': {
'window': true,
'document': true,
'App': true,
'Page': true,
'Component': true,
'Behavior': true,
'wx': true,
'getCurrentPages': true,
}
}
+15
View File
@@ -0,0 +1,15 @@
## 2024.12.03@1.0.3
**Feature**
- 升级 [@tencentcloud/trtc-cloud-wx](https://www.npmjs.com/package/@tencentcloud/trtc-cloud-wx) 到 v1.0.2 版本。
**Fix**
- 修复 live-pusher 不销毁 exitRoom 无法再次进房 bug
## 2024.12.03@1.0.3
**Feature**
- 升级 [@tencentcloud/trtc-cloud-wx](https://www.npmjs.com/package/@tencentcloud/trtc-cloud-wx) 到 v1.0.1 版本。
**Fix**
- 修复 switchCamera 多次调用会出现一次设置无效问题
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+131
View File
@@ -0,0 +1,131 @@
# miniprogram-custom-component
小程序自定义组件开发模板:
* 支持使用 less 语法编写 wxss 文件
* 使用 webpack 构建 js
* 支持自定义组件单元测试
* 支持 eslint
* 支持多入口构建
## 使用
* 使用[命令行工具](https://github.com/wechat-miniprogram/miniprogram-cli)进行初始化
* 直接从 github 上 clone 下来
## 开发
1. 安装依赖:
```
npm install
```
2. 执行命令:
```
npm run dev
```
默认会在包根目录下生成 miniprogram\_dev 目录,src 中的源代码会被构建并生成到 miniprogram\_dev/components 目录下。如果需要监听文件变化动态构建,则可以执行命令:
```
npm run watch
```
> ps: 如果 minirpogram\_dev 目录下已存在小程序 demo,执行`npm run dev`则不会再将 tools 下的 demo 拷贝到此目录下。而执行`npm run watch`则会监听 tools 目录下的 demo 变动并进行拷贝。
3. 生成的 miniprogram\_dev 目录是一个小程序项目目录,以此目录作为小程序项目目录在开发者工具中打开即可查看自定义组件被使用的效果。
4. 进阶:
* 如果有额外的构建需求,可自行修改 tools 目录中的构建脚本。
* 内置支持 webpack、less 语法、sourcemap 等功能,默认关闭。如若需要可以自行修改 tools/config.js 配置文件中相关配置。
* 内置支持多入口构建,如若需要可自行调整 tools/config.js 配置文件的 entry 字段。
* 默认开启 eslint,可自行调整规则或在 tools/config.js 中注释掉 eslint-loader 行来关闭此功能。
## 发布
> ps: 发布前得确保已经执行构建,小程序 npm 包只有构建出来的目录是真正被使用到的。
1. 如果还没有 npm 帐号,可以到[ npm 官网](https://www.npmjs.com/)注册一个 npm 帐号。
2. 在本地登录 npm 帐号,在本地执行:
```
npm adduser
```
或者
```
npm login
```
3. 在已完成编写的 npm 包根目录下执行:
```
npm publish
```
到此,npm 包就成功发布到 npm 平台了。
> PS:一些开发者在开发过程中可能修改过 npm 的源,所以当进行登录或发布时需要注意要将源切回 npm 的源。
## 目录结构
以下为推荐使用的目录结构,如果有必要开发者也可以自行做一些调整:
```
|--miniprogram_dev // 开发环境构建目录
|--miniprogram_dist // 生产环境构建目录
|--src // 源码
| |--components // 通用自定义组件
| |--images // 图片资源
| |
| |--xxx.js/xxx.wxml/xxx.json/xxx.wxss // 暴露的 js 模块/自定义组件入口文件
|
|--test // 测试用例
|--tools // 构建相关代码
| |--demo // demo 小程序目录,开发环境下会被拷贝生成到 miniprogram_dev 目录中
| |--config.js // 构建相关配置文件
|
|--gulpfile.js
```
> PS:对外暴露的 js 模块/自定义组件请放在 src 目录下,不宜放置在过深的目录。另外新增的暴露模块需要在 tools/config.js 的 entry 字段中补充,不然不会进行构建。
## 测试
* 执行测试用例:
```
npm run test
```
* 执行测试用例并进入 node inspect 调试:
```
npm run test-debug
```
* 检测覆盖率:
```
npm run coverage
```
测试用例放在 test 目录下,使用 **miniprogram-simulate** 工具集进行测试,[点击此处查看](https://github.com/wechat-miniprogram/miniprogram-simulate/blob/master/README.md)使用方法。在测试中可能需要变更或调整工具集中的一些方法,可在 test/utils 下自行实现。
## 其他命令
* 清空 miniprogram_dist 目录:
```
npm run clean
```
* 清空 miniprogam_dev 目录:
```
npm run clean-dev
```
+19
View File
@@ -0,0 +1,19 @@
const fs = require('fs')
const path = require('path')
const sourceDir = '/Users/connor/Desktop/work/TRTCCloud-wx/trtc-component-wx/miniprogram_dist'
const targetDir = '/Users/connor/Desktop/TUIRoomEngine/samples/tui-room-uniapp/dist/dev/mp-weixin/node_modules/@tencentcloud/trtc-component-wx/miniprogram_dist'
fs.readdir(sourceDir, (err, files) => {
if (err) throw err
files.forEach((file) => {
const sourceFile = path.join(sourceDir, file)
const targetFile = path.join(targetDir, file)
fs.copyFile(sourceFile, targetFile, (err) => {
if (err) throw err
console.log(`${sourceFile} was copied to ${targetFile}`)
})
})
})
+26
View File
@@ -0,0 +1,26 @@
const gulp = require('gulp')
const clean = require('gulp-clean')
const config = require('./tools/config')
const BuildTask = require('./tools/build')
const id = require('./package.json').name || 'miniprogram-custom-component'
// 构建任务实例
// eslint-disable-next-line no-new
new BuildTask(id, config.entry)
// 清空生成目录和文件
gulp.task('clean', gulp.series(() => gulp.src(config.distPath, {read: false, allowEmpty: true}).pipe(clean()), done => {
if (config.isDev) {
return gulp.src(config.demoDist, {read: false, allowEmpty: true})
.pipe(clean())
}
return done()
}))
// 监听文件变化并进行开发模式构建
gulp.task('watch', gulp.series(`${id}-watch`))
// 开发模式构建
gulp.task('dev', gulp.series(`${id}-dev`))
// 生产模式构建
gulp.task('default', gulp.series(`${id}-default`))
@@ -0,0 +1,125 @@
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 3);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
module.exports = require("@tencentcloud/trtc-cloud-wx");
/***/ }),
/* 1 */,
/* 2 */,
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _trtcCloudWx = __webpack_require__(0);
Object.keys(_trtcCloudWx).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _trtcCloudWx[key];
}
});
});
var _trtcCloudWx2 = _interopRequireDefault(_trtcCloudWx);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _trtcCloudWx2.default;
/***/ })
/******/ ]);
//# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@tencentcloud/trtc-cloud-wx\"","webpack:///./src/index.js"],"names":["TRTCCloud"],"mappings":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;AClFA,wD;;;;;;;;;;;;;ACAA;;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;kBACeA,qB","file":"index.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 3);\n","module.exports = require(\"@tencentcloud/trtc-cloud-wx\");","import TRTCCloud from '@tencentcloud/trtc-cloud-wx'\n\nexport * from '@tencentcloud/trtc-cloud-wx'\nexport default TRTCCloud\n"],"sourceRoot":""}
@@ -0,0 +1,213 @@
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 2);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
module.exports = require("@tencentcloud/trtc-cloud-wx");
/***/ }),
/* 1 */,
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _trtcCloudWx = __webpack_require__(0);
var _trtcCloudWx2 = _interopRequireDefault(_trtcCloudWx);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var trtcCloud = _trtcCloudWx2.default.getTRTCShareInstance();
var trtc = trtcCloud.trtc;
var InterfaceEventEmitter = trtcCloud.InterfaceEventEmitter;
Component({
properties: {
streamId: String
},
data: {
player: {},
TRTCStreamId: '',
soundMode: ''
},
lifetimes: {
attached: function attached() {
trtcCloud.logger.info('trtc-player attached', this.data.streamId);
if (this.data.streamId) {
InterfaceEventEmitter.emit('playerDomReady', { isReady: true, view: this.data.streamId });
}
this.data.TRTCStreamId = this.getTRTCStreamId(this.data.streamId);
this.bindTRTCCloudEvent();
},
detached: function detached() {
trtcCloud.logger.info('trtc-player detached', this.data.streamId);
InterfaceEventEmitter.emit('playerDomReady', { isReady: false, streamId: this.data.streamId });
this.unbindTRTCCloudEvent();
}
},
methods: {
// todo room uniapp 特供,因为 uniapp 打包导致组件传惨变量名更替 trtc-player 组建内部无法识别
setTRTCStreamId: function setTRTCStreamId(id) {
var _this = this;
trtcCloud.logger.info('trtc-player setTRTCStreamId', id);
return new Promise(function (resolve, reject) {
try {
_this.data.streamId = id;
_this.data.TRTCStreamId = _this.getTRTCStreamId(id);
_this.setData({ streamId: _this.data.streamId }, function () {
trtcCloud.logger.info('trtc-player setTRTCStreamId success', id);
resolve();
InterfaceEventEmitter.emit('playerDomReady', { isReady: true, view: id });
});
} catch (err) {
trtcCloud.logger.info('trtc-player setTRTCStreamId fail', id, err);
reject(err);
}
});
},
playerAttributesChange: function playerAttributesChange(event) {
var view = event.view,
playerAttributes = event.playerAttributes,
callback = event.callback;
trtcCloud.logger.info('trtc-player playerAttributesChange', view, JSON.stringify(playerAttributes), this.data.streamId);
if (view === this.data.streamId) {
this.setData({ player: playerAttributes }, callback);
}
},
playerAudioRouteChange: function playerAudioRouteChange(event) {
var soundMode = event.soundMode,
callback = event.callback;
trtcCloud.logger.info('trtc-player playerAudioRouteChange', soundMode);
this.setData({ soundMode: soundMode }, callback);
},
getTRTCStreamId: function getTRTCStreamId(streamId) {
var tempArray = streamId.split('_');
var userId = tempArray.slice(0, -1).join('_');
var streamType = Number(tempArray[tempArray.length - 1]);
return (0, _trtcCloudWx.translateTRTCStreamId)(userId, streamType);
},
bindTRTCCloudEvent: function bindTRTCCloudEvent() {
InterfaceEventEmitter.on('playerAttributesChange', this.playerAttributesChange, this);
InterfaceEventEmitter.on('playerAudioRouteChange', this.playerAudioRouteChange, this);
},
unbindTRTCCloudEvent: function unbindTRTCCloudEvent() {
InterfaceEventEmitter.off('playerAttributesChange', this.playerAttributesChange);
InterfaceEventEmitter.off('playerAudioRouteChange', this.playerAudioRouteChange);
},
// 请保持跟 wxml 中绑定的事件名称一致
_playerStateChange: function _playerStateChange(event) {
trtc.playerEventHandler(event);
},
_playerFullscreenChange: function _playerFullscreenChange(event) {
trtc.playerFullscreenChange(event);
},
_playerNetStatus: function _playerNetStatus(event) {
trtc.playerNetStatus(event);
},
_playerAudioVolumeNotify: function _playerAudioVolumeNotify(event) {
try {
event.currentTarget.dataset.streamid = this.data.player.streamID;
trtc.playerAudioVolumeNotify(event);
} catch (err) {
trtcCloud.logger.warn(err);
}
}
}
});
/***/ })
/******/ ]);
//# sourceMappingURL=trtc-player.js.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}
@@ -0,0 +1,12 @@
<view class="trtc-player-container">
<live-player wx:if="{{streamId}}" class="trtc-player" id="{{player.streamID}}" data-userid="{{player.userID}}"
data-streamid="{{player.streamID}}" data-streamtype="{{player.streamType}}" src="{{player.src}}" mode="RTC"
autoplay="{{player.autoplay}}" mute-audio="{{player.muteAudio}}" mute-video="{{player.muteVideo}}"
orientation="{{player.orientation}}" object-fit="{{player.objectFit}}"
background-mute="{{player.enableBackgroundMute}}" min-cache="{{player.minCache}}" max-cache="{{player.maxCache}}"
sound-mode="{{soundMode}}" enable-recv-message="{{player.enableRecvMessage}}"
auto-pause-if-navigate="{{player.autoPauseIfNavigate}}" auto-pause-if-open-native="{{player.autoPauseIfOpenNative}}"
debug="{{player.debug}}" bindstatechange="_playerStateChange" bindfullscreenchange="_playerFullscreenChange"
bindnetstatus="_playerNetStatus" bindaudiovolumenotify="_playerAudioVolumeNotify" />
<view wx:if="{{player.stopVideo}}" class="trtc-dark-mask"></view>
</view>
@@ -0,0 +1,16 @@
.trtc-player-container {
height: 100%;
width: 100%;
position: relative;
}
.trtc-player {
height: 100%;
width: 100%;
}
.trtc-dark-mask {
width: 100%;
height: 100%;
background-color: black;
position: absolute;
top: 0;
}
@@ -0,0 +1,184 @@
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 1);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
module.exports = require("@tencentcloud/trtc-cloud-wx");
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _trtcCloudWx = __webpack_require__(0);
var _trtcCloudWx2 = _interopRequireDefault(_trtcCloudWx);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var trtcCloud = _trtcCloudWx2.default.getTRTCShareInstance();
var trtc = trtcCloud.trtc;
var InterfaceEventEmitter = trtcCloud.InterfaceEventEmitter;
Component({
properties: {},
data: {
pusher: {}
},
lifetimes: {
attached: function attached() {
trtcCloud.logger.info('trtc-pusher attached');
this.bindTRTCCloudEvent();
// 注意事件绑定应该放在 domReady 之前,因为此时出发 domReady 会执行 ready 后的后续操作依赖 bindTRTCCloudEvent
InterfaceEventEmitter.emit('pusherDomReady', true);
},
detached: function detached() {
trtcCloud.logger.info('trtc-pusher detached');
InterfaceEventEmitter.emit('pusherDomReady', false);
this.unbindTRTCCloudEvent();
trtcCloud.exitRoom();
}
},
methods: {
pusherAttributesChange: function pusherAttributesChange(event) {
var pusher = event.pusher,
callback = event.callback;
this.setData({ pusher: pusher }, callback);
},
playerAudioRouteChange: function playerAudioRouteChange(event) {
var soundMode = event.soundMode,
callback = event.callback;
trtcCloud.logger.info('trtc-player playerAudioRouteChange', soundMode);
this.setData({ soundMode: soundMode }, callback);
},
bindTRTCCloudEvent: function bindTRTCCloudEvent() {
InterfaceEventEmitter.on('pusherAttributesChange', this.pusherAttributesChange, this);
InterfaceEventEmitter.on('playerAudioRouteChange', this.playerAudioRouteChange, this);
},
unbindTRTCCloudEvent: function unbindTRTCCloudEvent() {
InterfaceEventEmitter.off('pusherAttributesChange', this.pusherAttributesChange);
InterfaceEventEmitter.off('playerAudioRouteChange', this.playerAudioRouteChange);
},
// 请保持跟 wxml 中绑定的事件名称一致
_pusherStateChangeHandler: function _pusherStateChangeHandler(event) {
trtc.pusherEventHandler(event);
},
_pusherNetStatusHandler: function _pusherNetStatusHandler(event) {
trtc.pusherNetStatusHandler(event);
},
_pusherErrorHandler: function _pusherErrorHandler(event) {
trtc.pusherErrorHandler(event);
},
_pusherBGMStartHandler: function _pusherBGMStartHandler(event) {
trtc.pusherBGMStartHandler(event);
},
_pusherBGMProgressHandler: function _pusherBGMProgressHandler(event) {
trtc.pusherBGMProgressHandler(event);
},
_pusherBGMCompleteHandler: function _pusherBGMCompleteHandler(event) {
trtc.pusherBGMCompleteHandler(event);
},
_pusherAudioVolumeNotify: function _pusherAudioVolumeNotify(event) {
if (!trtcCloud.isEnterRoom) {
return;
}
trtc.pusherAudioVolumeNotify(event);
}
}
});
/***/ })
/******/ ]);
//# sourceMappingURL=trtc-pusher.js.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}
@@ -0,0 +1,22 @@
<view class="trtc-pusher-container">
<live-pusher class="trtc-pusher" url="{{pusher.url}}" mode="{{'HD'}}" autopush="{{pusher.autopush}}"
enable-camera="{{pusher.enableCamera}}" enable-mic="{{pusher.enableMic}}" muted="{{pusher.muted}}"
enable-agc="{{pusher.enableAgc}}" enable-ans="{{pusher.enableAns}}"
enable-ear-monitor="{{pusher.enableEarMonitor}}" auto-focus="{{pusher.enableAutoFocus}}"
zoom="{{pusher.enableZoom}}" min-bitrate="{{pusher.minBitrate}}" max-bitrate="{{pusher.maxBitrate}}"
video-width="{{pusher.videoWidth}}" video-height="{{pusher.videoHeight}}" beauty="{{pusher.beautyLevel}}"
whiteness="{{pusher.whitenessLevel}}" orientation="{{pusher.videoOrientation}}" aspect="{{pusher.videoAspect}}"
device-position="{{pusher.frontCamera}}" remote-mirror="{{pusher.enableRemoteMirror}}"
local-mirror="{{pusher.localMirror}}" background-mute="{{pusher.enableBackgroundMute}}"
audio-quality="{{pusher.audioQuality}}" audio-volume-type="{{pusher.audioVolumeType}}"
audio-reverb-type="{{pusher.audioReverbType}}" waiting-image="{{pusher.waitingImage}}"
beauty-style="{{pusher.beautyStyle}}" fps="{{pusher.fps}}" filter="{{pusher.filter}}"
audio-quality="{{pusher.audioQuality}}"
bindstatechange="_pusherStateChangeHandler" bindnetstatus="_pusherNetStatusHandler"
binderror="_pusherErrorHandler" bindbgmstart="_pusherBGMStartHandler"
bindbgmprogress="_pusherBGMProgressHandler" bindbgmcomplete="_pusherBGMCompleteHandler"
bindaudiovolumenotify="_pusherAudioVolumeNotify" />
<live-player class="trtc-player" sound-mode="{{soundMode}}">
</live-player>
<!-- <camera wx:if="{{pusher.videoPreview}}" class="trtc-camera" device-position="{{pusher.frontCamera}}"></camera> -->
</view>
@@ -0,0 +1,20 @@
.trtc-pusher-container {
height: 100%;
width: 100%;
position: relative;
}
.trtc-pusher {
height: 100%;
width: 100%;
}
.trtc-camera {
height: 100%;
position: absolute;
top: 0;
}
.trtc-player {
width: 0;
height: 0;
display: flex;
}
+72
View File
@@ -0,0 +1,72 @@
{
"name": "@tencentcloud/trtc-component-wx",
"version": "1.0.6",
"description": "",
"main": "miniprogram_dist/index.js",
"scripts": {
"dev": "gulp dev --develop",
"watch": "gulp watch --develop --watch",
"build": "gulp",
"dist": "npm run build",
"clean-dev": "gulp clean --develop",
"clean": "gulp clean",
"test": "jest --bail",
"test-debug": "node --inspect-brk ./node_modules/jest/bin/jest.js --runInBand --bail",
"coverage": "jest ./test/* --coverage --bail",
"lint": "eslint \"src/**/*.js\" --fix",
"lint-tools": "eslint \"tools/**/*.js\" --rule \"import/no-extraneous-dependencies: false\" --fix"
},
"miniprogram": "miniprogram_dist",
"jest": {
"testEnvironment": "jsdom",
"testURL": "https://jest.test",
"collectCoverageFrom": [
"miniprogram_dist/**/*.js"
],
"moduleDirectories": [
"node_modules",
"miniprogram_dist"
]
},
"repository": {
"type": "git",
"url": ""
},
"author": "",
"license": "MIT",
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^2.28.0",
"@typescript-eslint/parser": "^2.28.0",
"babel-core": "^6.26.3",
"babel-loader": "^7.1.5",
"babel-plugin-module-resolver": "^3.2.0",
"babel-preset-env": "^1.7.0",
"colors": "^1.3.1",
"eslint": "^5.14.1",
"eslint-config-airbnb-base": "13.1.0",
"eslint-loader": "^2.1.2",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-node": "^7.0.1",
"eslint-plugin-promise": "^3.8.0",
"gulp": "^4.0.0",
"gulp-clean": "^0.4.0",
"gulp-if": "^2.0.2",
"gulp-install": "^1.1.0",
"gulp-less": "^4.0.1",
"gulp-rename": "^1.4.0",
"gulp-sourcemaps": "^2.6.5",
"jest": "^23.5.0",
"miniprogram-api-typings": "^2.10.3-1",
"miniprogram-simulate": "^1.2.5",
"thread-loader": "^2.1.3",
"through2": "^2.0.3",
"ts-loader": "^7.0.0",
"typescript": "^3.8.3",
"vinyl": "^2.2.0",
"webpack": "^4.29.5",
"webpack-node-externals": "^1.7.2"
},
"dependencies": {
"@tencentcloud/trtc-cloud-wx": "^1.0.7"
}
}
+4
View File
@@ -0,0 +1,4 @@
import TRTCCloud from '@tencentcloud/trtc-cloud-wx'
export * from '@tencentcloud/trtc-cloud-wx'
export default TRTCCloud
+96
View File
@@ -0,0 +1,96 @@
import TRTCCloud, {translateTRTCStreamId} from '@tencentcloud/trtc-cloud-wx'
const trtcCloud = TRTCCloud.getTRTCShareInstance()
const trtc = trtcCloud.trtc
const InterfaceEventEmitter = trtcCloud.InterfaceEventEmitter
Component({
properties: {
streamId: String
},
data: {
player: {},
TRTCStreamId: '',
soundMode: ''
},
lifetimes: {
attached() {
trtcCloud.logger.info('trtc-player attached', this.data.streamId)
if (this.data.streamId) {
InterfaceEventEmitter.emit('playerDomReady', {isReady: true, view: this.data.streamId})
}
this.data.TRTCStreamId = this.getTRTCStreamId(this.data.streamId)
this.bindTRTCCloudEvent()
},
detached() {
trtcCloud.logger.info('trtc-player detached', this.data.streamId)
InterfaceEventEmitter.emit('playerDomReady', {isReady: false, streamId: this.data.streamId})
this.unbindTRTCCloudEvent()
}
},
methods: {
// todo room uniapp 特供,因为 uniapp 打包导致组件传惨变量名更替 trtc-player 组建内部无法识别
setTRTCStreamId(id) {
trtcCloud.logger.info('trtc-player setTRTCStreamId', id)
return new Promise((resolve, reject) => {
try {
this.data.streamId = id
this.data.TRTCStreamId = this.getTRTCStreamId(id)
this.setData({streamId: this.data.streamId}, () => {
trtcCloud.logger.info('trtc-player setTRTCStreamId success', id)
resolve()
InterfaceEventEmitter.emit('playerDomReady', {isReady: true, view: id})
})
} catch (err) {
trtcCloud.logger.info('trtc-player setTRTCStreamId fail', id, err)
reject(err)
}
})
},
playerAttributesChange(event) {
const {view, playerAttributes, callback} = event
trtcCloud.logger.info('trtc-player playerAttributesChange', view, JSON.stringify(playerAttributes), this.data.streamId)
if (view === this.data.streamId) {
this.setData({player: playerAttributes}, callback)
}
},
playerAudioRouteChange(event) {
const { soundMode, callback } = event
trtcCloud.logger.info('trtc-player playerAudioRouteChange', soundMode)
this.setData({ soundMode }, callback)
},
getTRTCStreamId(streamId) {
const tempArray = streamId.split('_')
const userId = tempArray.slice(0, -1).join('_')
const streamType = Number(tempArray[tempArray.length - 1])
return translateTRTCStreamId(userId, streamType)
},
bindTRTCCloudEvent() {
InterfaceEventEmitter.on('playerAttributesChange', this.playerAttributesChange, this)
InterfaceEventEmitter.on('playerAudioRouteChange', this.playerAudioRouteChange, this)
},
unbindTRTCCloudEvent() {
InterfaceEventEmitter.off('playerAttributesChange', this.playerAttributesChange)
InterfaceEventEmitter.off('playerAudioRouteChange', this.playerAudioRouteChange)
},
// 请保持跟 wxml 中绑定的事件名称一致
_playerStateChange(event) {
trtc.playerEventHandler(event)
},
_playerFullscreenChange(event) {
trtc.playerFullscreenChange(event)
},
_playerNetStatus(event) {
trtc.playerNetStatus(event)
},
_playerAudioVolumeNotify(event) {
try {
event.currentTarget.dataset.streamid = this.data.player.streamID
trtc.playerAudioVolumeNotify(event)
} catch (err) {
trtcCloud.logger.warn(err)
}
},
}
})
+4
View File
@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}
+12
View File
@@ -0,0 +1,12 @@
<view class="trtc-player-container">
<live-player wx:if="{{streamId}}" class="trtc-player" id="{{player.streamID}}" data-userid="{{player.userID}}"
data-streamid="{{player.streamID}}" data-streamtype="{{player.streamType}}" src="{{player.src}}" mode="RTC"
autoplay="{{player.autoplay}}" mute-audio="{{player.muteAudio}}" mute-video="{{player.muteVideo}}"
orientation="{{player.orientation}}" object-fit="{{player.objectFit}}"
background-mute="{{player.enableBackgroundMute}}" min-cache="{{player.minCache}}" max-cache="{{player.maxCache}}"
sound-mode="{{soundMode}}" enable-recv-message="{{player.enableRecvMessage}}"
auto-pause-if-navigate="{{player.autoPauseIfNavigate}}" auto-pause-if-open-native="{{player.autoPauseIfOpenNative}}"
debug="{{player.debug}}" bindstatechange="_playerStateChange" bindfullscreenchange="_playerFullscreenChange"
bindnetstatus="_playerNetStatus" bindaudiovolumenotify="_playerAudioVolumeNotify" />
<view wx:if="{{player.stopVideo}}" class="trtc-dark-mask"></view>
</view>
+16
View File
@@ -0,0 +1,16 @@
.trtc-player-container {
height: 100%;
width: 100%;
position: relative;
}
.trtc-player {
height: 100%;
width: 100%;
}
.trtc-dark-mask {
width: 100%;
height: 100%;
background-color: black;
position: absolute;
top: 0;
}
+73
View File
@@ -0,0 +1,73 @@
import TRTCCloud from '@tencentcloud/trtc-cloud-wx'
const trtcCloud = TRTCCloud.getTRTCShareInstance()
const trtc = trtcCloud.trtc
const InterfaceEventEmitter = trtcCloud.InterfaceEventEmitter
Component({
properties: {
},
data: {
pusher: {},
},
lifetimes: {
attached() {
trtcCloud.logger.info('trtc-pusher attached')
this.bindTRTCCloudEvent()
// 注意事件绑定应该放在 domReady 之前,因为此时出发 domReady 会执行 ready 后的后续操作依赖 bindTRTCCloudEvent
InterfaceEventEmitter.emit('pusherDomReady', true)
},
detached() {
trtcCloud.logger.info('trtc-pusher detached')
InterfaceEventEmitter.emit('pusherDomReady', false)
this.unbindTRTCCloudEvent()
trtcCloud.exitRoom()
},
},
methods: {
pusherAttributesChange(event) {
const {pusher, callback} = event
this.setData({pusher}, callback)
},
playerAudioRouteChange(event) {
const { soundMode, callback } = event
trtcCloud.logger.info('trtc-player playerAudioRouteChange', soundMode)
this.setData({ soundMode }, callback)
},
bindTRTCCloudEvent() {
InterfaceEventEmitter.on('pusherAttributesChange', this.pusherAttributesChange, this)
InterfaceEventEmitter.on('playerAudioRouteChange', this.playerAudioRouteChange, this)
},
unbindTRTCCloudEvent() {
InterfaceEventEmitter.off('pusherAttributesChange', this.pusherAttributesChange)
InterfaceEventEmitter.off('playerAudioRouteChange', this.playerAudioRouteChange)
},
// 请保持跟 wxml 中绑定的事件名称一致
_pusherStateChangeHandler(event) {
trtc.pusherEventHandler(event)
},
_pusherNetStatusHandler(event) {
trtc.pusherNetStatusHandler(event)
},
_pusherErrorHandler(event) {
trtc.pusherErrorHandler(event)
},
_pusherBGMStartHandler(event) {
trtc.pusherBGMStartHandler(event)
},
_pusherBGMProgressHandler(event) {
trtc.pusherBGMProgressHandler(event)
},
_pusherBGMCompleteHandler(event) {
trtc.pusherBGMCompleteHandler(event)
},
_pusherAudioVolumeNotify(event) {
if (!trtcCloud.isEnterRoom) {
return
}
trtc.pusherAudioVolumeNotify(event)
}
}
})
+4
View File
@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}
+22
View File
@@ -0,0 +1,22 @@
<view class="trtc-pusher-container">
<live-pusher class="trtc-pusher" url="{{pusher.url}}" mode="{{'HD'}}" autopush="{{pusher.autopush}}"
enable-camera="{{pusher.enableCamera}}" enable-mic="{{pusher.enableMic}}" muted="{{pusher.muted}}"
enable-agc="{{pusher.enableAgc}}" enable-ans="{{pusher.enableAns}}"
enable-ear-monitor="{{pusher.enableEarMonitor}}" auto-focus="{{pusher.enableAutoFocus}}"
zoom="{{pusher.enableZoom}}" min-bitrate="{{pusher.minBitrate}}" max-bitrate="{{pusher.maxBitrate}}"
video-width="{{pusher.videoWidth}}" video-height="{{pusher.videoHeight}}" beauty="{{pusher.beautyLevel}}"
whiteness="{{pusher.whitenessLevel}}" orientation="{{pusher.videoOrientation}}" aspect="{{pusher.videoAspect}}"
device-position="{{pusher.frontCamera}}" remote-mirror="{{pusher.enableRemoteMirror}}"
local-mirror="{{pusher.localMirror}}" background-mute="{{pusher.enableBackgroundMute}}"
audio-quality="{{pusher.audioQuality}}" audio-volume-type="{{pusher.audioVolumeType}}"
audio-reverb-type="{{pusher.audioReverbType}}" waiting-image="{{pusher.waitingImage}}"
beauty-style="{{pusher.beautyStyle}}" fps="{{pusher.fps}}" filter="{{pusher.filter}}"
audio-quality="{{pusher.audioQuality}}"
bindstatechange="_pusherStateChangeHandler" bindnetstatus="_pusherNetStatusHandler"
binderror="_pusherErrorHandler" bindbgmstart="_pusherBGMStartHandler"
bindbgmprogress="_pusherBGMProgressHandler" bindbgmcomplete="_pusherBGMCompleteHandler"
bindaudiovolumenotify="_pusherAudioVolumeNotify" />
<live-player class="trtc-player" sound-mode="{{soundMode}}">
</live-player>
<!-- <camera wx:if="{{pusher.videoPreview}}" class="trtc-camera" device-position="{{pusher.frontCamera}}"></camera> -->
</view>
+20
View File
@@ -0,0 +1,20 @@
.trtc-pusher-container {
height: 100%;
width: 100%;
position: relative;
}
.trtc-pusher {
height: 100%;
width: 100%;
}
.trtc-camera {
height: 100%;
position: absolute;
top: 0;
}
.trtc-player {
width: 0;
height: 0;
display: flex;
}
+25
View File
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"module": "esnext",
"target": "es2015",
"lib": ["es2015", "es2017", "dom"],
"noImplicitAny": false,
"moduleResolution": "node",
"sourceMap": true,
"baseUrl": ".",
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true,
"emitDecoratorMetadata":true,
"esModuleInterop": true,
"resolveJsonModule": true
},
"files": [
"node_modules/miniprogram-api-typings/index.d.ts"
],
"include": [
"src/**/*.ts"
],
"exclude": [
"node_modules"
]
}
+444
View File
@@ -0,0 +1,444 @@
import { ChatSDK } from '@tencentcloud/lite-chat/basic';
/**
* TUILogin login ()
* @interface LoginParams
* @property {number} SDKAppID SDKAppID
* @property {string} userID ID
* @property {string} userSig IM UserID <br/>{@link https://cloud.tencent.com/document/product/269/32688 生成 UserSig}
* @property {string} [fileUploadProxy]
* @property {string} [fileDownloadProxy]
* @property {string} [proxyServer] IM
* @property {string} [framework] vue2 | vue3 | rn badcase
*/
interface LoginParams {
SDKAppID: number;
userID: string;
userSig: string;
unlimitedAVChatRoom?: boolean;
scene?: string;
fileUploadProxy?: string;
fileDownloadProxy?: string;
proxyServer?: string;
devMode?: boolean;
testEnv?: boolean;
framework?: string;
}
type Func = (...args: any[]) => any;
/**
*
* @interface CallServiceParams
* @property {string} serviceName
* @property {string} method
* @property {any} params
* @property {Func} [callback]
*/
interface CallServiceParams {
serviceName: string;
method: string;
params: Record<string, any>;
callback?: Func;
}
/**
*
* @interface ExtensionInfo
* @property {number} weight weight
* @property {string} text
* @property {string} icon url
* @property {object} data
* @property {object} listener
* @property {Func} [listener.onClicked]
* @property {Func} [listener.onLongPressed]
* @property {Func} [listener.onTouched]
* @property {Func} [listener.onSwiped]
*/
interface ExtensionInfo {
weight: number;
text: string;
icon: string;
data: Record<string, any>;
listener: {
onClicked?: Func;
onLongPressed?: Func;
onTouched?: Func;
onSwiped?: Func;
};
}
interface ITUIService {
onCall(method: string, params: object, callback?: Func): void;
}
/**
* @interface TUICore
*/
interface ITUICore {
/**
*
* @function
* @param {string} serviceName
* @param {ITUIService} service
* @example
* TUICore.registerService(TUIConstants.TUICall.SERVICE.NAME, this);
*/
registerService(serviceName: string, service: any): void;
/**
*
* @function
* @param {string} serviceName
* @example
* TUICore.unregisterService(TUIConstants.TUICall.SERVICE.NAME);
*/
unregisterService(serviceName: string): void;
/**
*
* @function
* @param {string} serviceName
* @example
* TUICore.getService(TUIConstants.TUICall.SERVICE.NAME);
*/
getService(serviceName: string): ITUIService;
/**
*
* @function
* @param {CallServiceParams} options
* @example
* TUICore.callService({
* serviceName: TUIConstants.TUICall.SERVICE.NAME,
* method: TUIConstants.TUICall.SERVICE.METHOD.CALL,
* params: {
* callType: 1,
* mediaType: 2
* },
* callback: (result) => {
* // todo
* },
* });
*/
callService(options: CallServiceParams): void;
/**
*
* @function
* @param {string} extensionID ID
* @param {ITUIExtension} extension
* @example
* TUICore.registerExtension(TUIConstants.TUIChat.EXTENSION.INPUT_TOOLBAR, this);
*/
registerExtension(extensionID: string, extension: any): void;
/**
*
* @function
* @param {string} extensionID ID
* @param {ITUIExtension} extension
* @example
* TUICore.unregisterExtension(TUIConstants.TUIChat.EXTENSION.INPUT_TOOLBAR, this);
*/
unregisterExtension(extensionID: string, extension: any): void;
/**
*
* @function
* @param {string} extensionID ID
* @param {object} [params]
* @example
* TUICore.getExtension(TUIConstants.TUIChat.EXTENSION.INPUT_TOOLBAR, { filterVoice: true });
*/
getExtensionList(extensionID: string, params?: object): ExtensionInfo[];
/**
* 广
* @function
* @param {string} eventName
* @param {string} subKey
* @param {ITUINotification} notification
* @example
* TUICore.registerEvent(TUIConstants.TUILogin.EVENT.LOGIN_STATE_CHANGED, this);
*/
registerEvent(eventName: string, subKey: string, notification: any): void;
/**
* 广
* @function
* @param {string} eventName
* @param {string} subKey
* @param {ITUINotification} notification
* @example
* TUICore.unregisterEvent(TUIConstants.TUILogin.EVENT.LOGIN_STATE_CHANGED, this);
*/
unregisterEvent(eventName: string, subKey: string, notification: any): void;
/**
* 广
* @function
* @param {string} eventName
* @param {string} subKey
* @param {object} [params]
* @example
* TUICore.notifyEvent(TUIConstants.TUILogin.EVENT.LOGIN_STATE_CHANGED, TUIConstants.TUILogin.EVENT_SUB_KEY.USER_LOGIN_SUCCESS);
*/
notifyEvent(eventName: string, subKey: string, params?: object): void;
}
interface GetContextResult {
chat: ChatSDK;
SDKAppID: number;
userID: string;
userSig: string;
}
/**
* @interface TUILogin
*/
interface ITUILogin {
/**
* Chat SDK
* @function
* @param {LoginParams} options
* @example
* TUILogin.login({
* SDKAppID: xxx,
* userID: 'xxx',
* userSig: 'xxx',
* });
*/
login(options: LoginParams): Promise<any>;
/**
* Chat SDK
* @function
* @example
* let promise = TUILogin.logout();
* promise.then(() => {
* // 登出成功后进行相关业务逻辑处理
* })
*/
logout(): Promise<any>;
/**
* Chat SDK SDK logout WebSocket
* @function
* @example
* let promise = TUILogin.destroy();
*/
destroy(): Promise<any>;
/**
* Chat SDK
* @function
* @param {number} level
* - 0 使
* - 1 release级别SDK 使
* - 2 SDK
* - 3 SDK
* - 4 SDK
* @example
* TUILogin.setLogLevel(0)
*/
setLogLevel(level: number): void;
/**
* TUILogin
* @function
* @example
* const { chat, SDKAppID, userID, userSig } = TUILogin.getContext();
* // chat - Chat SDK 实例
* // SDKAppID - 即时通信应用 AppID
* // userID - 用户 ID
* // userSig - 用户登录前面
*/
getContext(): GetContextResult;
}
declare const TUIConstants: {
TUILogin: {
EVENT: {
LOGIN_STATE_CHANGED: string;
};
EVENT_SUB_KEY: {
USER_LOGIN_SUCCESS: string;
USER_LOGOUT_SUCCESS: string;
USER_KICKED_OFFLINE: string;
USER_SIG_EXPIRED: string;
};
};
TUIConversation: {
SERVICE: {
NAME: string;
METHOD: {
CREATE_CONVERSATION: string;
HIDE_CONVERSATION_HEADER: string;
};
};
EXTENSION: {
CONV_POP_MENU: {
EXT_ID: string;
};
CONV_GROUP: {
EXT_ID: string;
};
};
};
TUIChat: {
SERVICE: {
NAME: string;
METHOD: {
UPDATE_MESSAGE_LIST: string;
CLOSE_MESSAGE_POP_MENU: string;
SEND_CUSTOM_MESSAGE: string;
SEND_TEXT_MESSAGE: string;
SET_CHAT_TYPE: string;
UPDATE_MESSAGE_INFO: string;
};
};
EXTENSION: {
INPUT_MORE: {
EXT_ID: string;
};
MSG_POP_MENU: {
EXT_ID: string;
};
CHAT_HEADER: {
EXT_ID: string;
};
};
TYPE: {
C2C: string;
GROUP: string;
CUSTOMER_SERVICE: string;
ROOM: string;
};
EVENT: {
CHAT_STATE_CHANGED: string;
CHAT_TYPE_CHANGED: string;
};
EVENT_SUB_KEY: {
CHAT_OPENED: string;
CHANGE_SUCCESS: string;
};
FEATURE: {
DownloadFile: string;
CopyMessage: string;
DeleteMessage: string;
RevokeMessage: string;
QuoteMessage: string;
ForwardMessage: string;
TranslateMessage: string;
VoiceToText: string;
MultiSelection: string;
EmojiReaction: string;
InputEmoji: string;
InputStickers: string;
InputImage: string;
InputVoice: string;
InputVideo: string;
InputFile: string;
InputEvaluation: string;
InputQuickReplies: string;
InputMention: string;
MessageSearch: string;
ReadStatus: string;
};
};
TUIGroup: {
SERVICE: {
NAME: string;
METHOD: {
CREATE_GROUP: string;
OPEN_GROUP_MANAGEMENT: string;
SELECT_GROUP_MEMBER: string;
};
};
};
TUIContact: {
SERVICE: {
NAME: string;
METHOD: {
SELECT_FRIEND: string;
};
};
EXTENSION: {
CONTACT_LIST: {
EXT_ID: string;
};
};
};
TUISearch: {
SERVICE: {
NAME: string;
METHOD: {
SEARCH_GROUP: string;
SEARCH_USER: string;
SEARCH_FRIEND: string;
SEARCH_GROUP_MEMBER: string;
};
};
EXTENSION: {
SEARCH_MORE: {
EXT_ID: string;
};
};
};
TUICalling: {
SERVICE: {
NAME: string;
METHOD: {
START_CALL: string;
};
};
};
TUIRoom: {
SERVICE: {
NAME: string;
};
};
TUIEmojiPlugin: {
SERVICE: {
NAME: string;
METHOD: {
CLOSE_EMOJI_DETAIL: string;
};
};
};
TUITranslate: {
EVENT: {
LANGUAGE_CHANGED: string;
};
EVENT_SUB_KEY: {
CHANGE_SUCCESS: string;
};
};
TUITranslatePlugin: {
SERVICE: {
NAME: string;
};
};
TUIVoiceToTextPlugin: {
SERVICE: {
NAME: string;
};
};
TUICustomerServicePlugin: {
SERVICE: {
NAME: string;
METHOD: {
ACTIVE_CONVERSATION: string;
FILTER_MESSAGE: string;
};
};
EXTENSION: {};
};
TUIPushPlugin: {
SERVICE: {
NAME: string;
};
};
TUIChatbotPlugin: {
SERVICE: {
NAME: string;
};
};
TUITheme: {
EVENT: {
THEME_CHANGED: string;
};
EVENT_SUB_KEY: {
CHANGE_SUCCESS: string;
};
};
};
declare const tuiCore: ITUICore;
declare const tuiLogin: ITUILogin;
export { CallServiceParams, ExtensionInfo, Func, LoginParams, TUIConstants, tuiCore as TUICore, tuiLogin as TUILogin, tuiCore as default };
File diff suppressed because one or more lines are too long
+24
View File
@@ -0,0 +1,24 @@
{
"name": "@tencentcloud/tui-core-lite",
"version": "1.0.0",
"description": "Tencent Cloud TUICore SDK for TUIKit",
"main": "index.js",
"keywords": [
"chat",
"real-time chat",
"messaging",
"Instant Messaging",
"IM",
"Tencent Cloud",
"Tencent"
],
"repository": {
"type": "git",
"url": ""
},
"author": "Tencent Cloud Terminal R&D Center",
"license": "ISC",
"dependencies": {
"@tencentcloud/lite-chat": "^1.5.0"
}
}
+63
View File
@@ -0,0 +1,63 @@
<p align="center">
<a href="https://trtc.io/">
<img width="200" src="https://web.sdk.qcloud.com/trtc/webrtc/assets/trtc.io-logo.png">
</a>
</p>
<h1 align="center" style="margin-top: -40px">TUICallEngine WX SDK</h1>
<div align="center">
![NPM verison](https://img.shields.io/npm/v/@trtc/call-engine-lite-wx) [![NPM downloads](https://img.shields.io/npm/dw/@trtc/call-engine-lite-wx)](https://www.npmjs.com/package/@trtc/call-engine-lite-wx) [![Typescript Supported](https://img.shields.io/badge/Typescript-Supported-blue)](https://www.npmjs.com/package/@trtc/call-engine-lite-wx) [![Documents](https://img.shields.io/badge/-Documents-blue)](https://cloud.tencent.com/document/product/647/78761) [![Stars](https://img.shields.io/github/stars/tencentyun/TUICallKit?style=social)](https://github.com/tencentyun/TUICallKit)
</div>
<div align="center"> English | <a href="https://github.com/tencentyun/TUICallKit/tree/main/Web/call-engine-demo-vue3" target="_blank"> 简体中文</a> </div>
## 简介
TUICallEngine 是基于腾讯云 [即时通信 IM](https://cloud.tencent.com/document/product/269/42440) 和 [实时音视频 TRTC](https://cloud.tencent.com/document/product/647/16788) 两项付费 PaaS 服务构建出的音视频通信 SDK,支持双人和多人场景下的音视频通话。
- 我们提供适用于 Web、Android、iOS、小程序、Flutter 的 SDK,更多信息请参见 [trtc.io](https://cloud.tencent.com/document/product/647/78742)。
## 安装
使用 npm:
```
$ npm install @trtc/call-engine-lite-wx --save
```
使用 yarn:
```
$ yarn add @trtc/call-engine-lite-wx
```
手动下载 sdk 包:
1. 下载 [@trtc/call-engine-lite-wx](https://www.unpkg.com/@trtc/call-engine-lite-wx@latest)。
2. 将 `@trtc/call-engine-lite-wx` 复制到你的项目中。
## API 概要
- [tuiCallEngine](https://cloud.tencent.com/document/product/647/78761#createinstance) 对象,提供实时音视频通话的核心能力。
- 开始 1v1(或多人) 通话 [calls](https://cloud.tencent.com/document/product/647/78761#calls)
- 接通 [accept](https://cloud.tencent.com/document/product/647/78761#accept)
- 拒绝 [reject](https://cloud.tencent.com/document/product/647/78761#reject)
- 挂断 [hangup](https://cloud.tencent.com/document/product/647/78761#hangup)
- 打开摄像头 [openCamera](https://cloud.tencent.com/document/product/647/78761#opencamera)
- 打开麦克风 [openMicrophone](https://cloud.tencent.com/document/product/647/78761#openmicrophone)
- 关闭摄像头 [closeCamera](https://cloud.tencent.com/document/product/647/78761#closecamera)
- 关闭麦克风 [closeMicrophone](https://cloud.tencent.com/document/product/647/78761#closemicrophone)
- 播放远端视频 [startRemoteView](https://cloud.tencent.com/document/product/647/78761#startremoteView)
- 停止播放远端视频 [stopRemoteView](https://cloud.tencent.com/document/product/647/78761#stopremoteView)
## 目录结构
```
├── README-zh_CN.md
├── README.md
├── index.js // 基于 umd 模块的 sdk 包
├── index.esm.js // 基于 esm 模块的 sdk 包
├── index.cjs.js // 基于 commonjs 模块的 sdk 包
├── index.d.ts // 类型声明文件
└── package.json
```
+70
View File
@@ -0,0 +1,70 @@
<p align="center">
<a href="https://trtc.io/">
<img width="200" src="https://web.sdk.qcloud.com/trtc/webrtc/assets/trtc.io-logo.png">
</a>
</p>
<h1 align="center" style="margin-top: -40px">TUICallEngine WX SDK</h1>
<div align="center">
An object-oriented TUICallEngine SDK library
![NPM verison](https://img.shields.io/npm/v/@trtc/call-engine-lite-wx) [![NPM downloads](https://img.shields.io/npm/dw/@trtc/call-engine-lite-wx)](https://www.npmjs.com/package/@trtc/call-engine-lite-wx) [![Typescript Supported](https://img.shields.io/badge/Typescript-Supported-blue)](https://www.npmjs.com/package/@trtc/call-engine-lite-wx) [![Documents](https://img.shields.io/badge/-Documents-blue)](https://cloud.tencent.com/document/product/647/78761) [![Stars](https://img.shields.io/github/stars/tencentyun/TUICallKit?style=social)](https://github.com/tencentyun/TUICallKit)
</div>
<div align="center"> English | <a href="https://github.com/Tencent-RTC/rtc-call-engine/tree/main/Web/demo-vue3" target="_blank"> 简体中文</a> </div>
## Install
npm:
```
$ npm install @trtc/call-engine-lite-wx --save
```
yarn:
```
$ yarn add @trtc/call-engine-lite-wx
```
Download manually
1. download [@trtc/call-engine-lite-wx](https://www.unpkg.com/@trtc/call-engine-lite-wx@latest).
2. copy `@trtc/call-engine-lite-wx` to your project.
## Usage
Refer to the following two tutorials for a quick run-through of the demo and how to use the SDK to implement basic audio and video calling functionality.
- [Demo Quick Run](https://web.sdk.qcloud.com/component/trtccalling/doc/TUICallEngine/web/en/tutorial-00-%E5%AE%9E%E7%8E%B0%E5%8F%8C%E4%BA%BA%E9%80%9A%E8%AF%9D.html)
- [TUICallEngine Github Demo](https://github.com/Tencent-RTC/rtc-call-engine/tree/main/Web/demo-vue3)
Explore SDK documents[TUICallEngine WX SDK](https://cloud.tencent.com/document/product/647/78761)
## API Overview
- [tuiCallEngine](https://cloud.tencent.com/document/product/647/78761#createinstance) instance, provides the core capability for real-time audio and video calls.
- Start single or group calls [calls](https://cloud.tencent.com/document/product/647/78761#calls)
- Accept call [accept](https://cloud.tencent.com/document/product/647/78761#accept)
- Reject call [reject](https://cloud.tencent.com/document/product/647/78761#reject)
- Hangup call [hangup](https://cloud.tencent.com/document/product/647/78761#hangup)
- Turn on camera [openCamera](https://cloud.tencent.com/document/product/647/78761#opencamera)
- Turn on microphone [openMicrophone](https://cloud.tencent.com/document/product/647/78761#openmicrophone)
- Turn off camera [closeCamera](https://cloud.tencent.com/document/product/647/78761#closecamera)
- Turn off microphone [closeMicrophone](https://cloud.tencent.com/document/product/647/78761#closemicrophone)
- Play remote video [startRemoteView](https://cloud.tencent.com/document/product/647/78761#startremoteView)
- Stop playing remote video [stopRemoteView](https://cloud.tencent.com/document/product/647/78761#stopremoteView)
## Directory
```
├── README-zh_CN.md
├── README.md
├── index.js // sdk file base on UMD modules
├── index.esm.js // sdk file base on ESM modules
├── index.cjs.js // sdk file base on CommonJS modules
├── index.d.ts // ts declaration file
└── package.json
```
`
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More