@trtc/calls-uikit-react 4.5.11 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/Components/TUICallKit/TUICallKit.tsx +2 -0
- package/src/Components/components/common/ButtonPanel/button/Camera.tsx +49 -6
- package/src/Components/components/common/ButtonPanel/button/Microphone.tsx +48 -6
- package/src/Components/components/common/PermissionDialog/DevicePermissionBanner.module.scss +55 -0
- package/src/Components/components/common/PermissionDialog/DevicePermissionBanner.tsx +78 -0
- package/src/Components/components/common/PermissionDialog/index.ts +3 -0
- package/src/TUICallService/CallService/index.ts +153 -9
- package/src/TUICallService/CallService/utils.ts +35 -23
- package/src/TUICallService/TUIStore/callStore.ts +1 -0
- package/src/TUICallService/const/index.ts +27 -0
- package/src/TUICallService/index.ts +2 -1
- package/src/TUICallService/interface/ICallStore.ts +2 -1
- package/src/TUICallService/locales/en.ts +26 -0
- package/src/TUICallService/locales/index.ts +66 -0
- package/src/TUICallService/locales/ja_JP.ts +26 -0
- package/src/TUICallService/locales/zh-cn.ts +35 -0
- package/src/index.ts +1 -1
- package/tuicall-uikit-react.es.js +3442 -3110
- package/tuicall-uikit-react.umd.js +4 -4
- package/types/Components/components/common/PermissionDialog/DevicePermissionBanner.d.ts +1 -0
- package/types/Components/components/common/PermissionDialog/index.d.ts +2 -0
- package/types/TUICallService/CallService/index.d.ts +30 -0
- package/types/TUICallService/const/index.d.ts +13 -0
- package/types/TUICallService/index.d.ts +2 -2
- package/types/TUICallService/interface/ICallStore.d.ts +2 -1
- package/types/TUICallService/locales/en.d.ts +25 -0
- package/types/TUICallService/locales/index.d.ts +14 -0
- package/types/TUICallService/locales/ja_JP.d.ts +25 -0
- package/types/TUICallService/locales/zh-cn.d.ts +25 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function DevicePermissionBanner(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -18,6 +18,7 @@ export default class TUICallService {
|
|
|
18
18
|
private _currentGroupId;
|
|
19
19
|
private _offlinePushInfo;
|
|
20
20
|
private _permissionCheckTimer;
|
|
21
|
+
private _deviceErrorCodes;
|
|
21
22
|
private _chatCombine;
|
|
22
23
|
private _engineEventHandler;
|
|
23
24
|
private _wasmReadyPromise;
|
|
@@ -51,6 +52,7 @@ export default class TUICallService {
|
|
|
51
52
|
setCameraDefaultState(isOpen: boolean): void;
|
|
52
53
|
callExperimentalAPI(jsonStr: string): void;
|
|
53
54
|
accept(): Promise<void>;
|
|
55
|
+
_doAccept(): Promise<void>;
|
|
54
56
|
private _handleAcceptResponse;
|
|
55
57
|
hangup(): Promise<void>;
|
|
56
58
|
reject(): Promise<void>;
|
|
@@ -84,6 +86,34 @@ export default class TUICallService {
|
|
|
84
86
|
setVideoDisplayMode(displayMode: VideoDisplayMode): void;
|
|
85
87
|
setVideoResolution(resolution: VideoResolution): Promise<void>;
|
|
86
88
|
startTimer(): void;
|
|
89
|
+
/**
|
|
90
|
+
* Check device permissions after call/accept succeeds.
|
|
91
|
+
* 1. Show an error toast summarizing unavailable devices.
|
|
92
|
+
* 2. Store the unavailable-device reasons so the banner bar and button badges
|
|
93
|
+
* can render accordingly (aligned with interaction design).
|
|
94
|
+
*/
|
|
95
|
+
private _updateDeviceUnavailableHints;
|
|
96
|
+
/**
|
|
97
|
+
* Resolve the classified reasons for currently unavailable devices from the engine's
|
|
98
|
+
* cached permission. Returns null when all required devices are available; otherwise
|
|
99
|
+
* returns the per-device reason. Derived values (whether it is a permission issue,
|
|
100
|
+
* device-name text) are computed by the UI from these reasons.
|
|
101
|
+
*/
|
|
102
|
+
private _resolveUnavailableDevices;
|
|
103
|
+
private _classifyDeviceErrorReason;
|
|
104
|
+
/**
|
|
105
|
+
* Probe device permission by reusing engine's device permission check, which
|
|
106
|
+
* triggers getUserMedia and classifies the failure (incl. iOS repeated-call and
|
|
107
|
+
* http protocol handling). The thrown error's code is cached per device so the
|
|
108
|
+
* service layer can decide device availability without engine-side errorName.
|
|
109
|
+
* Audio and video are probed separately because engine aborts on the first failure.
|
|
110
|
+
*/
|
|
111
|
+
probeDevicePermission(opts: {
|
|
112
|
+
audio?: boolean;
|
|
113
|
+
video?: boolean;
|
|
114
|
+
}): Promise<void>;
|
|
115
|
+
resetDeviceError(type: 'audio' | 'video'): void;
|
|
116
|
+
isDeviceKnownUnavailable(type: 'audio' | 'video'): boolean;
|
|
87
117
|
private _handleCallError;
|
|
88
118
|
private _updateCallStoreBeforeCall;
|
|
89
119
|
private _updateCallStoreAfterCall;
|
|
@@ -8,6 +8,19 @@ export declare const PUSHER_ID: {
|
|
|
8
8
|
NEW_PUSHER: string;
|
|
9
9
|
};
|
|
10
10
|
export declare const NAME: any;
|
|
11
|
+
export type DeviceErrorReason = 'no-permission' | 'no-device' | 'device-occupied' | 'unknown' | null;
|
|
12
|
+
export interface DeviceUnavailableReasons {
|
|
13
|
+
microphone: DeviceErrorReason;
|
|
14
|
+
camera: DeviceErrorReason;
|
|
15
|
+
}
|
|
16
|
+
export declare const DEVICE_ERROR_CODE: {
|
|
17
|
+
NONE: number;
|
|
18
|
+
PERMISSION_DENIED: number;
|
|
19
|
+
NO_MICROPHONE: number;
|
|
20
|
+
NO_CAMERA: number;
|
|
21
|
+
MICROPHONE_NOT_READABLE: number;
|
|
22
|
+
CAMERA_NOT_READABLE: number;
|
|
23
|
+
};
|
|
11
24
|
export declare const AudioCallIcon = "https://web.sdk.qcloud.com/component/TUIKit/assets/call.png";
|
|
12
25
|
export declare const VideoCallIcon = "https://web.sdk.qcloud.com/component/TUIKit/assets/call-video-reverse.svg";
|
|
13
26
|
export declare const MAX_NUMBER_ROOM_ID = 2147483647;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import TUICallService, { TUIGlobal, TUIStore, uiDesign } from './CallService/index';
|
|
2
2
|
import { StoreName, NAME, CallRole, CallMediaType, CallStatus, StatusChange, VideoResolution, VideoDisplayMode, AudioPlayBackDevice, FeatureButton, LayoutMode, CloudRecordPolicy } from './const/index';
|
|
3
|
-
import { t } from './locales/index';
|
|
3
|
+
import { t, buildDeviceUnavailableText } from './locales/index';
|
|
4
4
|
declare const TUICallKitAPI: TUICallService;
|
|
5
|
-
export { TUIGlobal, TUIStore, StoreName, TUICallKitAPI, NAME, CallStatus, CallRole, CallMediaType, StatusChange, VideoResolution, VideoDisplayMode, AudioPlayBackDevice, t, uiDesign, FeatureButton, LayoutMode, CloudRecordPolicy, };
|
|
5
|
+
export { TUIGlobal, TUIStore, StoreName, TUICallKitAPI, NAME, CallStatus, CallRole, CallMediaType, StatusChange, VideoResolution, VideoDisplayMode, AudioPlayBackDevice, t, buildDeviceUnavailableText, uiDesign, FeatureButton, LayoutMode, CloudRecordPolicy, };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CallStatus, CallRole, CallMediaType, VideoDisplayMode, VideoResolution, TDeviceList, CameraPosition, ICustomUIConfig } from '../const/index';
|
|
1
|
+
import { CallStatus, CallRole, CallMediaType, VideoDisplayMode, VideoResolution, TDeviceList, CameraPosition, ICustomUIConfig, DeviceUnavailableReasons } from '../const/index';
|
|
2
2
|
import { IUserInfo, INetWorkQuality } from './index';
|
|
3
3
|
export interface IToastInfo {
|
|
4
4
|
text: string;
|
|
@@ -49,4 +49,5 @@ export interface ICallStore {
|
|
|
49
49
|
realtimeMessageList: [];
|
|
50
50
|
isAITranscriberEnabled: boolean;
|
|
51
51
|
isAITranscriberRunning: boolean;
|
|
52
|
+
deviceUnavailableReasons: DeviceUnavailableReasons | null;
|
|
52
53
|
}
|
|
@@ -44,6 +44,10 @@ export declare const en: {
|
|
|
44
44
|
'camera disabled': string;
|
|
45
45
|
'microphone enabled': string;
|
|
46
46
|
'microphone disabled': string;
|
|
47
|
+
'no mic permission': string;
|
|
48
|
+
'no mic device': string;
|
|
49
|
+
'no cam permission': string;
|
|
50
|
+
'no cam device': string;
|
|
47
51
|
'speaker enabled': string;
|
|
48
52
|
'speaker disabled': string;
|
|
49
53
|
'open speaker': string;
|
|
@@ -144,6 +148,27 @@ export declare const en: {
|
|
|
144
148
|
'error.10017': string;
|
|
145
149
|
'error.10018': string;
|
|
146
150
|
error: string;
|
|
151
|
+
'permission-device-separator': string;
|
|
152
|
+
'permission-phrase-separator': string;
|
|
153
|
+
'permission-sentence-separator': string;
|
|
154
|
+
'permission-phrase-perm': string;
|
|
155
|
+
'permission-phrase-no-device': string;
|
|
156
|
+
'permission-phrase-occupied': string;
|
|
157
|
+
'permission-phrase-unknown': string;
|
|
158
|
+
'permission-toast-suffix': string;
|
|
159
|
+
'permission-toast-raw': string;
|
|
160
|
+
'permission-banner-guide-perm': string;
|
|
161
|
+
'permission-banner-guide-perm-h5': string;
|
|
162
|
+
'permission-banner-guide-no-device': string;
|
|
163
|
+
'permission-banner-guide-no-device-h5': string;
|
|
164
|
+
'permission-btn-mic-no-perm': string;
|
|
165
|
+
'permission-btn-mic-no-device': string;
|
|
166
|
+
'permission-btn-mic-occupied': string;
|
|
167
|
+
'permission-btn-cam-no-perm': string;
|
|
168
|
+
'permission-btn-cam-no-device': string;
|
|
169
|
+
'permission-btn-cam-occupied': string;
|
|
170
|
+
'permission-btn-mic-no-perm-h5': string;
|
|
171
|
+
'permission-btn-cam-no-perm-h5': string;
|
|
147
172
|
'ai-subtitle': string;
|
|
148
173
|
'ai-subtitle-settings': string;
|
|
149
174
|
'recognition-language': string;
|
|
@@ -7,4 +7,18 @@ interface languageItemType {
|
|
|
7
7
|
interface languageDataType {
|
|
8
8
|
[key: string]: languageItemType;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Build a device-unavailability message by grouping devices by their error reason,
|
|
12
|
+
* so each reason is described accurately. For example, when the microphone has no
|
|
13
|
+
* permission and the camera has no device, it produces
|
|
14
|
+
* "麦克风权限未开启,未检测到摄像头" instead of wrongly saying both lack permission.
|
|
15
|
+
*
|
|
16
|
+
* @param audioReason classified reason for the microphone, or null if available
|
|
17
|
+
* @param videoReason classified reason for the camera, or null if available
|
|
18
|
+
* @param scene 'plain' returns the grouped description only; 'toast' appends the
|
|
19
|
+
* in-call suffix; 'banner' appends the guidance sentence
|
|
20
|
+
* @param isMobile selects PC vs H5 guidance text (banner only)
|
|
21
|
+
* @returns the composed localized text, or '' when no device is unavailable
|
|
22
|
+
*/
|
|
23
|
+
export declare function buildDeviceUnavailableText(audioReason: string | null, videoReason: string | null, scene: 'plain' | 'toast' | 'banner', isMobile?: boolean): string;
|
|
10
24
|
export {};
|
|
@@ -54,6 +54,10 @@ export declare const ja_JP: {
|
|
|
54
54
|
'camera disabled': string;
|
|
55
55
|
'microphone enabled': string;
|
|
56
56
|
'microphone disabled': string;
|
|
57
|
+
'no mic permission': string;
|
|
58
|
+
'no mic device': string;
|
|
59
|
+
'no cam permission': string;
|
|
60
|
+
'no cam device': string;
|
|
57
61
|
'speaker enabled': string;
|
|
58
62
|
'speaker disabled': string;
|
|
59
63
|
'open speaker': string;
|
|
@@ -142,6 +146,27 @@ export declare const ja_JP: {
|
|
|
142
146
|
'error.10017': string;
|
|
143
147
|
'error.10018': string;
|
|
144
148
|
error: string;
|
|
149
|
+
'permission-device-separator': string;
|
|
150
|
+
'permission-phrase-separator': string;
|
|
151
|
+
'permission-sentence-separator': string;
|
|
152
|
+
'permission-phrase-perm': string;
|
|
153
|
+
'permission-phrase-no-device': string;
|
|
154
|
+
'permission-phrase-occupied': string;
|
|
155
|
+
'permission-phrase-unknown': string;
|
|
156
|
+
'permission-toast-suffix': string;
|
|
157
|
+
'permission-toast-raw': string;
|
|
158
|
+
'permission-banner-guide-perm': string;
|
|
159
|
+
'permission-banner-guide-perm-h5': string;
|
|
160
|
+
'permission-banner-guide-no-device': string;
|
|
161
|
+
'permission-banner-guide-no-device-h5': string;
|
|
162
|
+
'permission-btn-mic-no-perm': string;
|
|
163
|
+
'permission-btn-mic-no-device': string;
|
|
164
|
+
'permission-btn-mic-occupied': string;
|
|
165
|
+
'permission-btn-cam-no-perm': string;
|
|
166
|
+
'permission-btn-cam-no-device': string;
|
|
167
|
+
'permission-btn-cam-occupied': string;
|
|
168
|
+
'permission-btn-mic-no-perm-h5': string;
|
|
169
|
+
'permission-btn-cam-no-perm-h5': string;
|
|
145
170
|
'ai-subtitle': string;
|
|
146
171
|
'ai-subtitle-settings': string;
|
|
147
172
|
'recognition-language': string;
|
|
@@ -44,6 +44,10 @@ export declare const zh: {
|
|
|
44
44
|
'camera disabled': string;
|
|
45
45
|
'microphone enabled': string;
|
|
46
46
|
'microphone disabled': string;
|
|
47
|
+
'no mic permission': string;
|
|
48
|
+
'no mic device': string;
|
|
49
|
+
'no cam permission': string;
|
|
50
|
+
'no cam device': string;
|
|
47
51
|
'speaker enabled': string;
|
|
48
52
|
'speaker disabled': string;
|
|
49
53
|
'open speaker': string;
|
|
@@ -139,6 +143,27 @@ export declare const zh: {
|
|
|
139
143
|
'error.10017': string;
|
|
140
144
|
'error.10018': string;
|
|
141
145
|
error: string;
|
|
146
|
+
'permission-device-separator': string;
|
|
147
|
+
'permission-phrase-separator': string;
|
|
148
|
+
'permission-sentence-separator': string;
|
|
149
|
+
'permission-phrase-perm': string;
|
|
150
|
+
'permission-phrase-no-device': string;
|
|
151
|
+
'permission-phrase-occupied': string;
|
|
152
|
+
'permission-phrase-unknown': string;
|
|
153
|
+
'permission-toast-suffix': string;
|
|
154
|
+
'permission-toast-raw': string;
|
|
155
|
+
'permission-banner-guide-perm': string;
|
|
156
|
+
'permission-banner-guide-perm-h5': string;
|
|
157
|
+
'permission-banner-guide-no-device': string;
|
|
158
|
+
'permission-banner-guide-no-device-h5': string;
|
|
159
|
+
'permission-btn-mic-no-perm': string;
|
|
160
|
+
'permission-btn-mic-no-device': string;
|
|
161
|
+
'permission-btn-mic-occupied': string;
|
|
162
|
+
'permission-btn-cam-no-perm': string;
|
|
163
|
+
'permission-btn-cam-no-device': string;
|
|
164
|
+
'permission-btn-cam-occupied': string;
|
|
165
|
+
'permission-btn-mic-no-perm-h5': string;
|
|
166
|
+
'permission-btn-cam-no-perm-h5': string;
|
|
142
167
|
'ai-subtitle': string;
|
|
143
168
|
'ai-subtitle-settings': string;
|
|
144
169
|
'recognition-language': string;
|