@tencentcloud/call-uikit-vue2
Advanced tools
Comparing version 2.3.9 to 2.4.0
{ | ||
"name": "@tencentcloud/call-uikit-vue2", | ||
"version": "2.3.9", | ||
"version": "2.4.0", | ||
"main": "./tuicall-uikit-vue2.umd.js", | ||
@@ -16,3 +16,3 @@ "module": "./tuicall-uikit-vue2.es.js", | ||
"dependencies": { | ||
"tuicall-engine-webrtc": "^1.5.5" | ||
"tuicall-engine-webrtc": "^1.5.6" | ||
}, | ||
@@ -19,0 +19,0 @@ "bugs": { |
@@ -32,3 +32,3 @@ import { | ||
}; | ||
const Version = '2.3.9'; // basic-demo 原来上报使用 | ||
const Version = '2.4.0'; // basic-demo 原来上报使用 | ||
@@ -35,0 +35,0 @@ // 输出产物 |
@@ -38,3 +38,3 @@ import { ITUICallService, ICallParams, IGroupCallParams, IUserInfo, ICallbackParam, ISelfInfoParams } from '../interface/ICallService'; | ||
const TUIStore: ITUIStore = TuiStore.getInstance(); | ||
const version = '2.3.9'; | ||
const version = '2.4.0'; | ||
const frameWork = 'vue2.7'; | ||
@@ -85,2 +85,4 @@ export { TUIGlobal, TUIStore }; | ||
this._callingBell = new BellContext(); | ||
this._updateDeviceList(); | ||
} catch (error) { | ||
@@ -179,2 +181,5 @@ console.error(`${NAME.PREFIX}init failed, error: ${JSON.stringify(error)}.`); | ||
} | ||
public enableFloatWindow(enable: boolean) { | ||
TUIStore.update(StoreName.CALL, NAME.ENABLE_FLOAT_WINDOW, enable); | ||
} | ||
public async setSelfInfo(params: ISelfInfoParams) { | ||
@@ -274,2 +279,7 @@ const { nickName, avatar } = params; | ||
} | ||
@avoidRepeatedCall() | ||
public switchScreen(userId: string) { | ||
if(!userId) return; | ||
TUIStore.update(StoreName.CALL, NAME.BIG_SCREEN_USER_ID, userId); | ||
} | ||
// support video to audio; not support audio to video | ||
@@ -314,3 +324,10 @@ @avoidRepeatedCall() | ||
} | ||
@avoidRepeatedCall() | ||
public async switchDevice(params) { | ||
try { | ||
await this._tuiCallEngine.switchDevice(params); | ||
} catch (error) { | ||
console.error(`${NAME.PREFIX}_switchDevice failed, error: ${JSON.stringify(error)}.`); | ||
} | ||
} | ||
// ==========================【TUICallEngine 事件处理】========================== | ||
@@ -339,2 +356,3 @@ private _addListenTuiCallEngineEvent() { | ||
this._tuiCallEngine.on(TUICallEvent.USER_VOICE_VOLUME, this._handleUserVoiceVolume, this); | ||
this._tuiCallEngine.on(TUICallEvent.DEVICED_UPDATED, this._handleDeviceUpdate, this); | ||
} | ||
@@ -359,2 +377,3 @@ private _removeListenTuiCallEngineEvent() { | ||
this._tuiCallEngine.off(TUICallEvent.USER_VOICE_VOLUME, this._handleUserVoiceVolume); // web | ||
this._tuiCallEngine.off(TUICallEvent.DEVICED_UPDATED, this._handleDeviceUpdate); | ||
} | ||
@@ -541,2 +560,31 @@ private _handleError(event: any): void { | ||
} | ||
private _handleDeviceUpdate(event: any): void { | ||
const { cameraList, microphoneList, currentCamera, currentMicrophone } = event; | ||
console.warn('######', event); | ||
TUIStore.update(StoreName.CALL, NAME.DEVICE_LIST, { cameraList, microphoneList, currentCamera, currentMicrophone }); | ||
} | ||
private _updateDeviceList() { | ||
this._tuiCallEngine.getDeviceList('camera').then((result) => { | ||
const deviceList = TUIStore.getData(StoreName.CALL, NAME.DEVICE_LIST); | ||
const currentCamera = result?.[0] || {}; | ||
TUIStore.update( | ||
StoreName.CALL, | ||
NAME.DEVICE_LIST, | ||
{ ...deviceList, cameraList: result, currentCamera }, | ||
); | ||
}).catch(error => { | ||
console.error(`${NAME.PREFIX}updateCameraList failed, error: ${JSON.stringify(error)}.`); | ||
}); | ||
this._tuiCallEngine.getDeviceList('microphones').then((result) => { | ||
const deviceList = TUIStore.getData(StoreName.CALL, NAME.DEVICE_LIST); | ||
const currentMicrophone = result?.[0] || {}; | ||
TUIStore.update( | ||
StoreName.CALL, | ||
NAME.DEVICE_LIST, | ||
{ ...deviceList, microphoneList: result, currentMicrophone }, | ||
); | ||
}).catch(error => { | ||
console.error(`${NAME.PREFIX}updateMicrophoneList failed, error: ${JSON.stringify(error)}.`); | ||
}); | ||
} | ||
// ==========================【 miniProgram 私有事件】========================== | ||
@@ -559,2 +607,11 @@ // ========================【原 Web CallKit 提供的方法】======================== | ||
} | ||
public async getDeviceList(deviceType: string) { | ||
try { | ||
const response = await this._tuiCallEngine.getDeviceList(deviceType); | ||
return response; | ||
} catch (error: any) { | ||
this._handleCallError(error, 'call'); | ||
} | ||
}; | ||
public toggleMinimize() { | ||
@@ -665,2 +722,11 @@ const isMinimized = TUIStore.getData(StoreName.CALL, NAME.IS_MINIMIZED); | ||
} | ||
private _resetCurrentDevice() { | ||
// 挂断后,重置当前摄像头和麦克风为默认设备 | ||
const { cameraList, microphoneList } = TUIStore.getData(StoreName.CALL, NAME.DEVICE_LIST); | ||
TUIStore.update( | ||
StoreName.CALL, | ||
NAME.DEVICE_LIST, | ||
{ microphoneList, cameraList, currentCamera: cameraList?.[0] || {}, currentMicrophone: microphoneList?.[0] || {} }, | ||
); | ||
} | ||
private _resetCallStore() { | ||
@@ -673,2 +739,3 @@ const oldStatusStr = generateStatusChangeText(TUIStore); | ||
// displayMode、videoResolution 也不能清除, 组件不卸载, 这些属性也需保留, 否则采用默认值. | ||
// enableFloatWindow 不清除:开启/关闭悬浮窗功能。 | ||
let notResetOrNotifyKeys = Object.keys(CALL_DATA_KEY).filter((key) => { | ||
@@ -681,2 +748,3 @@ switch (CALL_DATA_KEY[key]) { | ||
case NAME.VIDEO_RESOLUTION: | ||
case NAME.ENABLE_FLOAT_WINDOW: | ||
case NAME.LOCAL_USER_INFO: { | ||
@@ -700,2 +768,3 @@ return false; | ||
}); | ||
this._resetCurrentDevice(); | ||
const newStatusStr = generateStatusChangeText(TUIStore); | ||
@@ -772,4 +841,9 @@ if (oldStatusStr !== newStatusStr) { | ||
const isGroup = TUIStore.getData(StoreName.CALL, NAME.IS_GROUP); | ||
const callMediaType = TUIStore.getData(StoreName.CALL, NAME.CALL_MEDIA_TYPE); | ||
const remoteUserInfoList = TUIStore.getData(StoreName.CALL, NAME.REMOTE_USER_INFO_LIST); | ||
const oldStatus = isGroup ? StatusChange.DIALING_GROUP : StatusChange.DIALING_C2C; | ||
this.statusChanged && this.statusChanged({ oldStatus, newStatus: generateStatusChangeText(TUIStore) }); | ||
if (!isGroup && callMediaType === CallMediaType.VIDEO) { | ||
this.switchScreen(remoteUserInfoList[0].domId); | ||
} | ||
} | ||
@@ -776,0 +850,0 @@ } |
@@ -65,4 +65,12 @@ /** | ||
'ZH-CN' = 'zh-cn', | ||
JA_JP = 'ja_JP', | ||
} | ||
export type TDeviceList = { | ||
cameraList: any[], | ||
microphoneList: any[], | ||
currentCamera: any, | ||
currentMicrophone: any, | ||
}; | ||
/* === 【原来 TUICallKit 对外暴露】=== */ | ||
@@ -90,1 +98,6 @@ // 原来 web callKit 定义通知外部状态变更的变量, 对外暴露 | ||
}; | ||
export enum DeviceType { | ||
MICROPHONE = 'microphone', | ||
CAMERA = 'camera', | ||
} |
@@ -9,2 +9,3 @@ // 错误码 | ||
NOT_SUPPORTED_WEBRTC: 60006, | ||
ERROR_BLACKLIST: 20007, | ||
} as const; | ||
@@ -19,2 +20,3 @@ | ||
NOT_SUPPORTED_WEBRTC: 'not-supported-webrtc', | ||
ERROR_BLACKLIST: 'blacklist-user-tips' | ||
} as const; |
@@ -21,2 +21,4 @@ export * from './call'; | ||
IS_MINIMIZED: 'isMinimized', | ||
ENABLE_FLOAT_WINDOW: 'enableFloatWindow', | ||
BIG_SCREEN_USER_ID: 'bigScreenUserId', | ||
LANGUAGE: 'language', | ||
@@ -50,2 +52,3 @@ IS_CLICKABLE: 'isClickable', | ||
MYSELF: 'myself', | ||
DEVICE_LIST: 'deviceList', | ||
...CALL_DATA_KEY, | ||
@@ -52,0 +55,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
import { CallStatus, CallRole, CallMediaType, VideoDisplayMode, VideoResolution } from '../const'; | ||
import { CallStatus, CallRole, CallMediaType, VideoDisplayMode, VideoResolution, TDeviceList } from '../const'; | ||
import { IUserInfo } from './index'; | ||
@@ -21,6 +21,9 @@ | ||
toastInfo: IToastInfo; // 远端用户挂断、拒绝、超时、忙线等的 toast 提示信息 | ||
isMinimized: boolean; // 是否最小化, 默认: false | ||
isMinimized: boolean; // 当前是否悬浮窗模式, 默认: false | ||
enableFloatWindow: boolean, // 开启/关闭悬浮窗功能,默认: false | ||
bigScreenUserId: string, // 当前大屏幕显示的 userID 用户 | ||
language: string; // 当前语言 | ||
isClickable: boolean; // 按钮是否可点击(呼叫后, '挂断' 按钮不可点击, 发送信令后才可以点击) | ||
showPermissionTip: boolean; // 设备权限弹窗是否展示(如果有麦克风权限为 false,如果没有麦克风也没有摄像头权限为 true) | ||
deviceList: TDeviceList, | ||
// TUICallKit 组件上的属性 | ||
@@ -27,0 +30,0 @@ displayMode: VideoDisplayMode; // 设置预览远端的画面显示模式, 默认: VideoDisplayMode.COVER |
@@ -50,4 +50,2 @@ export const en = { | ||
'me': '(me)', | ||
'start-voice-call': 'Audio call from ', | ||
'start-video-call': 'Video call from ', | ||
'be-rejected': 'Call declined, ', | ||
@@ -68,2 +66,3 @@ 'be-no-response': 'No response, ', | ||
'not-supported-webrtc': 'Your current environment does not support WebRTC', | ||
'blacklist-user-tips': 'The identifier is in blacklist. Failed to send this message!', | ||
'is-already-calling': 'TUICallKit is already on a call', | ||
@@ -74,5 +73,3 @@ 'need-init': 'Before initiating a call with TUICallKit, ensure that the TUICallKitServer.init() method has executed successfully. ', | ||
'Wechat scan right QR code': 'Wechat scan right QR code', | ||
'try': 'try', | ||
'Scan the QR code above': 'Scan the QR code above', | ||
'Make video calls yourself': 'Make video calls yourself', | ||
'accept-error': 'Accept failed', | ||
@@ -86,2 +83,6 @@ 'accept-device-error': 'Accept failed, unable to auth calling device', | ||
'win-preferences': 'Open Setting', | ||
'open camera': 'Open Camera', | ||
'close camera': 'Close Camera', | ||
'open microphone': 'Open Microphone', | ||
'close microphone': 'Close Microphone', | ||
}; |
@@ -5,2 +5,3 @@ import { TUIStore } from '../CallService/index'; | ||
import { zh } from './zh-cn'; | ||
import { ja_JP } from './ja_JP'; | ||
@@ -28,2 +29,3 @@ export const CallTips: any = { | ||
'zh-cn': zh, | ||
ja_JP, | ||
}; | ||
@@ -30,0 +32,0 @@ |
@@ -30,5 +30,3 @@ export const zh = { | ||
'Use-phone-and-computer': '用手机与电脑互打体验视频通话', | ||
'try': '试试', | ||
'Scan the QR code above': '扫描上方二维码', | ||
'Make video calls yourself': '自己玩转视频通话', | ||
'no-user': '未搜索到用户', | ||
@@ -55,4 +53,2 @@ 'member-not-added': '未添加成员', | ||
'me': '(我)', | ||
'start-voice-call': '发起的语音通话', | ||
'start-video-call': '发起的视频通话', | ||
'be-rejected': '对方已拒绝,', | ||
@@ -73,2 +69,3 @@ 'be-no-response': '对方无应答,', | ||
'not-supported-webrtc': '当前环境不支持 WebRTC', | ||
'blacklist-user-tips': '发起通话失败,被对方拉入黑名单,禁止发起!', | ||
'is-already-calling': 'TUICallKit 已在通话状态', | ||
@@ -85,2 +82,6 @@ 'need-init': 'TUICallKit 发起通话前需保证 TUICallKitServer.init() 方法执行成功', | ||
'win-preferences': '打开系统设置', | ||
'open camera': '打开摄像头', | ||
'close camera': '关闭摄像头', | ||
'open microphone': '打开麦克风', | ||
'close microphone': '关闭麦克风', | ||
}; |
@@ -31,2 +31,4 @@ import { TUICallKitServer, NAME, TUIStore, StoreName } from '../../index'; | ||
this._watchTUIStore(); | ||
// 全局监听下,关闭悬浮窗 | ||
TUICallKitServer.enableFloatWindow(false); | ||
console.log(`${PREFIX} init Ready!`); | ||
@@ -33,0 +35,0 @@ } catch (error) { |
@@ -17,5 +17,8 @@ import { CallStatus, CallRole, CallMediaType, VideoDisplayMode, VideoResolution } from '../const'; | ||
toastInfo: { text: '' }, // 远端用户挂断、拒绝、超时、忙线等的 toast 提示信息 | ||
isMinimized: false, // 用来记录 web 是否是小窗模式 | ||
isMinimized: false, // 用来记录当前是否悬浮窗模式 | ||
enableFloatWindow: false, // 开启/关闭悬浮窗功能,设置为false,通话界面左上角的悬浮窗按钮会隐藏 | ||
bigScreenUserId: '', // 当前大屏幕显示的 userID 用户 | ||
language: getLanguage(), // en, zh-cn | ||
isClickable: false, // 是否可点击, 用于按钮增加 loading 效果,不可点击 | ||
deviceList: { cameraList: [], microphoneList: [], currentCamera: {}, currentMicrophone: {} }, | ||
showPermissionTip: false, | ||
@@ -22,0 +25,0 @@ // TUICallKit 组件上的属性 |
@@ -196,6 +196,17 @@ import { NAME } from '../const'; | ||
// @ts-ignore | ||
const lang = navigator?.language || navigator?.userLanguage || ''; | ||
return lang.substr(0, 2) === 'zh' ? 'zh-cn' : 'en'; | ||
const lang = (navigator?.language || navigator?.userLanguage || '').substr(0, 2); | ||
let language = 'en'; | ||
switch (lang) { | ||
case 'zh': | ||
language = 'zh-cn'; | ||
break; | ||
case 'ja': | ||
language = 'ja_JP'; | ||
break; | ||
default: | ||
language = 'en'; | ||
} | ||
return language; | ||
}; | ||
export function noop(e: any) {} |
@@ -27,2 +27,3 @@ import { ITUICallService, ICallParams, IGroupCallParams, ICallbackParam, ISelfInfoParams } from '../interface/ICallService'; | ||
setLanguage(language: LanguageType): void; | ||
enableFloatWindow(enable: boolean): void; | ||
setSelfInfo(params: ISelfInfoParams): Promise<void>; | ||
@@ -37,2 +38,3 @@ enableAIVoice(enable: boolean): Promise<void>; | ||
closeMicrophone(): Promise<void>; | ||
switchScreen(userId: string): void; | ||
switchCallMediaType(): Promise<void>; | ||
@@ -43,2 +45,3 @@ switchCamera(): Promise<void>; | ||
setCallingBell(filePath?: string): Promise<void>; | ||
switchDevice(params: any): Promise<void>; | ||
private _addListenTuiCallEngineEvent; | ||
@@ -65,2 +68,4 @@ private _removeListenTuiCallEngineEvent; | ||
private _handleUserVoiceVolume; | ||
private _handleDeviceUpdate; | ||
private _updateDeviceList; | ||
private _handleUserUpdate; | ||
@@ -74,2 +79,3 @@ beforeCalling: ((...args: any[]) => void) | undefined; | ||
setCallback(params: ICallbackParam): void; | ||
getDeviceList(deviceType: string): Promise<any>; | ||
toggleMinimize(): void; | ||
@@ -86,2 +92,3 @@ private _executeExternalBeforeCalling; | ||
private _updateCallStoreAfterCall; | ||
private _resetCurrentDevice; | ||
private _resetCallStore; | ||
@@ -88,0 +95,0 @@ private _noDevicePermissionToast; |
@@ -63,4 +63,11 @@ /** | ||
EN = "en", | ||
'ZH-CN' = "zh-cn" | ||
'ZH-CN' = "zh-cn", | ||
JA_JP = "ja_JP" | ||
} | ||
export declare type TDeviceList = { | ||
cameraList: any[]; | ||
microphoneList: any[]; | ||
currentCamera: any; | ||
currentMicrophone: any; | ||
}; | ||
export declare const StatusChange: { | ||
@@ -84,1 +91,5 @@ readonly IDLE: "idle"; | ||
} | ||
export declare enum DeviceType { | ||
MICROPHONE = "microphone", | ||
CAMERA = "camera" | ||
} |
@@ -1,2 +0,2 @@ | ||
import { CallStatus, CallRole, CallMediaType, VideoDisplayMode, VideoResolution } from '../const'; | ||
import { CallStatus, CallRole, CallMediaType, VideoDisplayMode, VideoResolution, TDeviceList } from '../const'; | ||
import { IUserInfo } from './index'; | ||
@@ -19,5 +19,8 @@ export interface IToastInfo { | ||
isMinimized: boolean; | ||
enableFloatWindow: boolean; | ||
bigScreenUserId: string; | ||
language: string; | ||
isClickable: boolean; | ||
showPermissionTip: boolean; | ||
deviceList: TDeviceList; | ||
displayMode: VideoDisplayMode; | ||
@@ -24,0 +27,0 @@ videoResolution: VideoResolution; |
@@ -49,4 +49,2 @@ export declare const en: { | ||
me: string; | ||
'start-voice-call': string; | ||
'start-video-call': string; | ||
'be-rejected': string; | ||
@@ -67,2 +65,3 @@ 'be-no-response': string; | ||
'not-supported-webrtc': string; | ||
'blacklist-user-tips': string; | ||
'is-already-calling': string; | ||
@@ -73,5 +72,3 @@ 'need-init': string; | ||
'Wechat scan right QR code': string; | ||
try: string; | ||
'Scan the QR code above': string; | ||
'Make video calls yourself': string; | ||
'accept-error': string; | ||
@@ -85,2 +82,6 @@ 'accept-device-error': string; | ||
'win-preferences': string; | ||
'open camera': string; | ||
'close camera': string; | ||
'open microphone': string; | ||
'close microphone': string; | ||
}; |
@@ -29,5 +29,3 @@ export declare const zh: { | ||
'Use-phone-and-computer': string; | ||
try: string; | ||
'Scan the QR code above': string; | ||
'Make video calls yourself': string; | ||
'no-user': string; | ||
@@ -54,4 +52,2 @@ 'member-not-added': string; | ||
me: string; | ||
'start-voice-call': string; | ||
'start-video-call': string; | ||
'be-rejected': string; | ||
@@ -72,2 +68,3 @@ 'be-no-response': string; | ||
'not-supported-webrtc': string; | ||
'blacklist-user-tips': string; | ||
'is-already-calling': string; | ||
@@ -84,2 +81,6 @@ 'need-init': string; | ||
'win-preferences': string; | ||
'open camera': string; | ||
'close camera': string; | ||
'open microphone': string; | ||
'close microphone': string; | ||
}; |
@@ -45,3 +45,3 @@ export declare const isUndefined: (input: any) => boolean; | ||
export declare const isFunction: (input: any) => boolean; | ||
export declare const getLanguage: () => "zh-cn" | "en"; | ||
export declare const getLanguage: () => string; | ||
export declare function noop(e: any): void; |
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 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 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
Sorry, the diff of this file is not supported yet
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
1524732
197
11002
64
Updatedtuicall-engine-webrtc@^1.5.6