@trtc/calls-uikit-vue2 4.5.1 → 4.5.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trtc/calls-uikit-vue2",
3
- "version": "4.5.1",
3
+ "version": "4.5.3",
4
4
  "main": "./tuicall-uikit-vue2.umd.js",
5
5
  "module": "./tuicall-uikit-vue2.es.js",
6
6
  "types": "./types/index.d.ts",
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "@tencentcloud/tui-core-lite": "~1.0.1",
17
- "@trtc/call-engine-lite-js": "~4.0.1",
17
+ "@trtc/call-engine-lite-js": "~4.0.4",
18
18
  "@tencentcloud/lite-chat": "^1.6.3",
19
19
  "@trtc/call-engine-lite-wx": "~4.0.0"
20
20
  },
@@ -4,6 +4,9 @@
4
4
  :class="[bodyStyle, miniMizedDeskStyle, mobileVideoStyle, mobileAudioStyle]">
5
5
  <SingleCall v-if="!callInfoContextValue.isGroupCall" class="singCall"></SingleCall>
6
6
  <GroupCall v-else class="singCall"></GroupCall>
7
+ <!-- @if process.env.BUILD_TARGET!='MINI' -->
8
+ <AutoPlayDialog />
9
+ <!-- @endif -->
7
10
  <AISubtitle />
8
11
  </div>
9
12
  </template>
@@ -15,6 +18,7 @@ import GroupCall from './components/GroupCall/GroupCall.vue';
15
18
  import { PermitTip } from './components/common/PermitTip/PermitTip';
16
19
  import { Toast } from './components/common/Toast';
17
20
  import AISubtitle from './components/common/AIAssistant/AISubtitle.vue';
21
+ import AutoPlayDialog from './components/common/AutoPlayDialog/AutoPlayDialog.vue';
18
22
  import { UIKitModal } from './components/common/UIKitModal';
19
23
  import { TUIGlobal, TUIStore, StoreName, TUICallKitAPI, NAME, CallStatus, CallMediaType, VideoDisplayMode, VideoResolution } from '../TUICallService/index';
20
24
  import {
@@ -1,9 +1,6 @@
1
1
  <template>
2
2
  <div class="groupcall-container">
3
3
  <TopBar />
4
- <!-- @if process.env.BUILD_TARGET!='MINI' -->
5
- <AutoPlayDialog />
6
- <!-- @endif -->
7
4
  <Waiting v-if="callStatus === CallStatus.CALLING && callRole === CallRole.CALLEE && !isFloatWindow" />
8
5
  <MediaContainer />
9
6
  <Tip />
@@ -26,7 +23,6 @@
26
23
  <script lang="ts" setup>
27
24
  import { ref, provide, toRefs, onMounted, onUnmounted } from '../../../adapter-vue';
28
25
  import TopBar from '../common/TopBar/TopBar.vue';
29
- import AutoPlayDialog from '../common/AutoPlayDialog/AutoPlayDialog.vue';
30
26
  import Waiting from '../common/Waiting/Waiting.vue';
31
27
  import MediaContainer from './MediaContainer/MediaContainer.vue';
32
28
  import Tip from '../common/Tip/Tip.vue';
@@ -1,9 +1,6 @@
1
1
  <template>
2
2
  <div class="singlecall-container">
3
3
  <TopBar />
4
- <!-- @if process.env.BUILD_TARGET!='MINI' -->
5
- <AutoPlayDialog />
6
- <!-- @endif -->
7
4
  <Waiting v-if="callStatus === CallStatus.CALLING" />
8
5
  <MediaContainer />
9
6
  <Tip />
@@ -15,7 +12,6 @@
15
12
  import { toRefs } from '../../../adapter-vue';
16
13
  import { CallStatus } from '../../../TUICallService';
17
14
  import TopBar from '../common/TopBar/TopBar.vue';
18
- import AutoPlayDialog from '../common/AutoPlayDialog/AutoPlayDialog.vue';
19
15
  import Waiting from '../common/Waiting/Waiting.vue';
20
16
  import MediaContainer from './MediaContainer/MediaContainer.vue';
21
17
  import Tip from '../common/Tip/Tip.vue';
@@ -15,27 +15,31 @@ export default {
15
15
 
16
16
  <script lang="ts" setup>
17
17
  import { ref, onMounted, onUnmounted } from '../../../../adapter-vue';
18
- import { TUICallKitAPI, TUIGlobal } from '../../../../TUICallService/index';
18
+ import { TUIStore, StoreName, NAME, TUIGlobal } from '../../../../TUICallService/index';
19
19
  import { useTranslate } from '../../../hooks';
20
20
  const t = useTranslate();
21
- const isAutoPlayDialogVisible = ref(false);
21
+ // The onAutoPlayFailed event is listened in CallService at initialization time and its result is
22
+ // stored in TUIStore, so here we only need to sync the visibility from the store.
23
+ const isAutoPlayDialogVisible = ref(TUIStore.getData(StoreName.CALL, NAME.IS_SHOW_AUTO_PLAY_DIALOG));
24
+
25
+ const handleAutoPlayDialogVisibleChange = (value: boolean) => {
26
+ isAutoPlayDialogVisible.value = value;
27
+ };
22
28
 
23
29
  onMounted(() => {
24
- const trtcCloudInstance = TUICallKitAPI.getTUICallEngineInstance().getTRTCCloudInstance();
25
- trtcCloudInstance.on('onAutoPlayFailed', autoPlayFailedHandler);
30
+ TUIStore.watch(StoreName.CALL, {
31
+ [NAME.IS_SHOW_AUTO_PLAY_DIALOG]: handleAutoPlayDialogVisibleChange,
32
+ });
26
33
  });
27
34
 
28
35
  onUnmounted(() => {
29
- const trtcCloudInstance = TUICallKitAPI.getTUICallEngineInstance().getTRTCCloudInstance();
30
- trtcCloudInstance.off('onAutoPlayFailed', autoPlayFailedHandler);
36
+ TUIStore.unwatch(StoreName.CALL, {
37
+ [NAME.IS_SHOW_AUTO_PLAY_DIALOG]: handleAutoPlayDialogVisibleChange,
38
+ });
31
39
  });
32
40
 
33
- const autoPlayFailedHandler = () => {
34
- isAutoPlayDialogVisible.value = true;
35
- };
36
-
37
41
  const handleResumePlaybackClick = () => {
38
- isAutoPlayDialogVisible.value = false;
42
+ TUIStore.update(StoreName.CALL, NAME.IS_SHOW_AUTO_PLAY_DIALOG, false);
39
43
  };
40
44
  </script>
41
45
 
@@ -27,7 +27,7 @@ const TUIGlobal: ITUIGlobal = TuiGlobal.getInstance();
27
27
  const TUIStore: ITUIStore = TuiStore.getInstance();
28
28
  const uiDesign = UIDesign.getInstance();
29
29
  uiDesign.setTUIStore(TUIStore);
30
- const version = '4.5.1';
30
+ const version = '4.5.3';
31
31
  import AIAssistant from './AIAssistant'; // 仅 web 支持 AI 实时字幕
32
32
  const frameWork = 'vue2.7';
33
33
  export { TUIGlobal, TUIStore, uiDesign };
@@ -51,6 +51,13 @@ export default class TUICallService {
51
51
  private _wasmReadyPromise;
52
52
  private _wasmReadyResolve;
53
53
  private _isInitialized = false;
54
+ // Use an arrow function to keep the `this` binding when registering/unregistering the listener.
55
+ private _handleAutoPlayFailed = () => {
56
+ this._tuiCallEngine?.reportLog?.({
57
+ name: 'TUICallkit.onAutoPlayFailed',
58
+ });
59
+ TUIStore.update(StoreName.CALL, NAME.IS_SHOW_AUTO_PLAY_DIALOG, true);
60
+ };
54
61
 
55
62
  constructor() {
56
63
  console.log(`${NAME.PREFIX}version: ${version}`);
@@ -132,6 +139,9 @@ export default class TUICallService {
132
139
  trtcCloudInstance?.callExperimentalAPI(JSON.stringify(
133
140
  { "api": "enableAutoPlayDialog","params": { "enable": 0 } }
134
141
  ));
142
+ // Register the auto play failed listener at initialization time, otherwise the event may
143
+ // be fired before the AutoPlayDialog component is mounted and the listener would miss it.
144
+ trtcCloudInstance?.on?.('onAutoPlayFailed', this._handleAutoPlayFailed);
135
145
  this._tuiCallEngine?.reportLog?.({
136
146
  name: 'TUICallkit.init',
137
147
  data: {
@@ -153,6 +163,8 @@ export default class TUICallService {
153
163
  }
154
164
  if (this._tuiCallEngine) {
155
165
  this._removeListenTuiCallEngineEvent();
166
+ const trtcCloudInstance = this._tuiCallEngine?.getTRTCCloudInstance?.();
167
+ trtcCloudInstance?.off?.('onAutoPlayFailed', this._handleAutoPlayFailed);
156
168
  await this._tuiCallEngine.destroyInstance();
157
169
  this._tuiCallEngine = null;
158
170
  }
@@ -27,6 +27,7 @@ export default class CallStore {
27
27
  showPermissionTip: false,
28
28
  netWorkQualityList: [], // 显示网络状态差的提示
29
29
  isMuteSpeaker: false,
30
+ isShowAutoPlayDialog: false, // 是否显示自动播放失败弹窗, 默认: false
30
31
  callID: '', // callEngine 3.1 support
31
32
  groupID: '',
32
33
  roomID: 0,
@@ -26,6 +26,7 @@ export const CALL_DATA_KEY: any = {
26
26
  PLAYER: 'player',
27
27
  IS_EAR_PHONE: 'isEarPhone',
28
28
  IS_MUTE_SPEAKER: 'isMuteSpeaker',
29
+ IS_SHOW_AUTO_PLAY_DIALOG: 'isShowAutoPlayDialog',
29
30
  SHOW_PERMISSION_TIP: 'SHOW_PERMISSION_TIP',
30
31
  NETWORK_STATUS: 'NetWorkStatus',
31
32
  CALL_ID: 'callID',
@@ -34,6 +34,7 @@ export interface ICallStore {
34
34
  roomIdType: number;
35
35
  cameraPosition: CameraPosition; // 前置或后置,值为front, back
36
36
  isMuteSpeaker: boolean;
37
+ isShowAutoPlayDialog: boolean; // 是否显示自动播放失败弹窗, 默认: false
37
38
  groupCallMembers: IUserInfo[]; // chat 群会话中在通话的成员
38
39
  // TUICallKit 组件上的属性
39
40
  displayMode: VideoDisplayMode; // 设置预览远端的画面显示模式, 默认: VideoDisplayMode.COVER
package/src/index.ts CHANGED
@@ -37,7 +37,7 @@ const TUICallType = {
37
37
  AUDIO_CALL: 1,
38
38
  VIDEO_CALL: 2,
39
39
  };
40
- const Version = '4.5.1'; // basic-demo 原来上报使用
40
+ const Version = '4.5.3'; // basic-demo 原来上报使用
41
41
 
42
42
  // 输出产物
43
43
  export {