@tencentcloud/call-uikit-vue2
Advanced tools
Comparing version 2.3.7 to 2.3.8
{ | ||
"name": "@tencentcloud/call-uikit-vue2", | ||
"version": "2.3.7", | ||
"version": "2.3.8", | ||
"main": "./tuicall-uikit-vue2.umd.js", | ||
"module": "./tuicall-uikit-vue2.es.js", | ||
"types": "./types/src/index.d.ts", | ||
"types": "./types/index.d.ts", | ||
"description": "An Open-source Voice & Video Calling UI Component Based on Tencent Cloud Service.", | ||
@@ -16,3 +16,3 @@ "homepage": "https://cloud.tencent.com/document/product/647/78731", | ||
"dependencies": { | ||
"tuicall-engine-webrtc": "^1.4.10" | ||
"tuicall-engine-webrtc": "^1.5.0" | ||
}, | ||
@@ -19,0 +19,0 @@ "bugs": { |
import Vue from 'vue'; | ||
// @ts-ignore | ||
import PermitTipComp from './PermitTip.vue'; | ||
@@ -3,0 +4,0 @@ |
@@ -14,3 +14,2 @@ import { | ||
} from './TUICallService/index'; | ||
// @if process.env.BUILD_TARGET!='MINI' | ||
// @ts-ignore | ||
@@ -34,4 +33,3 @@ import TUICallKit from './Components/TUICallKit.vue'; | ||
}; | ||
// @endif | ||
const Version = '2.3.7'; // basic-demo 原来上报使用 | ||
const Version = '2.3.8'; // basic-demo 原来上报使用 | ||
@@ -44,3 +42,2 @@ // 输出产物 | ||
TUICallKitServer, | ||
// @if process.env.BUILD_TARGET!='MINI' | ||
// uni-app 打包小程序无法引入 vue 组件, 只能在使用侧单独引入 vue 文件 | ||
@@ -51,3 +48,2 @@ TUICallKit, | ||
TUICallType, | ||
// @endif | ||
NAME, | ||
@@ -54,0 +50,0 @@ STATUS, |
@@ -27,3 +27,4 @@ import { ITUICallService, ICallParams, IGroupCallParams, IUserInfo, ICallbackParam, ISelfInfoParams } from '../interface/ICallService'; | ||
import { avoidRepeatedCall } from '../utils/validate'; | ||
import { handleRepeatedCallError, handleNoDevicePermissionError, setDefaultUserInfo, formatTime, formatTimeInverse } from '../utils/common-utils'; | ||
import { handleRepeatedCallError, handleNoDevicePermissionError, formatTime, formatTimeInverse } from '../utils/common-utils'; | ||
import { getMyProfile, getRemoteUserProfile, generateText, generateStatusChangeText } from './utils'; | ||
import timer from '../utils/timer'; | ||
@@ -38,3 +39,3 @@ import { ITUIGlobal } from '../interface/ITUIGlobal'; | ||
const TUIStore: ITUIStore = TuiStore.getInstance(); | ||
const version = '2.3.7'; | ||
const version = '2.3.8'; | ||
export { TUIGlobal, TUIStore }; | ||
@@ -138,3 +139,3 @@ | ||
if (response) { | ||
const remoteUserInfoList: IUserInfo[] = await this._getRemoteUserProfile(userIDList); // eslint-disable-line | ||
const remoteUserInfoList: IUserInfo[] = await getRemoteUserProfile(userIDList, this.getTim()); // eslint-disable-line | ||
// this._updateRemoteUserInfoList(remoteUserInfoList); | ||
@@ -281,3 +282,4 @@ } | ||
const oldStatus = isGroup ? StatusChange.CALLING_GROUP_VIDEO : StatusChange.CALLING_C2C_VIDEO; | ||
this.statusChanged && this.statusChanged({ oldStatus, newStatus: this._generateStatusChangeText() }); | ||
const newStatus = generateStatusChangeText(TUIStore); | ||
this.statusChanged && this.statusChanged({ oldStatus, newStatus }); | ||
} catch (error: any) { | ||
@@ -381,3 +383,4 @@ console.error(`${NAME.PREFIX}switchCallMediaType failed, error: ${JSON.stringify(error)}.`); | ||
this.statusChanged && this.statusChanged({ oldStatus: StatusChange.IDLE, newStatus: StatusChange.BE_INVITED }); | ||
const remoteUserInfoList = await this._getRemoteUserProfile(remoteUserIdList); | ||
const remoteUserInfoList = await getRemoteUserProfile(remoteUserIdList, this.getTim()); | ||
const [userInfo] = remoteUserInfoList.filter((userInfo: IUserInfo) => userInfo.userId === sponsor); | ||
@@ -420,3 +423,3 @@ remoteUserInfoList.length > 0 && TUIStore.updateStore({ | ||
if (TUIStore.getData(StoreName.CALL, NAME.IS_GROUP)) { | ||
const text = this._generateText(CallTips.END_CALL, userId); | ||
const text = generateText(TUIStore, CallTips.END_CALL, userId); | ||
TUIStore.update(StoreName.CALL, NAME.TOAST_INFO, { text }); | ||
@@ -434,6 +437,6 @@ } | ||
let callTipsKey = eventName === TUICallEvent.REJECT ? CallTips.OTHER_SIDE_REJECT_CALL : CallTips.OTHER_SIDE_LINE_BUSY; | ||
let text = this._generateText(callTipsKey); | ||
let text = generateText(TUIStore, callTipsKey); | ||
if (isGroup) { | ||
callTipsKey = eventName === TUICallEvent.REJECT ? CallTips.REJECT_CALL : CallTips.IN_BUSY; | ||
text = this._generateText(callTipsKey, userId); | ||
text = generateText(TUIStore, callTipsKey, userId); | ||
} | ||
@@ -447,3 +450,3 @@ TUIStore.update(StoreName.CALL, NAME.TOAST_INFO, { text }); | ||
const callTipsKey = isGroup ? CallTips.TIMEOUT : CallTips.CALL_TIMEOUT; | ||
const text = isGroup ? this._generateText(callTipsKey, userIDList.join()) : this._generateText(callTipsKey); | ||
const text = isGroup ? generateText(TUIStore, callTipsKey, userIDList.join()) : generateText(TUIStore, callTipsKey); | ||
TUIStore.update(StoreName.CALL, NAME.TOAST_INFO, { text }); | ||
@@ -454,3 +457,3 @@ userIDList.length > 0 && this._deleteRemoteUser(userIDList); | ||
case TUICallEvent.CALLING_CANCEL: { | ||
// TUIStore.update(StoreName.CALL, NAME.TOAST_INFO, { text: this._generateText(CallTips.CANCEL) }); | ||
// TUIStore.update(StoreName.CALL, NAME.TOAST_INFO, { text: generateText(TUIStore, CallTips.CANCEL) }); | ||
this._resetCallStore(); | ||
@@ -482,3 +485,3 @@ break; | ||
let localUserInfo: IUserInfo = TUIStore.getData(StoreName.CALL, NAME.LOCAL_USER_INFO); | ||
localUserInfo = await this._getMyProfile(localUserInfo.userId); // 方法里已经 try...catch 了 | ||
localUserInfo = await getMyProfile(localUserInfo.userId, this.getTim()); // 方法里已经 try...catch 了 | ||
TUIStore.update(StoreName.CALL, NAME.LOCAL_USER_INFO, localUserInfo); | ||
@@ -489,3 +492,3 @@ } | ||
this.kickedOut && this.kickedOut(event); | ||
TUIStore.update(StoreName.CALL, NAME.CALL_TIPS, this._generateText(CallTips.KICK_OUT)); | ||
TUIStore.update(StoreName.CALL, NAME.CALL_TIPS, generateText(TUIStore, CallTips.KICK_OUT)); | ||
this._resetCallStore(); | ||
@@ -611,44 +614,2 @@ } | ||
} | ||
private async _getMyProfile(myselfUserId: string): Promise<IUserInfo> { | ||
const localUserInfo: IUserInfo = setDefaultUserInfo(myselfUserId, NAME.LOCAL_VIDEO); | ||
try { | ||
const tim = this.getTim(); | ||
if (!tim) return localUserInfo; | ||
const res = await tim.getMyProfile(); | ||
if (res?.code === 0) { | ||
return { | ||
...localUserInfo, | ||
userId: res?.data?.userID, | ||
nick: res?.data?.nick, | ||
avatar: res?.data?.avatar, | ||
}; | ||
} | ||
return localUserInfo; | ||
} catch (error) { | ||
console.error(`${NAME.PREFIX}_getMyProfile failed, error: ${JSON.stringify(error)}.`); | ||
return localUserInfo; | ||
} | ||
} | ||
private async _getRemoteUserProfile(userIdList: Array<string>): Promise<any> { | ||
const remoteUserInfoList = userIdList.map((userId: string) => setDefaultUserInfo(userId)); | ||
try { | ||
const tim = this.getTim(); | ||
if (!tim) return remoteUserInfoList; | ||
const res = await tim.getUserProfile({ userIDList: userIdList }); | ||
if (res?.code === 0) { | ||
return (res?.data || []).map((obj: any) => { | ||
const defaultUserInfo = setDefaultUserInfo(obj.userID); | ||
return { | ||
...defaultUserInfo, | ||
nick: obj.nick, | ||
avatar: obj.avatar, | ||
}; | ||
}); | ||
} | ||
return remoteUserInfoList; | ||
} catch (error) { | ||
console.error(`${NAME.PREFIX}_getRemoteUserProfile failed, error: ${JSON.stringify(error)}.`); | ||
return remoteUserInfoList; | ||
} | ||
} | ||
private _setLocalUserInfoAudioVideoAvailable(isAvailable: boolean, type: string) { | ||
@@ -677,2 +638,4 @@ let localUserInfo = TUIStore.getData(StoreName.CALL, NAME.LOCAL_USER_INFO); | ||
}); | ||
const remoteUserInfoLists = await getRemoteUserProfile(remoteUserInfoList.map(obj => obj.userId), this.getTim()); | ||
remoteUserInfoLists.length > 0 && TUIStore.update(StoreName.CALL, NAME.REMOTE_USER_INFO_LIST, remoteUserInfoLists); | ||
} | ||
@@ -697,4 +660,2 @@ private async _updateCallStoreAfterCall(userIdList: string[], response: any) { | ||
this._setLocalUserInfoAudioVideoAvailable(true, NAME.AUDIO); // web && mini, default open audio | ||
const remoteUserInfoList = await this._getRemoteUserProfile(userIdList); | ||
remoteUserInfoList.length > 0 && TUIStore.update(StoreName.CALL, NAME.REMOTE_USER_INFO_LIST, remoteUserInfoList); | ||
} else { | ||
@@ -704,29 +665,4 @@ this._resetCallStore(); | ||
} | ||
// 生成弹框提示文案 | ||
private _generateText(key: string, prefix?: string, suffix?: string): string { | ||
let callTips = `${t(key)}`; | ||
const isGroup = TUIStore.getData(StoreName.CALL, NAME.IS_GROUP); | ||
if (isGroup) { | ||
callTips = prefix ? `${prefix} ${callTips}` : callTips; | ||
callTips = suffix ? `${callTips} ${suffix}` : callTips; | ||
} | ||
return callTips; | ||
} | ||
private _generateStatusChangeText(): string { | ||
const callStatus = TUIStore.getData(StoreName.CALL, NAME.CALL_STATUS); | ||
if (callStatus === CallStatus.IDLE) { | ||
return StatusChange.IDLE; | ||
} | ||
const isGroup = TUIStore.getData(StoreName.CALL, NAME.IS_GROUP); | ||
if (callStatus === CallStatus.CALLING) { | ||
return isGroup ? StatusChange.DIALING_GROUP : StatusChange.DIALING_C2C; | ||
} | ||
const callMediaType = TUIStore.getData(StoreName.CALL, NAME.CALL_MEDIA_TYPE); | ||
if (isGroup) { | ||
return callMediaType === CallMediaType.AUDIO ? StatusChange.CALLING_GROUP_AUDIO : StatusChange.CALLING_GROUP_VIDEO; | ||
} | ||
return callMediaType === CallMediaType.AUDIO ? StatusChange.CALLING_C2C_AUDIO : StatusChange.CALLING_C2C_VIDEO; | ||
} | ||
private _resetCallStore() { | ||
const oldStatusStr = this._generateStatusChangeText(); | ||
const oldStatusStr = generateStatusChangeText(TUIStore); | ||
this._stopTimer(); | ||
@@ -762,3 +698,3 @@ // localUserInfo, language 在通话结束后不需要清除 | ||
}); | ||
const newStatusStr = this._generateStatusChangeText(); | ||
const newStatusStr = generateStatusChangeText(TUIStore); | ||
if (oldStatusStr !== newStatusStr) { | ||
@@ -772,6 +708,6 @@ this.statusChanged && this.statusChanged({ oldStatus: oldStatusStr, newStatus: newStatusStr }); | ||
if (type === CallMediaType.AUDIO) { | ||
text = this._generateText(CallTips.NO_MICROPHONE_DEVICE_PERMISSION); | ||
text = generateText(TUIStore, CallTips.NO_MICROPHONE_DEVICE_PERMISSION); | ||
} | ||
if (type === CallMediaType.VIDEO) { | ||
text = this._generateText(CallTips.NO_CAMERA_DEVICE_PERMISSION); | ||
text = generateText(TUIStore, CallTips.NO_CAMERA_DEVICE_PERMISSION); | ||
} | ||
@@ -836,3 +772,3 @@ | ||
const oldStatus = isGroup ? StatusChange.DIALING_GROUP : StatusChange.DIALING_C2C; | ||
this.statusChanged && this.statusChanged({ oldStatus, newStatus: this._generateStatusChangeText() }); | ||
this.statusChanged && this.statusChanged({ oldStatus, newStatus: generateStatusChangeText(TUIStore) }); | ||
} | ||
@@ -839,0 +775,0 @@ } |
@@ -45,2 +45,4 @@ /** | ||
avatar?: string; | ||
remark?: string; | ||
displayUserInfo?: string; // 远端用户信息展示: remark -> nick -> userId, 简化 UI 组件 | ||
isAudioAvailable?: boolean; // 用来设置: 麦克风是否打开 | ||
@@ -47,0 +49,0 @@ isVideoAvailable?: boolean; // 用来设置: 摄像头是否打开 |
@@ -1,2 +0,1 @@ | ||
import { IUserInfo } from '../interface'; | ||
import { NAME } from '../const'; | ||
@@ -165,15 +164,2 @@ import TUIGlobal from '../TUIGlobal/tuiGlobal'; | ||
export function setDefaultUserInfo(userId: string, domId?: string): IUserInfo { | ||
const userInfo: IUserInfo = { | ||
userId, | ||
nick: '', | ||
avatar: '', | ||
isAudioAvailable: false, | ||
isVideoAvailable: false, | ||
isEnter: false, | ||
domId: domId || userId, | ||
}; | ||
return domId ? userInfo : { ...userInfo, isEnter: false }; // localUserInfo 没有 isEnter, remoteUserInfoList 有 isEnter | ||
} | ||
/* | ||
@@ -180,0 +166,0 @@ * 获取向下取整的 performance.now() 值 |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
1438725
179
10057
Updatedtuicall-engine-webrtc@^1.5.0