tuikit-atomicx-vue3 3.4.2 → 4.3.1
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/.eslintrc.cjs +1 -0
- package/dist/baseComp/Modal/Modal.js +431 -23
- package/dist/chat/index.d.ts +18 -18
- package/dist/components/AudioSetting/AudioMediaControl.js +39 -41
- package/dist/components/AudioSetting/AudioSettingTab.js +10 -10
- package/dist/components/AudioSetting/MicrophoneSelect.js +8 -8
- package/dist/components/AudioSetting/SpeakerSelect.js +9 -9
- package/dist/components/AudioSettingPanel/i18n/en-US/index.d.ts +1 -0
- package/dist/components/AudioSettingPanel/i18n/en-US/index.js +2 -1
- package/dist/components/AudioSettingPanel/i18n/zh-CN/index.d.ts +1 -0
- package/dist/components/AudioSettingPanel/i18n/zh-CN/index.js +2 -1
- package/dist/components/AudioSettingPanel/index.js +81 -73
- package/dist/components/BarrageInput/BarrageInputH5.js +9 -9
- package/dist/components/BarrageInput/EmojiPicker/EmojiPicker.js +3 -3
- package/dist/components/BarrageInput/MessageInputState.d.ts +28 -0
- package/dist/components/BarrageInput/MessageInputState.js +82 -0
- package/dist/components/BarrageInput/TextEditor/CharacterCountExtension.js +1 -1
- package/dist/components/BarrageInput/TextEditor/EditorCore.js +2 -2
- package/dist/components/BarrageInput/TextEditor/index.js +7 -7
- package/dist/components/BarrageInput/type.d.ts +17 -0
- package/dist/components/BarrageInput/type.js +4 -0
- package/dist/components/BarrageInput/utils.d.ts +30 -0
- package/dist/components/BarrageInput/utils.js +41 -0
- package/dist/components/BarrageList/BarrageList.js +80 -110
- package/dist/components/BarrageList/BarrageList.vue.d.ts +0 -29
- package/dist/components/BarrageList/BarrageListH5.js +95 -122
- package/dist/components/BarrageList/BarrageListH5.vue.d.ts +0 -29
- package/dist/components/BarrageList/BarrageListState.d.ts +58 -0
- package/dist/components/BarrageList/BarrageListState.js +106 -0
- package/dist/components/BarrageList/Message/MessageLayout/MessageBubble/MessageBubble.js +16 -24
- package/dist/components/BarrageList/Message/MessageLayout/MessageBubble/MessageBubble.vue.d.ts +5 -5
- package/dist/components/BarrageList/Message/MessageLayout/MessageLayout.js +48 -73
- package/dist/components/BarrageList/Message/MessageLayout/MessageLayout.vue.d.ts +5 -7
- package/dist/components/BarrageList/Message/TextMessage/TextMessage.js +70 -76
- package/dist/components/BarrageList/Message/TextMessage/TextMessage.vue.d.ts +6 -6
- package/dist/components/BarrageList/Message/TextMessage/emoji.d.ts +5 -0
- package/dist/components/BarrageList/Message/TextMessage/emoji.js +134 -0
- package/dist/components/BarrageList/index.d.ts +0 -36
- package/dist/components/CameraButton/index.js +18 -19
- package/dist/components/CoGuestPanel/CoGuestPanel.js +60 -60
- package/dist/components/CoHostPanel/BattlePanel.js +11 -11
- package/dist/components/CoHostPanel/CoHostPanel.js +10 -10
- package/dist/components/CoHostPanel/ConfigSettingPanel.js +49 -55
- package/dist/components/CoHostPanel/ConnectionPanel.js +132 -123
- package/dist/components/CoHostPanel/RecommendHostList.js +39 -36
- package/dist/components/CoHostPanel/constants.d.ts +3 -0
- package/dist/components/CoHostPanel/constants.js +6 -0
- package/dist/components/CoHostPanel/i18n/en-US/index.d.ts +1 -0
- package/dist/components/CoHostPanel/i18n/en-US/index.js +2 -1
- package/dist/components/CoHostPanel/i18n/zh-CN/index.d.ts +1 -0
- package/dist/components/CoHostPanel/i18n/zh-CN/index.js +3 -2
- package/dist/components/LiveAudienceList/LiveAudienceList.js +44 -45
- package/dist/components/LiveAudienceList/LiveAudienceListH5.js +7 -7
- package/dist/components/LiveAudienceList/UserActionMenu.js +57 -64
- package/dist/components/LiveList/LiveList.js +23 -23
- package/dist/components/LiveList/LiveListH5.js +38 -38
- package/dist/components/LiveScenePanel/CameraSettingDialog.js +10 -10
- package/dist/components/LiveScenePanel/MaterialItem.js +15 -15
- package/dist/components/LiveScenePanel/index.js +4 -4
- package/dist/components/LiveView/CoreViewDecorate/BattleDecorate.js +58 -58
- package/dist/components/LiveView/CoreViewDecorate/BattleUserDecorate.js +6 -6
- package/dist/components/LiveView/CoreViewDecorate/CoHostDecorate.js +5 -5
- package/dist/components/LiveView/DefaultStreamViewUI.js +44 -41
- package/dist/components/LiveView/PlayerControl/AudioControl.js +20 -20
- package/dist/components/LiveView/PlayerControl/MultiResolution.js +49 -48
- package/dist/components/LiveView/PlayerControl/MultiResolution.vue.d.ts +7 -1
- package/dist/components/LiveView/PlayerControl/PlayerControl.js +90 -86
- package/dist/components/LiveView/PlayerControl/PlayerControlState.js +127 -131
- package/dist/components/LiveView/PlayerControl/utils/domHelpers.d.ts +6 -0
- package/dist/components/LiveView/PlayerControl/utils/domHelpers.js +54 -22
- package/dist/components/LiveView/i18n/en-US/index.d.ts +2 -2
- package/dist/components/LiveView/i18n/en-US/index.js +2 -2
- package/dist/components/LiveView/i18n/zh-CN/index.d.ts +2 -2
- package/dist/components/LiveView/i18n/zh-CN/index.js +2 -2
- package/dist/components/LiveView/index.js +17 -17
- package/dist/components/MessageInput/TextEditor/EditorCore.js +2 -2
- package/dist/components/MessageList/MessageList.vue.d.ts +2 -2
- package/dist/components/MessageList/index.d.ts +18 -18
- package/dist/components/MicButton/index.js +11 -11
- package/dist/components/StreamMixer/LocalMixer/MixerControl.js +12 -12
- package/dist/components/StreamMixer/LocalMixer/index.js +66 -63
- package/dist/components/StreamView/Layout/CustomLayout.js +8 -8
- package/dist/components/StreamView/Layout/FloatLayout.js +124 -127
- package/dist/components/StreamView/Layout/GridLayout.js +5 -5
- package/dist/components/StreamView/index.js +25 -33
- package/dist/components/StreamView/manager/mediaManager.js +54 -60
- package/dist/components/VideoSetting/CameraSelect.js +8 -8
- package/dist/components/VideoSetting/VideoMediaControl.js +10 -10
- package/dist/components/VideoSetting/VideoPreview.js +9 -9
- package/dist/components/VideoSetting/VideoProfile.js +6 -6
- package/dist/components/VideoSetting/VideoSettingTab.js +40 -39
- package/dist/components/VideoSettingPanel/CameraSelect.js +8 -8
- package/dist/components/VideoSettingPanel/VideoPreview.js +1 -1
- package/dist/components/VideoSettingPanel/VideoProfile.js +18 -18
- package/dist/hooks/useRoomEngine.js +6 -6
- package/dist/{index-D2OVtqc8.js → index-BfIEeWMg.js} +191 -181
- package/dist/{index-Bm-QfV5o.js → index-DTi1fL-x.js} +460 -457
- package/dist/index.js +162 -144
- package/dist/report/MetricsKey.d.ts +16 -0
- package/dist/report/MetricsKey.js +4 -0
- package/dist/report/dataReport.d.ts +12 -0
- package/dist/report/dataReport.js +45 -0
- package/dist/report/index.d.ts +4 -0
- package/dist/report/index.js +6 -0
- package/dist/rtc/index.d.ts +5 -43
- package/dist/rtc/index.js +48 -48
- package/dist/states/BarrageState/BarrageState.d.ts +74 -0
- package/dist/states/BarrageState/BarrageState.js +80 -0
- package/dist/states/BarrageState/index.d.ts +1 -0
- package/dist/states/BarrageState/index.js +5 -0
- package/dist/states/{BattleState.d.ts → BattleState/BattleState.d.ts} +10 -11
- package/dist/states/BattleState/BattleState.js +203 -0
- package/dist/states/BattleState/index.d.ts +1 -0
- package/dist/states/BattleState/index.js +4 -0
- package/dist/states/CoGuestState.d.ts +24 -94
- package/dist/states/CoGuestState.js +297 -189
- package/dist/states/CoHostState/CoHostState.d.ts +2 -2
- package/dist/states/CoHostState/CoHostState.js +135 -131
- package/dist/states/{DeviceState.d.ts → DeviceState/DeviceState.d.ts} +25 -13
- package/dist/states/DeviceState/DeviceState.js +314 -0
- package/dist/states/DeviceState/index.d.ts +1 -0
- package/dist/states/DeviceState/index.js +4 -0
- package/dist/states/LiveAudienceState.d.ts +3 -1
- package/dist/states/LiveAudienceState.js +106 -63
- package/dist/states/{LiveState/index.d.ts → LiveListState/LiveListState.d.ts} +13 -8
- package/dist/states/LiveListState/LiveListState.js +285 -0
- package/dist/states/LiveListState/index.d.ts +1 -0
- package/dist/states/LiveListState/index.js +4 -0
- package/dist/states/LiveMonitorState/api/http.js +147 -129
- package/dist/states/LiveMonitorState/index.js +67 -62
- package/dist/states/LiveSeatState/index.d.ts +46 -11
- package/dist/states/LiveSeatState/index.js +34 -15
- package/dist/states/LiveSeatState/seatEventManager.d.ts +2 -0
- package/dist/states/LiveSeatState/seatEventManager.js +63 -42
- package/dist/states/LiveSeatState/seatManager.d.ts +34 -5
- package/dist/states/LiveSeatState/seatManager.js +131 -29
- package/dist/states/LiveSeatState/store.d.ts +5 -5
- package/dist/states/LiveSeatState/store.js +12 -10
- package/dist/states/LiveSeatState/usePlayStream/RTCStreamManager.js +1 -1
- package/dist/states/LiveSeatState/usePlayStream/RTCStreamPlayer.js +1 -1
- package/dist/states/LiveSeatState/usePlayStream/index.js +30 -28
- package/dist/states/LoginState.js +39 -34
- package/dist/states/SeatStore.js +82 -83
- package/dist/states/{VideoMixerState.d.ts → VideoMixerState/VideoMixerState.d.ts} +1 -1
- package/dist/states/VideoMixerState/VideoMixerState.js +269 -0
- package/dist/states/VideoMixerState/index.d.ts +1 -0
- package/dist/states/VideoMixerState/index.js +4 -0
- package/dist/styles/index.css +1 -1
- package/dist/types/audience.d.ts +21 -0
- package/dist/types/audience.js +4 -1
- package/dist/types/battle.d.ts +75 -3
- package/dist/types/battle.js +5 -1
- package/dist/types/coGuest.d.ts +72 -5
- package/dist/types/coGuest.js +4 -2
- package/dist/types/device.d.ts +38 -17
- package/dist/types/device.js +10 -8
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.js +96 -80
- package/dist/types/live.d.ts +36 -21
- package/dist/types/live.js +6 -4
- package/dist/types/seat.d.ts +23 -4
- package/dist/types/seat.js +7 -1
- package/dist/utils/eventCenter.d.ts +88 -0
- package/dist/utils/eventCenter.js +161 -0
- package/package.json +3 -3
- package/src/components/AudioSetting/AudioMediaControl.vue +1 -3
- package/src/components/AudioSetting/AudioSettingTab.vue +1 -2
- package/src/components/AudioSetting/MicrophoneSelect.vue +1 -2
- package/src/components/AudioSetting/SpeakerSelect.vue +1 -2
- package/src/components/AudioSettingPanel/i18n/en-US/index.ts +1 -0
- package/src/components/AudioSettingPanel/i18n/zh-CN/index.ts +1 -0
- package/src/components/AudioSettingPanel/index.vue +4 -2
- package/src/components/BarrageInput/BarrageInputH5.vue +1 -1
- package/src/components/BarrageInput/EmojiPicker/EmojiPicker.vue +1 -1
- package/src/components/BarrageInput/MessageInputState.ts +160 -0
- package/src/components/BarrageInput/TextEditor/TextEditor.vue +1 -1
- package/src/components/BarrageInput/type.ts +26 -0
- package/src/components/BarrageInput/utils.ts +45 -0
- package/src/components/BarrageList/BarrageList.vue +61 -117
- package/src/components/BarrageList/BarrageListH5.vue +75 -159
- package/src/components/BarrageList/BarrageListState.ts +223 -0
- package/src/components/BarrageList/Message/MessageLayout/MessageBubble/MessageBubble.vue +8 -55
- package/src/components/BarrageList/Message/MessageLayout/MessageLayout.vue +19 -44
- package/src/components/BarrageList/Message/TextMessage/TextMessage.vue +69 -96
- package/src/components/BarrageList/Message/TextMessage/emoji.ts +132 -0
- package/src/components/CameraButton/index.vue +0 -1
- package/src/components/CoGuestPanel/CoGuestPanel.vue +16 -91
- package/src/components/CoHostPanel/BattlePanel.vue +1 -4
- package/src/components/CoHostPanel/ConfigSettingPanel.vue +2 -8
- package/src/components/CoHostPanel/ConnectionPanel.vue +37 -33
- package/src/components/CoHostPanel/RecommendHostList.vue +12 -13
- package/src/components/CoHostPanel/constants.ts +3 -0
- package/src/components/CoHostPanel/i18n/en-US/index.ts +1 -0
- package/src/components/CoHostPanel/i18n/zh-CN/index.ts +2 -1
- package/src/components/LiveAudienceList/LiveAudienceList.vue +4 -5
- package/src/components/LiveAudienceList/LiveAudienceListH5.vue +2 -2
- package/src/components/LiveAudienceList/UserActionMenu.vue +7 -48
- package/src/components/LiveList/LiveList.vue +5 -5
- package/src/components/LiveList/LiveListH5.vue +6 -6
- package/src/components/LiveScenePanel/index.vue +2 -2
- package/src/components/LiveView/CoreViewDecorate/BattleDecorate.vue +10 -15
- package/src/components/LiveView/CoreViewDecorate/BattleUserDecorate.vue +2 -2
- package/src/components/LiveView/DefaultStreamViewUI.vue +5 -3
- package/src/components/LiveView/PlayerControl/AudioControl.vue +1 -1
- package/src/components/LiveView/PlayerControl/MultiResolution.vue +9 -3
- package/src/components/LiveView/PlayerControl/PlayerControl.vue +10 -2
- package/src/components/LiveView/PlayerControl/PlayerControlState.ts +233 -259
- package/src/components/LiveView/PlayerControl/utils/domHelpers.ts +64 -0
- package/src/components/LiveView/i18n/en-US/index.ts +2 -2
- package/src/components/LiveView/i18n/zh-CN/index.ts +2 -2
- package/src/components/LiveView/index.vue +2 -2
- package/src/components/MicButton/index.vue +3 -3
- package/src/components/StreamMixer/LocalMixer/index.vue +6 -8
- package/src/components/StreamView/Layout/CustomLayout.vue +2 -2
- package/src/components/StreamView/Layout/FloatLayout.vue +88 -83
- package/src/components/StreamView/index.vue +28 -14
- package/src/components/StreamView/manager/mediaManager.ts +38 -42
- package/src/components/VideoSetting/CameraSelect.vue +1 -2
- package/src/components/VideoSetting/VideoMediaControl.vue +1 -1
- package/src/components/VideoSetting/VideoPreview.vue +1 -2
- package/src/components/VideoSetting/VideoProfile.vue +1 -1
- package/src/components/VideoSetting/VideoSettingTab.vue +9 -5
- package/src/components/VideoSettingPanel/CameraSelect.vue +1 -2
- package/src/components/VideoSettingPanel/VideoProfile.vue +7 -7
- package/src/hooks/useRoomEngine.ts +1 -1
- package/src/report/MetricsKey.ts +16 -0
- package/src/report/dataReport.ts +55 -0
- package/src/report/index.ts +7 -0
- package/src/rtc/index.ts +7 -9
- package/src/types/audience.ts +27 -1
- package/src/types/battle.ts +87 -4
- package/src/types/coGuest.ts +87 -5
- package/src/types/device.ts +41 -16
- package/src/types/index.ts +2 -2
- package/src/types/live.ts +41 -22
- package/src/types/seat.ts +28 -4
- package/src/utils/eventCenter.ts +249 -0
- package/dist/DialogPortal-CvJcEAsn.js +0 -417
- package/dist/components/BarrageList/Message/FaceMessage/FaceMessage.js +0 -23
- package/dist/components/BarrageList/Message/FaceMessage/FaceMessage.vue.d.ts +0 -30
- package/dist/components/BarrageList/Message/FaceMessage/index.d.ts +0 -3
- package/dist/components/BarrageList/Message/FaceMessage/index.js +0 -4
- package/dist/components/BarrageList/Message/GroupTipMessage/GroupTipMessage.js +0 -4
- package/dist/components/BarrageList/Message/GroupTipMessage/GroupTipMessage.vue.d.ts +0 -16
- package/dist/components/BarrageList/Message/GroupTipMessage/index.d.ts +0 -3
- package/dist/components/BarrageList/Message/GroupTipMessage/index.js +0 -25
- package/dist/components/BarrageList/Message/ImageMessage/ImageMessage.js +0 -71
- package/dist/components/BarrageList/Message/ImageMessage/ImageMessage.vue.d.ts +0 -34
- package/dist/components/BarrageList/Message/ImageMessage/index.d.ts +0 -3
- package/dist/components/BarrageList/Message/ImageMessage/index.js +0 -4
- package/dist/components/BarrageList/Message/MergerMessage/MergerMessage.js +0 -9
- package/dist/components/BarrageList/Message/MergerMessage/MergerMessage.vue.d.ts +0 -2
- package/dist/components/BarrageList/Message/MergerMessage/index.d.ts +0 -3
- package/dist/components/BarrageList/Message/MergerMessage/index.js +0 -4
- package/dist/components/BarrageList/Message/MessageLayout/MessageMeta/MessageMeta.js +0 -40
- package/dist/components/BarrageList/Message/MessageLayout/MessageMeta/MessageMeta.vue.d.ts +0 -54
- package/dist/components/BarrageList/Message/MessageLayout/MessageMeta/MessageStatusIcon.js +0 -26
- package/dist/components/BarrageList/Message/MessageLayout/MessageMeta/MessageStatusIcon.vue.d.ts +0 -15
- package/dist/components/BarrageList/Message/MessageLayout/MessageMeta/index.d.ts +0 -3
- package/dist/components/BarrageList/Message/MessageLayout/MessageMeta/index.js +0 -4
- package/dist/components/BarrageList/Message/RecalledMessage/RecalledMessage.js +0 -41
- package/dist/components/BarrageList/Message/RecalledMessage/RecalledMessage.vue.d.ts +0 -35
- package/dist/components/BarrageList/Message/RecalledMessage/index.d.ts +0 -3
- package/dist/components/BarrageList/Message/RecalledMessage/index.js +0 -4
- package/dist/components/BarrageList/MessageForward/ForwardListItem.js +0 -45
- package/dist/components/BarrageList/MessageForward/ForwardListItem.vue.d.ts +0 -17
- package/dist/components/BarrageList/MessageForward/MessageForward.js +0 -203
- package/dist/components/BarrageList/MessageForward/MessageForward.vue.d.ts +0 -2
- package/dist/components/BarrageList/MessageForward/index.d.ts +0 -3
- package/dist/components/BarrageList/MessageForward/index.js +0 -4
- package/dist/components/StreamView/Layout/MixLayout.js +0 -89
- package/dist/components/StreamView/Layout/MixLayout.vue.d.ts +0 -31
- package/dist/states/BarrageListState/BarrageListState.d.ts +0 -26
- package/dist/states/BarrageListState/BarrageListState.js +0 -122
- package/dist/states/BarrageListState/index.d.ts +0 -1
- package/dist/states/BarrageListState/index.js +0 -4
- package/dist/states/BattleState.js +0 -117
- package/dist/states/DeviceState.js +0 -296
- package/dist/states/LiveState/index.js +0 -254
- package/dist/states/VideoMixerState.js +0 -260
- package/src/components/BarrageList/Message/FaceMessage/FaceMessage.vue +0 -43
- package/src/components/BarrageList/Message/FaceMessage/index.ts +0 -3
- package/src/components/BarrageList/Message/GroupTipMessage/GroupTipMessage.vue +0 -55
- package/src/components/BarrageList/Message/GroupTipMessage/index.ts +0 -3
- package/src/components/BarrageList/Message/ImageMessage/ImageMessage.vue +0 -181
- package/src/components/BarrageList/Message/ImageMessage/index.ts +0 -3
- package/src/components/BarrageList/Message/MergerMessage/MergerMessage.vue +0 -6
- package/src/components/BarrageList/Message/MergerMessage/index.ts +0 -3
- package/src/components/BarrageList/Message/MessageLayout/MessageMeta/MessageMeta.vue +0 -70
- package/src/components/BarrageList/Message/MessageLayout/MessageMeta/MessageStatusIcon.vue +0 -40
- package/src/components/BarrageList/Message/MessageLayout/MessageMeta/index.ts +0 -3
- package/src/components/BarrageList/Message/RecalledMessage/RecalledMessage.vue +0 -82
- package/src/components/BarrageList/Message/RecalledMessage/index.ts +0 -3
- package/src/components/BarrageList/MessageForward/ForwardListItem.vue +0 -67
- package/src/components/BarrageList/MessageForward/MessageForward.vue +0 -388
- package/src/components/BarrageList/MessageForward/index.ts +0 -3
- package/src/components/StreamView/Layout/MixLayout.vue +0 -144
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { watch } from 'vue';
|
|
1
2
|
import TUIRoomEngine, {
|
|
2
3
|
TUIRoomEvents,
|
|
3
|
-
TUIChangeReason,
|
|
4
4
|
TUIVideoStreamType,
|
|
5
5
|
TRTCVideoStreamType,
|
|
6
6
|
TRTCVideoFillMode,
|
|
@@ -9,23 +9,23 @@ import TUIRoomEngine, {
|
|
|
9
9
|
TRTCVideoResolution,
|
|
10
10
|
TRTCVideoResolutionMode,
|
|
11
11
|
} from '@tencentcloud/tuiroom-engine-js';
|
|
12
|
-
import
|
|
12
|
+
import useRoomEngine from '../../../hooks/useRoomEngine';
|
|
13
|
+
import { useLiveListState } from '../../../states/LiveListState';
|
|
13
14
|
import useUserState from '../../../states/UserState/index';
|
|
14
15
|
import { innerUserStore } from '../../../states/UserState/store';
|
|
15
|
-
import { DeviceStatus, LiveStatus, StreamPlayStatus } from '../../../types';
|
|
16
|
-
import useRoomEngine from '../../../hooks/useRoomEngine';
|
|
17
|
-
import useLiveState from '../../../states/LiveState';
|
|
18
16
|
import { useVideoMixerState } from '../../../states/VideoMixerState';
|
|
19
|
-
import {
|
|
17
|
+
import { DeviceStatus, StreamPlayStatus } from '../../../types';
|
|
18
|
+
import { isMobile } from '../../../utils/environment';
|
|
19
|
+
import type {
|
|
20
|
+
TUIChangeReason } from '@tencentcloud/tuiroom-engine-js';
|
|
20
21
|
|
|
21
22
|
const { localUser } = useUserState();
|
|
22
23
|
const { isVideoMixerEnabled } = useVideoMixerState();
|
|
23
|
-
const { localLiveStatus } = useLiveState();
|
|
24
24
|
const roomEngine = useRoomEngine();
|
|
25
25
|
const playDomMap = new Map<string, Map<HTMLElement, TUIVideoStreamType>>();
|
|
26
26
|
|
|
27
27
|
// todo: 这里退出房间之后需要清空
|
|
28
|
-
function setPlayDomMap(params1: {userId: string
|
|
28
|
+
function setPlayDomMap(params1: { userId: string; streamType: TUIVideoStreamType }, params2: { view: HTMLElement; streamType: TUIVideoStreamType }) {
|
|
29
29
|
const playDomInfo = playDomMap.get(`${params1.userId}-${params1.streamType}`);
|
|
30
30
|
if (!playDomInfo) {
|
|
31
31
|
playDomMap.set(`${params1.userId}-${params1.streamType}`, new Map());
|
|
@@ -33,27 +33,23 @@ function setPlayDomMap(params1: {userId: string, streamType: TUIVideoStreamType}
|
|
|
33
33
|
playDomMap.get(`${params1.userId}-${params1.streamType}`)?.set(params2.view, params2.streamType);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
function getPlayDomMap(params: {userId: string
|
|
36
|
+
function getPlayDomMap(params: { userId: string; streamType: TUIVideoStreamType }) {
|
|
37
37
|
return playDomMap.get(`${params.userId}-${params.streamType}`);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
if (newVal === LiveStatus.IDLE) {
|
|
42
|
-
playDomMap.clear();
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
function updateStreamPlayStatus(params: {userId: string, streamType: TUIVideoStreamType, playStatus: StreamPlayStatus}) {
|
|
40
|
+
function updateStreamPlayStatus(params: { userId: string; streamType: TUIVideoStreamType; playStatus: StreamPlayStatus }) {
|
|
47
41
|
if (params.userId === 'local_fake_user') {
|
|
48
42
|
return;
|
|
49
43
|
}
|
|
50
44
|
const { userId, streamType, playStatus } = params;
|
|
51
|
-
const assignObj = streamType === TUIVideoStreamType.kScreenStream
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
45
|
+
const assignObj = streamType === TUIVideoStreamType.kScreenStream
|
|
46
|
+
? {
|
|
47
|
+
screenPlayStatus: playStatus,
|
|
48
|
+
}
|
|
49
|
+
: {
|
|
50
|
+
cameraPlayStatus: playStatus,
|
|
51
|
+
};
|
|
52
|
+
innerUserStore.updateUserInfo({ userId, ...assignObj });
|
|
57
53
|
}
|
|
58
54
|
|
|
59
55
|
interface ObserverData {
|
|
@@ -97,7 +93,7 @@ export class MediaManager {
|
|
|
97
93
|
userId,
|
|
98
94
|
streamType,
|
|
99
95
|
view,
|
|
100
|
-
observerViewInVisible
|
|
96
|
+
observerViewInVisible,
|
|
101
97
|
);
|
|
102
98
|
// if (userId.indexOf('livekit_') !== 0) {
|
|
103
99
|
// const hasVideo =
|
|
@@ -120,7 +116,7 @@ export class MediaManager {
|
|
|
120
116
|
Object.assign(this.observerDataMap.get(view) || {}, {
|
|
121
117
|
userId,
|
|
122
118
|
streamType,
|
|
123
|
-
})
|
|
119
|
+
}),
|
|
124
120
|
);
|
|
125
121
|
this.intersectionObserver?.observe(view);
|
|
126
122
|
|
|
@@ -164,8 +160,8 @@ export class MediaManager {
|
|
|
164
160
|
|
|
165
161
|
private initIntersectionObserver() {
|
|
166
162
|
if (
|
|
167
|
-
!this.intersectionObserver
|
|
168
|
-
document.getElementById('roomContainer') !== this.observerRoot
|
|
163
|
+
!this.intersectionObserver
|
|
164
|
+
|| document.getElementById('roomContainer') !== this.observerRoot
|
|
169
165
|
) {
|
|
170
166
|
const observerRoot = document.getElementById('roomContainer');
|
|
171
167
|
this.intersectionObserver = new IntersectionObserver(
|
|
@@ -173,7 +169,7 @@ export class MediaManager {
|
|
|
173
169
|
{
|
|
174
170
|
root: observerRoot,
|
|
175
171
|
rootMargin: '0px',
|
|
176
|
-
}
|
|
172
|
+
},
|
|
177
173
|
);
|
|
178
174
|
this.observerDataMap = new Map();
|
|
179
175
|
this.observerRoot = observerRoot;
|
|
@@ -200,11 +196,11 @@ export class MediaManager {
|
|
|
200
196
|
} else {
|
|
201
197
|
observerData.isIntersection = false;
|
|
202
198
|
const isContinuePlay = Array.from(
|
|
203
|
-
playDomInfo?.keys() || []
|
|
199
|
+
playDomInfo?.keys() || [],
|
|
204
200
|
).find(
|
|
205
201
|
item =>
|
|
206
|
-
!this.observerDataMap.get(item)
|
|
207
|
-
this.observerDataMap.get(item)?.isIntersection
|
|
202
|
+
!this.observerDataMap.get(item)
|
|
203
|
+
|| this.observerDataMap.get(item)?.isIntersection,
|
|
208
204
|
);
|
|
209
205
|
if (!isContinuePlay) {
|
|
210
206
|
this.doStopPlayVideo({ userId, streamType });
|
|
@@ -238,14 +234,14 @@ export class MediaManager {
|
|
|
238
234
|
return;
|
|
239
235
|
}
|
|
240
236
|
const playStreamType = this.getPlayStreamType(userId, streamType);
|
|
241
|
-
const viewIdList = Array.from(playDomInfo.keys()).map(item => {
|
|
237
|
+
const viewIdList = Array.from(playDomInfo.keys()).map((item) => {
|
|
242
238
|
if (item instanceof HTMLElement) {
|
|
243
239
|
return item?.id;
|
|
244
240
|
}
|
|
245
241
|
return item;
|
|
246
242
|
});
|
|
247
243
|
|
|
248
|
-
updateStreamPlayStatus({ userId, streamType, playStatus: StreamPlayStatus.Loading })
|
|
244
|
+
updateStreamPlayStatus({ userId, streamType, playStatus: StreamPlayStatus.Loading });
|
|
249
245
|
if (userId === localUser.value?.userId) {
|
|
250
246
|
if (streamType === TUIVideoStreamType.kCameraStream) {
|
|
251
247
|
if (isVideoMixerEnabled.value) {
|
|
@@ -284,7 +280,7 @@ export class MediaManager {
|
|
|
284
280
|
streamType: playStreamType,
|
|
285
281
|
});
|
|
286
282
|
}
|
|
287
|
-
updateStreamPlayStatus({ userId, streamType, playStatus: StreamPlayStatus.Playing })
|
|
283
|
+
updateStreamPlayStatus({ userId, streamType, playStatus: StreamPlayStatus.Playing });
|
|
288
284
|
}
|
|
289
285
|
|
|
290
286
|
private async setVideoRenderParams(options: {
|
|
@@ -294,8 +290,8 @@ export class MediaManager {
|
|
|
294
290
|
const { userId, streamType } = options;
|
|
295
291
|
if (userId !== localUser.value?.userId) {
|
|
296
292
|
const trtcCloud = roomEngine.instance?.getTRTCCloud();
|
|
297
|
-
const trtcStreamType
|
|
298
|
-
streamType === TUIVideoStreamType.kScreenStream
|
|
293
|
+
const trtcStreamType
|
|
294
|
+
= streamType === TUIVideoStreamType.kScreenStream
|
|
299
295
|
? TRTCVideoStreamType.TRTCVideoStreamTypeSub
|
|
300
296
|
: TRTCVideoStreamType.TRTCVideoStreamTypeBig;
|
|
301
297
|
// todo: 确认这里的 cdn 流渲染模式
|
|
@@ -334,10 +330,10 @@ export class MediaManager {
|
|
|
334
330
|
if (userId === localUser.value?.userId && isVideoMixerEnabled.value) {
|
|
335
331
|
return;
|
|
336
332
|
}
|
|
337
|
-
updateStreamPlayStatus({ userId, streamType, playStatus: StreamPlayStatus.Stopped })
|
|
333
|
+
updateStreamPlayStatus({ userId, streamType, playStatus: StreamPlayStatus.Stopped });
|
|
338
334
|
if (
|
|
339
|
-
userId === localUser.value?.userId
|
|
340
|
-
streamType === TUIVideoStreamType.kCameraStream
|
|
335
|
+
userId === localUser.value?.userId
|
|
336
|
+
&& streamType === TUIVideoStreamType.kCameraStream
|
|
341
337
|
) {
|
|
342
338
|
roomEngine.instance?.setLocalVideoView({ view: null });
|
|
343
339
|
} else {
|
|
@@ -412,11 +408,11 @@ export class MediaManager {
|
|
|
412
408
|
TUIRoomEngine.once('ready', () => {
|
|
413
409
|
roomEngine.instance?.on(
|
|
414
410
|
TUIRoomEvents.onUserVideoStateChanged,
|
|
415
|
-
this.onUserVideoStateChanged.bind(this)
|
|
411
|
+
this.onUserVideoStateChanged.bind(this),
|
|
416
412
|
);
|
|
417
413
|
roomEngine.instance?.on(
|
|
418
414
|
TUIRoomEvents.onUserAudioStateChanged,
|
|
419
|
-
this.onUserAudioStateChanged.bind(this)
|
|
415
|
+
this.onUserAudioStateChanged.bind(this),
|
|
420
416
|
);
|
|
421
417
|
});
|
|
422
418
|
}
|
|
@@ -424,11 +420,11 @@ export class MediaManager {
|
|
|
424
420
|
private unbindRoomEngineEvents() {
|
|
425
421
|
roomEngine.instance?.off(
|
|
426
422
|
TUIRoomEvents.onUserVideoStateChanged,
|
|
427
|
-
this.onUserVideoStateChanged
|
|
423
|
+
this.onUserVideoStateChanged,
|
|
428
424
|
);
|
|
429
425
|
roomEngine.instance?.off(
|
|
430
426
|
TUIRoomEvents.onUserAudioStateChanged,
|
|
431
|
-
this.onUserAudioStateChanged
|
|
427
|
+
this.onUserAudioStateChanged,
|
|
432
428
|
);
|
|
433
429
|
}
|
|
434
430
|
}
|
|
@@ -22,7 +22,7 @@ import { ref, watch, defineProps, withDefaults, onBeforeMount } from 'vue';
|
|
|
22
22
|
import TuiSelect from '../../baseComp/Select';
|
|
23
23
|
import TuiOption from '../../baseComp/Option';
|
|
24
24
|
import { TUIDeviceInfo } from '@tencentcloud/tuiroom-engine-js';
|
|
25
|
-
import useDeviceState from '../../states/DeviceState';
|
|
25
|
+
import { useDeviceState } from '../../states/DeviceState';
|
|
26
26
|
const { cameraList, currentCamera, setCurrentCamera, getCameraList } = useDeviceState();
|
|
27
27
|
|
|
28
28
|
interface Props {
|
|
@@ -73,4 +73,3 @@ onBeforeMount(async () => {
|
|
|
73
73
|
font-size: 14px;
|
|
74
74
|
}
|
|
75
75
|
</style>
|
|
76
|
-
../../states/DeviceState
|
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
MediaSettingDisplayMode,
|
|
46
46
|
VideoSettingProps,
|
|
47
47
|
} from '../../types';
|
|
48
|
-
import useDeviceState from '../../states/DeviceState';
|
|
48
|
+
import { useDeviceState } from '../../states/DeviceState';
|
|
49
49
|
import { DeviceStatus, DeviceError } from '../../types';
|
|
50
50
|
import useUserState from '../../states/UserState/index';
|
|
51
51
|
import { useRoomState } from '../../states/RoomState';
|
|
@@ -17,7 +17,7 @@ import { onMounted, onUnmounted } from 'vue';
|
|
|
17
17
|
import { IconLoading } from '@tencentcloud/uikit-base-component-vue3';
|
|
18
18
|
import { useI18n } from '../../locales';
|
|
19
19
|
import TUIRoomEngine from '@tencentcloud/tuiroom-engine-js';
|
|
20
|
-
import useDeviceState from '../../states/DeviceState';
|
|
20
|
+
import { useDeviceState } from '../../states/DeviceState';
|
|
21
21
|
|
|
22
22
|
const { t } = useI18n();
|
|
23
23
|
const { isCameraTesting, isCameraTestLoading, startCameraDeviceTest, stopCameraDeviceTest } = useDeviceState();
|
|
@@ -83,4 +83,3 @@ onUnmounted(async () => {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
</style>
|
|
86
|
-
../../states/DeviceState
|
|
@@ -22,7 +22,7 @@ import TuiOption from '../../baseComp/Option';
|
|
|
22
22
|
import { useI18n } from '../../locales';
|
|
23
23
|
|
|
24
24
|
import { TUIVideoQuality } from '@tencentcloud/tuiroom-engine-js';
|
|
25
|
-
import useDeviceState from '../../states/DeviceState';
|
|
25
|
+
import { useDeviceState } from '../../states/DeviceState';
|
|
26
26
|
|
|
27
27
|
const { t } = useI18n();
|
|
28
28
|
|
|
@@ -20,23 +20,28 @@
|
|
|
20
20
|
</template>
|
|
21
21
|
|
|
22
22
|
<script setup lang="ts">
|
|
23
|
-
import { watch, inject } from 'vue';
|
|
23
|
+
import { watch, inject, ref } from 'vue';
|
|
24
24
|
import CameraSelect from './CameraSelect.vue';
|
|
25
25
|
import VideoProfile from './VideoProfile.vue';
|
|
26
26
|
import VideoPreview from './VideoPreview.vue';
|
|
27
27
|
import TuiSwitch from '../../baseComp/TuiSwitch.vue';
|
|
28
28
|
import { useI18n } from '../../locales';
|
|
29
|
-
import useDeviceState from '../../states/DeviceState';
|
|
29
|
+
import { useDeviceState } from '../../states/DeviceState';
|
|
30
30
|
import { VideoSettingProps } from '../../types';
|
|
31
|
+
import { MirrorType } from '../../types';
|
|
32
|
+
|
|
31
33
|
const { t } = useI18n();
|
|
32
|
-
const {
|
|
34
|
+
const { switchMirror } = useDeviceState();
|
|
35
|
+
|
|
36
|
+
const isLocalMirror = ref(true);
|
|
37
|
+
|
|
33
38
|
const videoSettingProps: VideoSettingProps | undefined =
|
|
34
39
|
inject('videoSettingProps');
|
|
35
40
|
|
|
36
41
|
watch(
|
|
37
42
|
isLocalMirror,
|
|
38
43
|
async (val: boolean) => {
|
|
39
|
-
switchMirror({ mirror: val });
|
|
44
|
+
switchMirror({ mirror: val ? MirrorType.Auto : MirrorType.Disable });
|
|
40
45
|
},
|
|
41
46
|
{ immediate: true }
|
|
42
47
|
);
|
|
@@ -91,4 +96,3 @@ watch(
|
|
|
91
96
|
}
|
|
92
97
|
}
|
|
93
98
|
</style>
|
|
94
|
-
../../states/DeviceState
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
import { ref, watch, defineProps, withDefaults, onBeforeMount } from 'vue';
|
|
22
22
|
import { TUISelect, TUIOption } from '@tencentcloud/uikit-base-component-vue3';
|
|
23
23
|
import { TUIDeviceInfo } from '@tencentcloud/tuiroom-engine-js';
|
|
24
|
-
import useDeviceState from '../../states/DeviceState';
|
|
24
|
+
import { useDeviceState } from '../../states/DeviceState';
|
|
25
25
|
const { cameraList, currentCamera, setCurrentCamera, getCameraList } = useDeviceState();
|
|
26
26
|
|
|
27
27
|
interface Props {
|
|
@@ -72,4 +72,3 @@ onBeforeMount(async () => {
|
|
|
72
72
|
font-size: 14px;
|
|
73
73
|
}
|
|
74
74
|
</style>
|
|
75
|
-
../../states/DeviceState
|
|
@@ -18,30 +18,30 @@
|
|
|
18
18
|
<script setup lang="ts">
|
|
19
19
|
import { watch, computed } from 'vue';
|
|
20
20
|
import type { ComputedRef } from 'vue';
|
|
21
|
-
import { TUIVideoQuality } from '@tencentcloud/tuiroom-engine-js';
|
|
22
21
|
import { TUISelect, TUIOption, useUIKit } from '@tencentcloud/uikit-base-component-vue3';
|
|
23
22
|
import { useDeviceState } from '../../states/DeviceState';
|
|
23
|
+
import { VideoQuality } from '../../types';
|
|
24
24
|
|
|
25
25
|
const { t } = useUIKit();
|
|
26
26
|
|
|
27
27
|
const videoQualityList: ComputedRef<
|
|
28
|
-
{ label: string; value:
|
|
28
|
+
{ label: string; value: VideoQuality }[]
|
|
29
29
|
> = computed(() => [
|
|
30
|
-
{ label: t('Low Definition'), value:
|
|
30
|
+
{ label: t('Low Definition'), value: VideoQuality.Quality360P },
|
|
31
31
|
{
|
|
32
32
|
label: t('Standard Definition'),
|
|
33
|
-
value:
|
|
33
|
+
value: VideoQuality.Quality540P,
|
|
34
34
|
},
|
|
35
|
-
{ label: t('High Definition'), value:
|
|
35
|
+
{ label: t('High Definition'), value: VideoQuality.Quality720P },
|
|
36
36
|
{
|
|
37
37
|
label: t('Super Definition'),
|
|
38
|
-
value:
|
|
38
|
+
value: VideoQuality.Quality1080P,
|
|
39
39
|
},
|
|
40
40
|
]);
|
|
41
41
|
|
|
42
42
|
const { localVideoQuality, updateVideoQuality } = useDeviceState();
|
|
43
43
|
|
|
44
|
-
watch(localVideoQuality, (val:
|
|
44
|
+
watch(localVideoQuality, (val: VideoQuality) => {
|
|
45
45
|
updateVideoQuality({ quality: val });
|
|
46
46
|
});
|
|
47
47
|
</script>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export enum MetricsKey {
|
|
2
|
+
T_METRICS_STATE_API_CREATE_LIVE_COUNT = 180000, // 统计开播的次数
|
|
3
|
+
T_METRICS_STATE_API_CREATE_LIVE_MOBILE_COUNT = 180001, // 统计移动端 Web 开播的次数
|
|
4
|
+
T_METRICS_STATE_API_JOIN_LIVE_COUNT = 180002, // 统计观看的次数
|
|
5
|
+
T_METRICS_STATE_API_JOIN_LIVE_MOBILE_COUNT = 180003, // 统计移动端 Web 观看的次数
|
|
6
|
+
T_METRICS_STATE_API_LOGIN_COUNT = 180010, // 统计登录次数
|
|
7
|
+
T_METRICS_STATE_API_LOGIN_MOBILE_COUNT = 180011, // 统计移动端 Web 登录次数
|
|
8
|
+
T_METRICS_STATE_API_LIVE_MONITOR_CLOSE_ROOM_COUNT = 180020, // 计监播页解散房间的次数
|
|
9
|
+
T_METRICS_STATE_API_LIVE_MONITOR_START_PLAY_COUNT = 180021, // 统计监播页开始拉流的次数
|
|
10
|
+
T_METRICS_STATE_API_VIDEO_MIXER_ADD_MEDIA_CAMERA_COUNT = 180030, // 统计混流时添加摄像头的次数
|
|
11
|
+
T_METRICS_STATE_API_VIDEO_MIXER_ADD_MEDIA_SCREEN_COUNT = 180031, // 统计混流时添加屏幕分享的次数
|
|
12
|
+
T_METRICS_STATE_API_BARRAGE_SEND_TEXT_MSG_COUNT = 180040, // 统计发送弹幕消息的次数
|
|
13
|
+
T_METRICS_STATE_API_AUDIENCE_FETCH_LIST_COUNT = 180050, // 统计获取观众列表的次数
|
|
14
|
+
T_METRICS_STATE_API_CO_GUEST_REQUEST_CONNECTION_COUNT = 180060, // 统计观众连麦请求的次数
|
|
15
|
+
T_METRICS_STATE_API_CO_HOST_REQUEST_CONNECTION_COUNT = 180070, // 统计主播连线请求的次数
|
|
16
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import TUIRoomEngine from '@tencentcloud/tuiroom-engine-js';
|
|
2
|
+
import { MetricsKey } from './MetricsKey';
|
|
3
|
+
|
|
4
|
+
const KEY_METRICS_API = 'KeyMetricsStats';
|
|
5
|
+
|
|
6
|
+
type Task = () => void;
|
|
7
|
+
|
|
8
|
+
export class DataReport {
|
|
9
|
+
private taskQueue: Task[] = [];
|
|
10
|
+
private isReady = false;
|
|
11
|
+
|
|
12
|
+
constructor() {
|
|
13
|
+
this.bindEvent();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
public reportCount(key: MetricsKey) {
|
|
17
|
+
const task = this.createReportCountTask(key);
|
|
18
|
+
if (!this.isReady) {
|
|
19
|
+
this.taskQueue.push(task);
|
|
20
|
+
} else {
|
|
21
|
+
task();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
private bindEvent() {
|
|
26
|
+
TUIRoomEngine.once('ready', () => {
|
|
27
|
+
this.isReady = true;
|
|
28
|
+
this.executePendingTasks();
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
private executePendingTasks() {
|
|
33
|
+
this.taskQueue.forEach(task => {
|
|
34
|
+
try {
|
|
35
|
+
task();
|
|
36
|
+
} catch (error) {
|
|
37
|
+
console.error('Task execution failed:', error);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
this.taskQueue = [];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
private createReportCountTask(key: MetricsKey): Task {
|
|
44
|
+
return () => {
|
|
45
|
+
TUIRoomEngine.callExperimentalAPI(
|
|
46
|
+
JSON.stringify({
|
|
47
|
+
api: KEY_METRICS_API,
|
|
48
|
+
params: { key },
|
|
49
|
+
})
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export const dataReport = new DataReport();
|
package/src/rtc/index.ts
CHANGED
|
@@ -7,28 +7,28 @@ import { CameraButton as CameraButtonComponent } from '../components/CameraButto
|
|
|
7
7
|
import { CoGuestPanel as CoGuestPanelComponent } from '../components/CoGuestPanel';
|
|
8
8
|
import { CoHostPanel as CoHostPanelComponent } from '../components/CoHostPanel';
|
|
9
9
|
import { LiveAudienceList as LiveAudienceListComponent } from '../components/LiveAudienceList';
|
|
10
|
-
import { LiveCoreView, LiveView } from '../components/LiveView';
|
|
11
10
|
import { LiveList as LiveListComponent } from '../components/LiveList';
|
|
12
11
|
import { LiveMonitorView as LiveMonitorViewComponent } from '../components/LiveMonitorView';
|
|
13
12
|
import { LiveScenePanel as LiveScenePanelComponent } from '../components/LiveScenePanel';
|
|
13
|
+
import { LiveCoreView, LiveView } from '../components/LiveView';
|
|
14
14
|
import { MicButton as MicButtonComponent } from '../components/MicButton';
|
|
15
15
|
import { StreamMixer as StreamMixerComponent } from '../components/StreamMixer';
|
|
16
16
|
import { StreamView as StreamViewComponent } from '../components/StreamView';
|
|
17
17
|
import { VideoSetting as VideoSettingComponent } from '../components/VideoSetting';
|
|
18
18
|
import { VideoSettingPanel as VideoSettingPanelComponent } from '../components/VideoSettingPanel';
|
|
19
|
-
import {
|
|
19
|
+
import { useRoomEngine as RoomEngine } from '../hooks/useRoomEngine';
|
|
20
|
+
import { useBarrageState } from '../states/BarrageState';
|
|
21
|
+
import { useBattleState } from '../states/BattleState';
|
|
20
22
|
import { useCoGuestState as CoGuestState } from '../states/CoGuestState';
|
|
21
23
|
import { useCoHostState as CoHostState } from '../states/CoHostState';
|
|
22
24
|
import { useDeviceState as DeviceState } from '../states/DeviceState';
|
|
23
25
|
import { useLiveAudienceState as LiveAudienceState } from '../states/LiveAudienceState';
|
|
26
|
+
import { useLiveListState } from '../states/LiveListState';
|
|
24
27
|
import { useLiveMonitorState as LiveMonitorState } from '../states/LiveMonitorState';
|
|
25
28
|
import { useLiveSeatState as LiveSeatState } from '../states/LiveSeatState';
|
|
26
|
-
import { useLiveState as LiveState } from '../states/LiveState';
|
|
27
29
|
import { useRoomState as RoomState } from '../states/RoomState';
|
|
28
30
|
import { useUserState as UserState } from '../states/UserState';
|
|
29
31
|
import { useVideoMixerState as VideoMixerState } from '../states/VideoMixerState';
|
|
30
|
-
import { useBattleState } from '../states/BattleState';
|
|
31
|
-
import { useRoomEngine as RoomEngine } from '../hooks/useRoomEngine';
|
|
32
32
|
|
|
33
33
|
import RTCLoginServer from './server';
|
|
34
34
|
|
|
@@ -51,10 +51,8 @@ const StreamView = StreamViewComponent;
|
|
|
51
51
|
const AudioSetting = AudioSettingComponent;
|
|
52
52
|
const VideoSetting = VideoSettingComponent;
|
|
53
53
|
|
|
54
|
-
const useBarrageListState = BarrageListState;
|
|
55
54
|
const useLiveMonitorState = LiveMonitorState;
|
|
56
55
|
const useLiveSeatState = LiveSeatState;
|
|
57
|
-
const useLiveState = LiveState;
|
|
58
56
|
const useUserState = UserState;
|
|
59
57
|
const useCoGuestState = CoGuestState;
|
|
60
58
|
const useCoHostState = CoHostState;
|
|
@@ -87,7 +85,7 @@ export {
|
|
|
87
85
|
|
|
88
86
|
// States
|
|
89
87
|
useRoomEngine,
|
|
90
|
-
|
|
88
|
+
useLiveListState,
|
|
91
89
|
useRoomState,
|
|
92
90
|
useUserState,
|
|
93
91
|
useDeviceState,
|
|
@@ -97,6 +95,6 @@ export {
|
|
|
97
95
|
useCoHostState,
|
|
98
96
|
useLiveAudienceState,
|
|
99
97
|
useLiveMonitorState,
|
|
100
|
-
useBarrageListState,
|
|
101
98
|
useBattleState,
|
|
99
|
+
useBarrageState,
|
|
102
100
|
};
|
package/src/types/audience.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TUIRole } from '@tencentcloud/tuiroom-engine-js';
|
|
1
|
+
import type { TUIRole } from '@tencentcloud/tuiroom-engine-js';
|
|
2
2
|
|
|
3
3
|
export interface AudienceInfo {
|
|
4
4
|
userId: string;
|
|
@@ -9,3 +9,29 @@ export interface AudienceInfo {
|
|
|
9
9
|
isMessageDisabled: boolean;
|
|
10
10
|
joinedTimestamp?: number;
|
|
11
11
|
}
|
|
12
|
+
|
|
13
|
+
export interface LiveUserInfo {
|
|
14
|
+
userId: string;
|
|
15
|
+
userName: string;
|
|
16
|
+
avatarUrl: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export enum LiveAudienceEvent {
|
|
20
|
+
onAudienceJoined = 'onAudienceJoined',
|
|
21
|
+
onAudienceLeft = 'onAudienceLeft',
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
type AudienceJoinedEventInfo = {
|
|
25
|
+
audience: LiveUserInfo;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
type AudienceLeftEventInfo = {
|
|
29
|
+
audience: LiveUserInfo;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export interface LiveAudienceEventInfo {
|
|
33
|
+
[LiveAudienceEvent.onAudienceJoined]: AudienceJoinedEventInfo;
|
|
34
|
+
[LiveAudienceEvent.onAudienceLeft]: AudienceLeftEventInfo;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type LiveAudienceEventCallback = <T extends LiveAudienceEvent = LiveAudienceEvent>(eventInfo: LiveAudienceEventInfo[T]) => void;
|
package/src/types/battle.ts
CHANGED
|
@@ -1,12 +1,95 @@
|
|
|
1
|
-
|
|
1
|
+
import type { SeatUserInfo } from './seat';
|
|
2
|
+
|
|
3
|
+
export interface BattleConfig {
|
|
2
4
|
duration: number;
|
|
3
5
|
needResponse: boolean;
|
|
4
6
|
extensionInfo: string;
|
|
5
7
|
}
|
|
6
8
|
|
|
7
|
-
export
|
|
9
|
+
export interface BattleInfo {
|
|
8
10
|
battleId: string;
|
|
9
11
|
config: BattleConfig;
|
|
10
|
-
startTime: number
|
|
12
|
+
startTime: number;
|
|
11
13
|
endTime: number;
|
|
12
|
-
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export enum BattleEndedReason {
|
|
17
|
+
timeOver = 0,
|
|
18
|
+
allMemberExit = 1,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export enum BattleEvent {
|
|
22
|
+
onBattleStarted,
|
|
23
|
+
onBattleEnded,
|
|
24
|
+
onUserJoinBattle,
|
|
25
|
+
onUserExitBattle,
|
|
26
|
+
onBattleRequestReceived,
|
|
27
|
+
onBattleRequestCancelled,
|
|
28
|
+
onBattleRequestTimeout,
|
|
29
|
+
onBattleRequestAccept,
|
|
30
|
+
onBattleRequestReject,
|
|
31
|
+
}
|
|
32
|
+
interface BattleStartedEventInfo {
|
|
33
|
+
battleInfo: BattleInfo;
|
|
34
|
+
inviter: SeatUserInfo;
|
|
35
|
+
invitees: SeatUserInfo[];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface BattleEndedEventInfo {
|
|
39
|
+
battleInfo: BattleInfo;
|
|
40
|
+
reason: BattleEndedReason;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface UserJoinBattleEventInfo {
|
|
44
|
+
battleId: string;
|
|
45
|
+
battleUser: SeatUserInfo;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface UserExitBattleEventInfo {
|
|
49
|
+
battleId: string;
|
|
50
|
+
battleUser: SeatUserInfo;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
interface BattleRequestReceivedEventInfo {
|
|
54
|
+
battleId: string;
|
|
55
|
+
inviter: SeatUserInfo;
|
|
56
|
+
invitee: SeatUserInfo;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
interface BattleRequestCancelledEventInfo {
|
|
60
|
+
battleId: string;
|
|
61
|
+
inviter: SeatUserInfo;
|
|
62
|
+
invitee: SeatUserInfo;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
interface BattleRequestTimeoutEventInfo {
|
|
66
|
+
battleId: string;
|
|
67
|
+
inviter: SeatUserInfo;
|
|
68
|
+
invitee: SeatUserInfo;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
interface BattleRequestAcceptEventInfo {
|
|
72
|
+
battleId: string;
|
|
73
|
+
inviter: SeatUserInfo;
|
|
74
|
+
invitee: SeatUserInfo;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
interface BattleRequestRejectEventInfo {
|
|
78
|
+
battleId: string;
|
|
79
|
+
inviter: SeatUserInfo;
|
|
80
|
+
invitee: SeatUserInfo;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export type BattleEventInfoMap = {
|
|
84
|
+
[BattleEvent.onBattleStarted]: BattleStartedEventInfo;
|
|
85
|
+
[BattleEvent.onBattleEnded]: BattleEndedEventInfo;
|
|
86
|
+
[BattleEvent.onUserJoinBattle]: UserJoinBattleEventInfo;
|
|
87
|
+
[BattleEvent.onUserExitBattle]: UserExitBattleEventInfo;
|
|
88
|
+
[BattleEvent.onBattleRequestReceived]: BattleRequestReceivedEventInfo;
|
|
89
|
+
[BattleEvent.onBattleRequestCancelled]: BattleRequestCancelledEventInfo;
|
|
90
|
+
[BattleEvent.onBattleRequestTimeout]: BattleRequestTimeoutEventInfo;
|
|
91
|
+
[BattleEvent.onBattleRequestAccept]: BattleRequestAcceptEventInfo;
|
|
92
|
+
[BattleEvent.onBattleRequestReject]: BattleRequestRejectEventInfo;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export type BattleEventCallback = <T extends BattleEvent = BattleEvent>(eventInfo: BattleEventInfoMap[T]) => void;
|