@easemob-community/callkit-vue3 2.0.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/LICENSE +21 -0
- package/README.md +208 -0
- package/dist/callkit-vue3.css +1 -0
- package/dist/components/EasemobChatCallKitProvider.vue.d.ts +18 -0
- package/dist/components/EasemobChatMiniWindow.vue.d.ts +11 -0
- package/dist/components/InvitationNotification.vue.d.ts +2 -0
- package/dist/components/multiCall/EasemobChatGroupMemberList.vue.d.ts +19 -0
- package/dist/components/multiCall/EasemobChatMultiCall.vue.d.ts +69 -0
- package/dist/components/singleCall/CallControls.vue.d.ts +18 -0
- package/dist/components/singleCall/CallInfoBar.vue.d.ts +5 -0
- package/dist/components/singleCall/EasemobChatCallStream.vue.d.ts +12 -0
- package/dist/components/singleCall/EasemobChatCallWaiting.vue.d.ts +10 -0
- package/dist/components/singleCall/EasemobChatSingleCall.vue.d.ts +28 -0
- package/dist/composables/useAnswerCall.d.ts +10 -0
- package/dist/composables/useCallKit.d.ts +2 -0
- package/dist/composables/useCallKitCore.d.ts +998 -0
- package/dist/composables/useCallKitEvents.d.ts +42 -0
- package/dist/composables/useDraggable.d.ts +90 -0
- package/dist/composables/useEndCall.d.ts +15 -0
- package/dist/composables/useParticipants.d.ts +15 -0
- package/dist/composables/useRtcService.d.ts +80 -0
- package/dist/config/assets.d.ts +43 -0
- package/dist/core/events/CallKitEventBus.d.ts +40 -0
- package/dist/core/events/helpers.d.ts +59 -0
- package/dist/core/events/types.d.ts +264 -0
- package/dist/core/sdk/imSDK/index.d.ts +4 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +7806 -0
- package/dist/index.umd.js +72 -0
- package/dist/modules/groupCall/components/CallKitIcon.vue.d.ts +12 -0
- package/dist/modules/groupCall/components/GroupCallShell.vue.d.ts +34 -0
- package/dist/modules/groupCall/components/MainVideoLayout.vue.d.ts +32 -0
- package/dist/modules/groupCall/components/ParticipantTile.vue.d.ts +12 -0
- package/dist/modules/groupCall/components/VideoGrid.vue.d.ts +29 -0
- package/dist/modules/groupCall/components/iconRegistry.d.ts +2 -0
- package/dist/modules/groupCall/index.d.ts +7 -0
- package/dist/modules/groupCall/media/RtcMediaBridge.d.ts +26 -0
- package/dist/modules/groupCall/signaling/GroupCallSignalingAdapter.d.ts +29 -0
- package/dist/modules/groupCall/types.d.ts +37 -0
- package/dist/modules/groupCall/viewModel/GroupCallStore.d.ts +345 -0
- package/dist/modules/groupCall/viewModel/useGroupCallViewModel.d.ts +35 -0
- package/dist/services/CallService.d.ts +15 -0
- package/dist/services/RtcAdapter.d.ts +11 -0
- package/dist/services/RtcService.d.ts +187 -0
- package/dist/services/UserProfileService.d.ts +38 -0
- package/dist/store/callTimer.d.ts +33 -0
- package/dist/store/chatClient.d.ts +5335 -0
- package/dist/store/globalCall.d.ts +34 -0
- package/dist/store/index.d.ts +1 -0
- package/dist/store/rtcChannel.d.ts +42 -0
- package/dist/store/types.d.ts +50 -0
- package/dist/types/callstate.types.d.ts +61 -0
- package/dist/types/signal.types.d.ts +187 -0
- package/dist/types.d.ts +103 -0
- package/dist/utils/callUtils.d.ts +15 -0
- package/dist/utils/imSdkAdapter.d.ts +29 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/logger.d.ts +122 -0
- package/dist/utils/loggerDb.d.ts +41 -0
- package/dist/utils/ringtone.d.ts +20 -0
- package/dist/vite-env.d.ts +12 -0
- package/package.json +60 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface CallKitIconProps {
|
|
2
|
+
name: string;
|
|
3
|
+
width?: number | string;
|
|
4
|
+
height?: number | string;
|
|
5
|
+
color?: string;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: import('vue').DefineComponent<CallKitIconProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<CallKitIconProps> & Readonly<{}>, {
|
|
8
|
+
width: number | string;
|
|
9
|
+
height: number | string;
|
|
10
|
+
color: string;
|
|
11
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLSpanElement>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { RtcService } from '../../../services/RtcService';
|
|
2
|
+
export interface GroupCallShellProps {
|
|
3
|
+
groupId: string;
|
|
4
|
+
groupName?: string;
|
|
5
|
+
currentUserId: string;
|
|
6
|
+
currentNickname?: string;
|
|
7
|
+
currentAvatarUrl?: string;
|
|
8
|
+
rtcService?: RtcService | null;
|
|
9
|
+
groupMembers?: Array<{
|
|
10
|
+
userId: string;
|
|
11
|
+
userName: string;
|
|
12
|
+
avatar?: string;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
declare const _default: import('vue').DefineComponent<GroupCallShellProps, {
|
|
16
|
+
startSession: (payload: {
|
|
17
|
+
sessionId: string;
|
|
18
|
+
callType: "video" | "audio";
|
|
19
|
+
}) => void;
|
|
20
|
+
addRemoteParticipant: (userId: string, nickname: string, avatarUrl?: string) => void;
|
|
21
|
+
markRemoteAccepted: (userId: string) => void;
|
|
22
|
+
bindRtcService: (rtcService: RtcService) => void;
|
|
23
|
+
unbindRtcService: () => void;
|
|
24
|
+
sendInvite: (userIds: string[], groupId: string, message: string) => Promise<void>;
|
|
25
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
26
|
+
hangup: () => any;
|
|
27
|
+
addParticipant: () => any;
|
|
28
|
+
}, string, import('vue').PublicProps, Readonly<GroupCallShellProps> & Readonly<{
|
|
29
|
+
onHangup?: () => any;
|
|
30
|
+
onAddParticipant?: () => any;
|
|
31
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
32
|
+
shellRef: HTMLDivElement;
|
|
33
|
+
}, HTMLDivElement>;
|
|
34
|
+
export default _default;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
import { Participant } from '../types';
|
|
3
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
4
|
+
participants: {
|
|
5
|
+
type: PropType<Participant[]>;
|
|
6
|
+
default: () => any[];
|
|
7
|
+
};
|
|
8
|
+
selectedId: {
|
|
9
|
+
type: StringConstructor;
|
|
10
|
+
required: true;
|
|
11
|
+
};
|
|
12
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
13
|
+
select: (userId: string) => any;
|
|
14
|
+
exit: () => any;
|
|
15
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
16
|
+
participants: {
|
|
17
|
+
type: PropType<Participant[]>;
|
|
18
|
+
default: () => any[];
|
|
19
|
+
};
|
|
20
|
+
selectedId: {
|
|
21
|
+
type: StringConstructor;
|
|
22
|
+
required: true;
|
|
23
|
+
};
|
|
24
|
+
}>> & Readonly<{
|
|
25
|
+
onSelect?: (userId: string) => any;
|
|
26
|
+
onExit?: () => any;
|
|
27
|
+
}>, {
|
|
28
|
+
participants: Participant[];
|
|
29
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
|
|
30
|
+
scrollRef: HTMLDivElement;
|
|
31
|
+
}, HTMLDivElement>;
|
|
32
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Participant } from '../types';
|
|
2
|
+
interface ParticipantTileProps {
|
|
3
|
+
participant: Participant;
|
|
4
|
+
}
|
|
5
|
+
declare const _default: import('vue').DefineComponent<ParticipantTileProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
6
|
+
click: (userId: string) => any;
|
|
7
|
+
}, string, import('vue').PublicProps, Readonly<ParticipantTileProps> & Readonly<{
|
|
8
|
+
onClick?: (userId: string) => any;
|
|
9
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
10
|
+
videoEl: HTMLVideoElement;
|
|
11
|
+
}, HTMLDivElement>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
import { Participant } from '../types';
|
|
3
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
4
|
+
participants: {
|
|
5
|
+
type: PropType<Participant[]>;
|
|
6
|
+
default: () => any[];
|
|
7
|
+
};
|
|
8
|
+
selectedId: {
|
|
9
|
+
type: PropType<string | null>;
|
|
10
|
+
default: any;
|
|
11
|
+
};
|
|
12
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
13
|
+
select: (userId: string) => any;
|
|
14
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
15
|
+
participants: {
|
|
16
|
+
type: PropType<Participant[]>;
|
|
17
|
+
default: () => any[];
|
|
18
|
+
};
|
|
19
|
+
selectedId: {
|
|
20
|
+
type: PropType<string | null>;
|
|
21
|
+
default: any;
|
|
22
|
+
};
|
|
23
|
+
}>> & Readonly<{
|
|
24
|
+
onSelect?: (userId: string) => any;
|
|
25
|
+
}>, {
|
|
26
|
+
participants: Participant[];
|
|
27
|
+
selectedId: string;
|
|
28
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
29
|
+
export default _default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { useGroupCallStore } from './viewModel/GroupCallStore';
|
|
2
|
+
export { useGroupCallViewModel } from './viewModel/useGroupCallViewModel';
|
|
3
|
+
export type { UseGroupCallViewModelReturn } from './viewModel/useGroupCallViewModel';
|
|
4
|
+
export { default as GroupCallShell } from './components/GroupCallShell.vue';
|
|
5
|
+
export { default as ParticipantTile } from './components/ParticipantTile.vue';
|
|
6
|
+
export { default as VideoGrid } from './components/VideoGrid.vue';
|
|
7
|
+
export type { Participant, ParticipantState, GroupCallSessionState, UidResolution, } from './types';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { RtcService } from '../../../services/RtcService';
|
|
2
|
+
/**
|
|
3
|
+
* RtcMediaBridge
|
|
4
|
+
* 职责:监听 Agora 事件,订阅远程流,并将 track 写入 GroupCallStore
|
|
5
|
+
* 不处理 UI,不处理信令,只做纯粹的 RTC -> Store 桥接
|
|
6
|
+
*/
|
|
7
|
+
export declare class RtcMediaBridge {
|
|
8
|
+
private rtcService;
|
|
9
|
+
private store;
|
|
10
|
+
private client;
|
|
11
|
+
constructor(rtcService: RtcService);
|
|
12
|
+
destroy(): void;
|
|
13
|
+
private bindEvents;
|
|
14
|
+
private unbindEvents;
|
|
15
|
+
private handleUserJoined;
|
|
16
|
+
private handleUserLeft;
|
|
17
|
+
private handleUserPublished;
|
|
18
|
+
private handleUserUnpublished;
|
|
19
|
+
private handleVolumeIndicator;
|
|
20
|
+
private migrateTempParticipant;
|
|
21
|
+
/**
|
|
22
|
+
* 用 GlobalCallStore 中的资料丰富参与者信息
|
|
23
|
+
*/
|
|
24
|
+
private enrichParticipantProfile;
|
|
25
|
+
private fetchUserIdByUid;
|
|
26
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CALL_TYPE } from '../../../types/callstate.types';
|
|
2
|
+
/**
|
|
3
|
+
* GroupCallSignalingAdapter
|
|
4
|
+
* 基于 callkit-core 的群通话信令适配器
|
|
5
|
+
* 职责:将新模块的群组通话动作转换为 useCallKitCore API 调用
|
|
6
|
+
*/
|
|
7
|
+
export declare class GroupCallSignalingAdapter {
|
|
8
|
+
private core;
|
|
9
|
+
/**
|
|
10
|
+
* 发送邀请(通话中追加新成员)
|
|
11
|
+
* 复用 useCallKitCore.inviteMoreParticipants(不会创建新通话)
|
|
12
|
+
*/
|
|
13
|
+
sendInvite(userIds: string[], groupId: string, message: string, callType?: CALL_TYPE): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* 接受邀请(被叫方)
|
|
16
|
+
* 通过 core.answerCall 发送接听信令
|
|
17
|
+
*/
|
|
18
|
+
sendAnswer(userId: string, groupId: string): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* 挂断 / 离开通话 / 取消邀请
|
|
21
|
+
* 区分:有成员已加入时发 leaveCall,仅邀请阶段发 cancelCall
|
|
22
|
+
*/
|
|
23
|
+
hangup(): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* 取消邀请(邀请超时或主动取消)
|
|
26
|
+
* 仅从本地会话移除该参与者,不发送全局 hangup
|
|
27
|
+
*/
|
|
28
|
+
cancelInvitation(userId: string, groupId?: string): Promise<void>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 群组通话新模块 - 核心类型定义
|
|
3
|
+
* 设计原则:单一事实源,UI 只做纯渲染,状态驱动媒体
|
|
4
|
+
*/
|
|
5
|
+
/** 参与者生命周期状态 */
|
|
6
|
+
export type ParticipantState = 'invited' | 'accepted' | 'joinedRtc' | 'publishing' | 'left';
|
|
7
|
+
/** 单个参与者(UI 和媒体层的唯一事实源) */
|
|
8
|
+
export interface Participant {
|
|
9
|
+
userId: string;
|
|
10
|
+
nickname: string;
|
|
11
|
+
avatarUrl?: string;
|
|
12
|
+
state: ParticipantState;
|
|
13
|
+
isLocal: boolean;
|
|
14
|
+
videoTrack: any;
|
|
15
|
+
audioTrack: any;
|
|
16
|
+
localStream: MediaStream | null;
|
|
17
|
+
uid?: string;
|
|
18
|
+
isMuted: boolean;
|
|
19
|
+
isCameraOn: boolean;
|
|
20
|
+
isSpeaking: boolean;
|
|
21
|
+
invitedAt: number;
|
|
22
|
+
joinedAt?: number;
|
|
23
|
+
}
|
|
24
|
+
/** 群组通话整体状态 */
|
|
25
|
+
export interface GroupCallSessionState {
|
|
26
|
+
sessionId: string;
|
|
27
|
+
groupId: string;
|
|
28
|
+
groupName?: string;
|
|
29
|
+
callType: 'video' | 'audio';
|
|
30
|
+
isActive: boolean;
|
|
31
|
+
startTime: number;
|
|
32
|
+
}
|
|
33
|
+
/** uid -> userId 解析结果 */
|
|
34
|
+
export interface UidResolution {
|
|
35
|
+
userId: string | null;
|
|
36
|
+
confidence: 'certain' | 'inferred' | 'unknown';
|
|
37
|
+
}
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
import { Participant, GroupCallSessionState, UidResolution } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* GroupCallStore - 群组通话参与者与状态的单一事实源
|
|
4
|
+
* 替代旧架构中的 useParticipants + rtcChannelStore 分散逻辑
|
|
5
|
+
*/
|
|
6
|
+
export declare const useGroupCallStore: import('pinia').StoreDefinition<"groupCall", Pick<{
|
|
7
|
+
session: import('vue').Ref<{
|
|
8
|
+
sessionId: string;
|
|
9
|
+
groupId: string;
|
|
10
|
+
groupName?: string;
|
|
11
|
+
callType: "video" | "audio";
|
|
12
|
+
isActive: boolean;
|
|
13
|
+
startTime: number;
|
|
14
|
+
}, GroupCallSessionState | {
|
|
15
|
+
sessionId: string;
|
|
16
|
+
groupId: string;
|
|
17
|
+
groupName?: string;
|
|
18
|
+
callType: "video" | "audio";
|
|
19
|
+
isActive: boolean;
|
|
20
|
+
startTime: number;
|
|
21
|
+
}>;
|
|
22
|
+
participants: import('vue').Ref<Map<string, {
|
|
23
|
+
userId: string;
|
|
24
|
+
nickname: string;
|
|
25
|
+
avatarUrl?: string;
|
|
26
|
+
state: import('..').ParticipantState;
|
|
27
|
+
isLocal: boolean;
|
|
28
|
+
videoTrack: any;
|
|
29
|
+
audioTrack: any;
|
|
30
|
+
localStream: {
|
|
31
|
+
readonly active: boolean;
|
|
32
|
+
readonly id: string;
|
|
33
|
+
onaddtrack: ((this: MediaStream, ev: MediaStreamTrackEvent) => any) | null;
|
|
34
|
+
onremovetrack: ((this: MediaStream, ev: MediaStreamTrackEvent) => any) | null;
|
|
35
|
+
addTrack: (track: MediaStreamTrack) => void;
|
|
36
|
+
clone: () => MediaStream;
|
|
37
|
+
getAudioTracks: () => MediaStreamTrack[];
|
|
38
|
+
getTrackById: (trackId: string) => MediaStreamTrack | null;
|
|
39
|
+
getTracks: () => MediaStreamTrack[];
|
|
40
|
+
getVideoTracks: () => MediaStreamTrack[];
|
|
41
|
+
removeTrack: (track: MediaStreamTrack) => void;
|
|
42
|
+
addEventListener: {
|
|
43
|
+
<K extends keyof MediaStreamEventMap>(type: K, listener: (this: MediaStream, ev: MediaStreamEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
44
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
45
|
+
};
|
|
46
|
+
removeEventListener: {
|
|
47
|
+
<K extends keyof MediaStreamEventMap>(type: K, listener: (this: MediaStream, ev: MediaStreamEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
48
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
49
|
+
};
|
|
50
|
+
dispatchEvent: (event: Event) => boolean;
|
|
51
|
+
};
|
|
52
|
+
uid?: string;
|
|
53
|
+
isMuted: boolean;
|
|
54
|
+
isCameraOn: boolean;
|
|
55
|
+
isSpeaking: boolean;
|
|
56
|
+
invitedAt: number;
|
|
57
|
+
joinedAt?: number;
|
|
58
|
+
}> & Omit<Map<string, Participant>, keyof Map<any, any>>, Map<string, Participant> | (Map<string, {
|
|
59
|
+
userId: string;
|
|
60
|
+
nickname: string;
|
|
61
|
+
avatarUrl?: string;
|
|
62
|
+
state: import('..').ParticipantState;
|
|
63
|
+
isLocal: boolean;
|
|
64
|
+
videoTrack: any;
|
|
65
|
+
audioTrack: any;
|
|
66
|
+
localStream: {
|
|
67
|
+
readonly active: boolean;
|
|
68
|
+
readonly id: string;
|
|
69
|
+
onaddtrack: ((this: MediaStream, ev: MediaStreamTrackEvent) => any) | null;
|
|
70
|
+
onremovetrack: ((this: MediaStream, ev: MediaStreamTrackEvent) => any) | null;
|
|
71
|
+
addTrack: (track: MediaStreamTrack) => void;
|
|
72
|
+
clone: () => MediaStream;
|
|
73
|
+
getAudioTracks: () => MediaStreamTrack[];
|
|
74
|
+
getTrackById: (trackId: string) => MediaStreamTrack | null;
|
|
75
|
+
getTracks: () => MediaStreamTrack[];
|
|
76
|
+
getVideoTracks: () => MediaStreamTrack[];
|
|
77
|
+
removeTrack: (track: MediaStreamTrack) => void;
|
|
78
|
+
addEventListener: {
|
|
79
|
+
<K extends keyof MediaStreamEventMap>(type: K, listener: (this: MediaStream, ev: MediaStreamEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
80
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
81
|
+
};
|
|
82
|
+
removeEventListener: {
|
|
83
|
+
<K extends keyof MediaStreamEventMap>(type: K, listener: (this: MediaStream, ev: MediaStreamEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
84
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
85
|
+
};
|
|
86
|
+
dispatchEvent: (event: Event) => boolean;
|
|
87
|
+
};
|
|
88
|
+
uid?: string;
|
|
89
|
+
isMuted: boolean;
|
|
90
|
+
isCameraOn: boolean;
|
|
91
|
+
isSpeaking: boolean;
|
|
92
|
+
invitedAt: number;
|
|
93
|
+
joinedAt?: number;
|
|
94
|
+
}> & Omit<Map<string, Participant>, keyof Map<any, any>>)>;
|
|
95
|
+
uidToUserIdMap: import('vue').Ref<Map<string, string> & Omit<Map<string, string>, keyof Map<any, any>>, Map<string, string> | (Map<string, string> & Omit<Map<string, string>, keyof Map<any, any>>)>;
|
|
96
|
+
acceptedMembers: import('vue').Ref<Set<string> & Omit<Set<string>, keyof Set<any>>, Set<string> | (Set<string> & Omit<Set<string>, keyof Set<any>>)>;
|
|
97
|
+
participantList: import('vue').ComputedRef<Participant[]>;
|
|
98
|
+
localParticipant: import('vue').ComputedRef<Participant>;
|
|
99
|
+
activeParticipants: import('vue').ComputedRef<Participant[]>;
|
|
100
|
+
publishingParticipants: import('vue').ComputedRef<Participant[]>;
|
|
101
|
+
initSession: (payload: GroupCallSessionState) => void;
|
|
102
|
+
destroySession: () => void;
|
|
103
|
+
addParticipant: (participant: Omit<Participant, "invitedAt">) => void;
|
|
104
|
+
removeParticipant: (userId: string) => void;
|
|
105
|
+
setParticipantState: (userId: string, state: Participant["state"]) => void;
|
|
106
|
+
markAccepted: (userId: string) => void;
|
|
107
|
+
setUidMapping: (uid: string, userId: string) => void;
|
|
108
|
+
resolveUid: (uid: string) => UidResolution;
|
|
109
|
+
setVideoTrack: (userId: string, track: Participant["videoTrack"]) => void;
|
|
110
|
+
setAudioTrack: (userId: string, track: Participant["audioTrack"]) => void;
|
|
111
|
+
setLocalStream: (userId: string, stream: MediaStream | null) => void;
|
|
112
|
+
setMuteState: (userId: string, isMuted: boolean) => void;
|
|
113
|
+
setCameraState: (userId: string, isCameraOn: boolean) => void;
|
|
114
|
+
setSpeakingState: (userId: string, isSpeaking: boolean) => void;
|
|
115
|
+
updateParticipantProfile: (userId: string, profile: {
|
|
116
|
+
nickname?: string;
|
|
117
|
+
avatarUrl?: string;
|
|
118
|
+
}) => void;
|
|
119
|
+
}, "participants" | "session" | "uidToUserIdMap" | "acceptedMembers">, Pick<{
|
|
120
|
+
session: import('vue').Ref<{
|
|
121
|
+
sessionId: string;
|
|
122
|
+
groupId: string;
|
|
123
|
+
groupName?: string;
|
|
124
|
+
callType: "video" | "audio";
|
|
125
|
+
isActive: boolean;
|
|
126
|
+
startTime: number;
|
|
127
|
+
}, GroupCallSessionState | {
|
|
128
|
+
sessionId: string;
|
|
129
|
+
groupId: string;
|
|
130
|
+
groupName?: string;
|
|
131
|
+
callType: "video" | "audio";
|
|
132
|
+
isActive: boolean;
|
|
133
|
+
startTime: number;
|
|
134
|
+
}>;
|
|
135
|
+
participants: import('vue').Ref<Map<string, {
|
|
136
|
+
userId: string;
|
|
137
|
+
nickname: string;
|
|
138
|
+
avatarUrl?: string;
|
|
139
|
+
state: import('..').ParticipantState;
|
|
140
|
+
isLocal: boolean;
|
|
141
|
+
videoTrack: any;
|
|
142
|
+
audioTrack: any;
|
|
143
|
+
localStream: {
|
|
144
|
+
readonly active: boolean;
|
|
145
|
+
readonly id: string;
|
|
146
|
+
onaddtrack: ((this: MediaStream, ev: MediaStreamTrackEvent) => any) | null;
|
|
147
|
+
onremovetrack: ((this: MediaStream, ev: MediaStreamTrackEvent) => any) | null;
|
|
148
|
+
addTrack: (track: MediaStreamTrack) => void;
|
|
149
|
+
clone: () => MediaStream;
|
|
150
|
+
getAudioTracks: () => MediaStreamTrack[];
|
|
151
|
+
getTrackById: (trackId: string) => MediaStreamTrack | null;
|
|
152
|
+
getTracks: () => MediaStreamTrack[];
|
|
153
|
+
getVideoTracks: () => MediaStreamTrack[];
|
|
154
|
+
removeTrack: (track: MediaStreamTrack) => void;
|
|
155
|
+
addEventListener: {
|
|
156
|
+
<K extends keyof MediaStreamEventMap>(type: K, listener: (this: MediaStream, ev: MediaStreamEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
157
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
158
|
+
};
|
|
159
|
+
removeEventListener: {
|
|
160
|
+
<K extends keyof MediaStreamEventMap>(type: K, listener: (this: MediaStream, ev: MediaStreamEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
161
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
162
|
+
};
|
|
163
|
+
dispatchEvent: (event: Event) => boolean;
|
|
164
|
+
};
|
|
165
|
+
uid?: string;
|
|
166
|
+
isMuted: boolean;
|
|
167
|
+
isCameraOn: boolean;
|
|
168
|
+
isSpeaking: boolean;
|
|
169
|
+
invitedAt: number;
|
|
170
|
+
joinedAt?: number;
|
|
171
|
+
}> & Omit<Map<string, Participant>, keyof Map<any, any>>, Map<string, Participant> | (Map<string, {
|
|
172
|
+
userId: string;
|
|
173
|
+
nickname: string;
|
|
174
|
+
avatarUrl?: string;
|
|
175
|
+
state: import('..').ParticipantState;
|
|
176
|
+
isLocal: boolean;
|
|
177
|
+
videoTrack: any;
|
|
178
|
+
audioTrack: any;
|
|
179
|
+
localStream: {
|
|
180
|
+
readonly active: boolean;
|
|
181
|
+
readonly id: string;
|
|
182
|
+
onaddtrack: ((this: MediaStream, ev: MediaStreamTrackEvent) => any) | null;
|
|
183
|
+
onremovetrack: ((this: MediaStream, ev: MediaStreamTrackEvent) => any) | null;
|
|
184
|
+
addTrack: (track: MediaStreamTrack) => void;
|
|
185
|
+
clone: () => MediaStream;
|
|
186
|
+
getAudioTracks: () => MediaStreamTrack[];
|
|
187
|
+
getTrackById: (trackId: string) => MediaStreamTrack | null;
|
|
188
|
+
getTracks: () => MediaStreamTrack[];
|
|
189
|
+
getVideoTracks: () => MediaStreamTrack[];
|
|
190
|
+
removeTrack: (track: MediaStreamTrack) => void;
|
|
191
|
+
addEventListener: {
|
|
192
|
+
<K extends keyof MediaStreamEventMap>(type: K, listener: (this: MediaStream, ev: MediaStreamEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
193
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
194
|
+
};
|
|
195
|
+
removeEventListener: {
|
|
196
|
+
<K extends keyof MediaStreamEventMap>(type: K, listener: (this: MediaStream, ev: MediaStreamEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
197
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
198
|
+
};
|
|
199
|
+
dispatchEvent: (event: Event) => boolean;
|
|
200
|
+
};
|
|
201
|
+
uid?: string;
|
|
202
|
+
isMuted: boolean;
|
|
203
|
+
isCameraOn: boolean;
|
|
204
|
+
isSpeaking: boolean;
|
|
205
|
+
invitedAt: number;
|
|
206
|
+
joinedAt?: number;
|
|
207
|
+
}> & Omit<Map<string, Participant>, keyof Map<any, any>>)>;
|
|
208
|
+
uidToUserIdMap: import('vue').Ref<Map<string, string> & Omit<Map<string, string>, keyof Map<any, any>>, Map<string, string> | (Map<string, string> & Omit<Map<string, string>, keyof Map<any, any>>)>;
|
|
209
|
+
acceptedMembers: import('vue').Ref<Set<string> & Omit<Set<string>, keyof Set<any>>, Set<string> | (Set<string> & Omit<Set<string>, keyof Set<any>>)>;
|
|
210
|
+
participantList: import('vue').ComputedRef<Participant[]>;
|
|
211
|
+
localParticipant: import('vue').ComputedRef<Participant>;
|
|
212
|
+
activeParticipants: import('vue').ComputedRef<Participant[]>;
|
|
213
|
+
publishingParticipants: import('vue').ComputedRef<Participant[]>;
|
|
214
|
+
initSession: (payload: GroupCallSessionState) => void;
|
|
215
|
+
destroySession: () => void;
|
|
216
|
+
addParticipant: (participant: Omit<Participant, "invitedAt">) => void;
|
|
217
|
+
removeParticipant: (userId: string) => void;
|
|
218
|
+
setParticipantState: (userId: string, state: Participant["state"]) => void;
|
|
219
|
+
markAccepted: (userId: string) => void;
|
|
220
|
+
setUidMapping: (uid: string, userId: string) => void;
|
|
221
|
+
resolveUid: (uid: string) => UidResolution;
|
|
222
|
+
setVideoTrack: (userId: string, track: Participant["videoTrack"]) => void;
|
|
223
|
+
setAudioTrack: (userId: string, track: Participant["audioTrack"]) => void;
|
|
224
|
+
setLocalStream: (userId: string, stream: MediaStream | null) => void;
|
|
225
|
+
setMuteState: (userId: string, isMuted: boolean) => void;
|
|
226
|
+
setCameraState: (userId: string, isCameraOn: boolean) => void;
|
|
227
|
+
setSpeakingState: (userId: string, isSpeaking: boolean) => void;
|
|
228
|
+
updateParticipantProfile: (userId: string, profile: {
|
|
229
|
+
nickname?: string;
|
|
230
|
+
avatarUrl?: string;
|
|
231
|
+
}) => void;
|
|
232
|
+
}, "participantList" | "localParticipant" | "activeParticipants" | "publishingParticipants">, Pick<{
|
|
233
|
+
session: import('vue').Ref<{
|
|
234
|
+
sessionId: string;
|
|
235
|
+
groupId: string;
|
|
236
|
+
groupName?: string;
|
|
237
|
+
callType: "video" | "audio";
|
|
238
|
+
isActive: boolean;
|
|
239
|
+
startTime: number;
|
|
240
|
+
}, GroupCallSessionState | {
|
|
241
|
+
sessionId: string;
|
|
242
|
+
groupId: string;
|
|
243
|
+
groupName?: string;
|
|
244
|
+
callType: "video" | "audio";
|
|
245
|
+
isActive: boolean;
|
|
246
|
+
startTime: number;
|
|
247
|
+
}>;
|
|
248
|
+
participants: import('vue').Ref<Map<string, {
|
|
249
|
+
userId: string;
|
|
250
|
+
nickname: string;
|
|
251
|
+
avatarUrl?: string;
|
|
252
|
+
state: import('..').ParticipantState;
|
|
253
|
+
isLocal: boolean;
|
|
254
|
+
videoTrack: any;
|
|
255
|
+
audioTrack: any;
|
|
256
|
+
localStream: {
|
|
257
|
+
readonly active: boolean;
|
|
258
|
+
readonly id: string;
|
|
259
|
+
onaddtrack: ((this: MediaStream, ev: MediaStreamTrackEvent) => any) | null;
|
|
260
|
+
onremovetrack: ((this: MediaStream, ev: MediaStreamTrackEvent) => any) | null;
|
|
261
|
+
addTrack: (track: MediaStreamTrack) => void;
|
|
262
|
+
clone: () => MediaStream;
|
|
263
|
+
getAudioTracks: () => MediaStreamTrack[];
|
|
264
|
+
getTrackById: (trackId: string) => MediaStreamTrack | null;
|
|
265
|
+
getTracks: () => MediaStreamTrack[];
|
|
266
|
+
getVideoTracks: () => MediaStreamTrack[];
|
|
267
|
+
removeTrack: (track: MediaStreamTrack) => void;
|
|
268
|
+
addEventListener: {
|
|
269
|
+
<K extends keyof MediaStreamEventMap>(type: K, listener: (this: MediaStream, ev: MediaStreamEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
270
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
271
|
+
};
|
|
272
|
+
removeEventListener: {
|
|
273
|
+
<K extends keyof MediaStreamEventMap>(type: K, listener: (this: MediaStream, ev: MediaStreamEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
274
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
275
|
+
};
|
|
276
|
+
dispatchEvent: (event: Event) => boolean;
|
|
277
|
+
};
|
|
278
|
+
uid?: string;
|
|
279
|
+
isMuted: boolean;
|
|
280
|
+
isCameraOn: boolean;
|
|
281
|
+
isSpeaking: boolean;
|
|
282
|
+
invitedAt: number;
|
|
283
|
+
joinedAt?: number;
|
|
284
|
+
}> & Omit<Map<string, Participant>, keyof Map<any, any>>, Map<string, Participant> | (Map<string, {
|
|
285
|
+
userId: string;
|
|
286
|
+
nickname: string;
|
|
287
|
+
avatarUrl?: string;
|
|
288
|
+
state: import('..').ParticipantState;
|
|
289
|
+
isLocal: boolean;
|
|
290
|
+
videoTrack: any;
|
|
291
|
+
audioTrack: any;
|
|
292
|
+
localStream: {
|
|
293
|
+
readonly active: boolean;
|
|
294
|
+
readonly id: string;
|
|
295
|
+
onaddtrack: ((this: MediaStream, ev: MediaStreamTrackEvent) => any) | null;
|
|
296
|
+
onremovetrack: ((this: MediaStream, ev: MediaStreamTrackEvent) => any) | null;
|
|
297
|
+
addTrack: (track: MediaStreamTrack) => void;
|
|
298
|
+
clone: () => MediaStream;
|
|
299
|
+
getAudioTracks: () => MediaStreamTrack[];
|
|
300
|
+
getTrackById: (trackId: string) => MediaStreamTrack | null;
|
|
301
|
+
getTracks: () => MediaStreamTrack[];
|
|
302
|
+
getVideoTracks: () => MediaStreamTrack[];
|
|
303
|
+
removeTrack: (track: MediaStreamTrack) => void;
|
|
304
|
+
addEventListener: {
|
|
305
|
+
<K extends keyof MediaStreamEventMap>(type: K, listener: (this: MediaStream, ev: MediaStreamEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
306
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
307
|
+
};
|
|
308
|
+
removeEventListener: {
|
|
309
|
+
<K extends keyof MediaStreamEventMap>(type: K, listener: (this: MediaStream, ev: MediaStreamEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
310
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
311
|
+
};
|
|
312
|
+
dispatchEvent: (event: Event) => boolean;
|
|
313
|
+
};
|
|
314
|
+
uid?: string;
|
|
315
|
+
isMuted: boolean;
|
|
316
|
+
isCameraOn: boolean;
|
|
317
|
+
isSpeaking: boolean;
|
|
318
|
+
invitedAt: number;
|
|
319
|
+
joinedAt?: number;
|
|
320
|
+
}> & Omit<Map<string, Participant>, keyof Map<any, any>>)>;
|
|
321
|
+
uidToUserIdMap: import('vue').Ref<Map<string, string> & Omit<Map<string, string>, keyof Map<any, any>>, Map<string, string> | (Map<string, string> & Omit<Map<string, string>, keyof Map<any, any>>)>;
|
|
322
|
+
acceptedMembers: import('vue').Ref<Set<string> & Omit<Set<string>, keyof Set<any>>, Set<string> | (Set<string> & Omit<Set<string>, keyof Set<any>>)>;
|
|
323
|
+
participantList: import('vue').ComputedRef<Participant[]>;
|
|
324
|
+
localParticipant: import('vue').ComputedRef<Participant>;
|
|
325
|
+
activeParticipants: import('vue').ComputedRef<Participant[]>;
|
|
326
|
+
publishingParticipants: import('vue').ComputedRef<Participant[]>;
|
|
327
|
+
initSession: (payload: GroupCallSessionState) => void;
|
|
328
|
+
destroySession: () => void;
|
|
329
|
+
addParticipant: (participant: Omit<Participant, "invitedAt">) => void;
|
|
330
|
+
removeParticipant: (userId: string) => void;
|
|
331
|
+
setParticipantState: (userId: string, state: Participant["state"]) => void;
|
|
332
|
+
markAccepted: (userId: string) => void;
|
|
333
|
+
setUidMapping: (uid: string, userId: string) => void;
|
|
334
|
+
resolveUid: (uid: string) => UidResolution;
|
|
335
|
+
setVideoTrack: (userId: string, track: Participant["videoTrack"]) => void;
|
|
336
|
+
setAudioTrack: (userId: string, track: Participant["audioTrack"]) => void;
|
|
337
|
+
setLocalStream: (userId: string, stream: MediaStream | null) => void;
|
|
338
|
+
setMuteState: (userId: string, isMuted: boolean) => void;
|
|
339
|
+
setCameraState: (userId: string, isCameraOn: boolean) => void;
|
|
340
|
+
setSpeakingState: (userId: string, isSpeaking: boolean) => void;
|
|
341
|
+
updateParticipantProfile: (userId: string, profile: {
|
|
342
|
+
nickname?: string;
|
|
343
|
+
avatarUrl?: string;
|
|
344
|
+
}) => void;
|
|
345
|
+
}, "setLocalStream" | "initSession" | "destroySession" | "addParticipant" | "removeParticipant" | "setParticipantState" | "markAccepted" | "setUidMapping" | "resolveUid" | "setVideoTrack" | "setAudioTrack" | "setMuteState" | "setCameraState" | "setSpeakingState" | "updateParticipantProfile">>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ComputedRef, Ref } from 'vue';
|
|
2
|
+
import { RtcService } from '../../../services/RtcService';
|
|
3
|
+
import { Participant } from '../types';
|
|
4
|
+
export interface UseGroupCallViewModelReturn {
|
|
5
|
+
isActive: ComputedRef<boolean>;
|
|
6
|
+
participants: ComputedRef<Participant[]>;
|
|
7
|
+
localParticipant: ComputedRef<Participant | undefined>;
|
|
8
|
+
callDuration: Ref<number>;
|
|
9
|
+
selectedParticipantId: Ref<string | null>;
|
|
10
|
+
startSession: (payload: {
|
|
11
|
+
sessionId: string;
|
|
12
|
+
groupId: string;
|
|
13
|
+
callType: 'video' | 'audio';
|
|
14
|
+
localUserId: string;
|
|
15
|
+
localNickname: string;
|
|
16
|
+
localAvatarUrl?: string;
|
|
17
|
+
}) => void;
|
|
18
|
+
addRemoteParticipant: (userId: string, nickname: string, avatarUrl?: string) => void;
|
|
19
|
+
markRemoteAccepted: (userId: string) => void;
|
|
20
|
+
bindRtcService: (rtcService: RtcService) => void;
|
|
21
|
+
unbindRtcService: () => void;
|
|
22
|
+
sendInvite: (userIds: string[], groupId: string, message: string) => Promise<void>;
|
|
23
|
+
clearInvitationTimer: (userId: string) => void;
|
|
24
|
+
hangup: () => Promise<void>;
|
|
25
|
+
setLocalStream: (stream: MediaStream | null) => void;
|
|
26
|
+
setLocalMute: (isMuted: boolean) => void;
|
|
27
|
+
setLocalCamera: (isCameraOn: boolean) => void;
|
|
28
|
+
setLocalVideoTrack: (track: any) => void;
|
|
29
|
+
selectParticipant: (userId: string | null) => void;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* useGroupCallViewModel
|
|
33
|
+
* 群组通话的顶层 ViewModel,连接 Store、MediaBridge、SignalingAdapter
|
|
34
|
+
*/
|
|
35
|
+
export declare function useGroupCallViewModel(): UseGroupCallViewModelReturn;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CallService - 纯资源清理服务
|
|
3
|
+
*
|
|
4
|
+
* 职责:通话结束时的 RTC 资源清理、计时器重置、小窗状态重置。
|
|
5
|
+
* 信令发送和状态机管理由 callkit-core 负责,此处不做任何信令操作。
|
|
6
|
+
*/
|
|
7
|
+
export declare class CallService {
|
|
8
|
+
private get rtcChannelStore();
|
|
9
|
+
/**
|
|
10
|
+
* 清理通话相关资源
|
|
11
|
+
* 由 useEndCall / useCallKit 在 core hangup 后调用,或 core 失败时回退调用
|
|
12
|
+
*/
|
|
13
|
+
cleanup(): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export declare const callService: CallService;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { RtcAdapter, CALL_TYPE } from '../../../../../callkit-core/src/index.ts';
|
|
2
|
+
export interface CoreCallStateLike {
|
|
3
|
+
type: CALL_TYPE;
|
|
4
|
+
callerUserId: string;
|
|
5
|
+
calleeUserId: string;
|
|
6
|
+
}
|
|
7
|
+
export interface CreateRtcAdapterOptions {
|
|
8
|
+
getCoreCallState: () => CoreCallStateLike;
|
|
9
|
+
getCurrentUserId: () => string;
|
|
10
|
+
}
|
|
11
|
+
export declare function createRtcAdapter(options: CreateRtcAdapterOptions): RtcAdapter;
|