@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.
Files changed (62) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +208 -0
  3. package/dist/callkit-vue3.css +1 -0
  4. package/dist/components/EasemobChatCallKitProvider.vue.d.ts +18 -0
  5. package/dist/components/EasemobChatMiniWindow.vue.d.ts +11 -0
  6. package/dist/components/InvitationNotification.vue.d.ts +2 -0
  7. package/dist/components/multiCall/EasemobChatGroupMemberList.vue.d.ts +19 -0
  8. package/dist/components/multiCall/EasemobChatMultiCall.vue.d.ts +69 -0
  9. package/dist/components/singleCall/CallControls.vue.d.ts +18 -0
  10. package/dist/components/singleCall/CallInfoBar.vue.d.ts +5 -0
  11. package/dist/components/singleCall/EasemobChatCallStream.vue.d.ts +12 -0
  12. package/dist/components/singleCall/EasemobChatCallWaiting.vue.d.ts +10 -0
  13. package/dist/components/singleCall/EasemobChatSingleCall.vue.d.ts +28 -0
  14. package/dist/composables/useAnswerCall.d.ts +10 -0
  15. package/dist/composables/useCallKit.d.ts +2 -0
  16. package/dist/composables/useCallKitCore.d.ts +998 -0
  17. package/dist/composables/useCallKitEvents.d.ts +42 -0
  18. package/dist/composables/useDraggable.d.ts +90 -0
  19. package/dist/composables/useEndCall.d.ts +15 -0
  20. package/dist/composables/useParticipants.d.ts +15 -0
  21. package/dist/composables/useRtcService.d.ts +80 -0
  22. package/dist/config/assets.d.ts +43 -0
  23. package/dist/core/events/CallKitEventBus.d.ts +40 -0
  24. package/dist/core/events/helpers.d.ts +59 -0
  25. package/dist/core/events/types.d.ts +264 -0
  26. package/dist/core/sdk/imSDK/index.d.ts +4 -0
  27. package/dist/index.d.ts +33 -0
  28. package/dist/index.js +7806 -0
  29. package/dist/index.umd.js +72 -0
  30. package/dist/modules/groupCall/components/CallKitIcon.vue.d.ts +12 -0
  31. package/dist/modules/groupCall/components/GroupCallShell.vue.d.ts +34 -0
  32. package/dist/modules/groupCall/components/MainVideoLayout.vue.d.ts +32 -0
  33. package/dist/modules/groupCall/components/ParticipantTile.vue.d.ts +12 -0
  34. package/dist/modules/groupCall/components/VideoGrid.vue.d.ts +29 -0
  35. package/dist/modules/groupCall/components/iconRegistry.d.ts +2 -0
  36. package/dist/modules/groupCall/index.d.ts +7 -0
  37. package/dist/modules/groupCall/media/RtcMediaBridge.d.ts +26 -0
  38. package/dist/modules/groupCall/signaling/GroupCallSignalingAdapter.d.ts +29 -0
  39. package/dist/modules/groupCall/types.d.ts +37 -0
  40. package/dist/modules/groupCall/viewModel/GroupCallStore.d.ts +345 -0
  41. package/dist/modules/groupCall/viewModel/useGroupCallViewModel.d.ts +35 -0
  42. package/dist/services/CallService.d.ts +15 -0
  43. package/dist/services/RtcAdapter.d.ts +11 -0
  44. package/dist/services/RtcService.d.ts +187 -0
  45. package/dist/services/UserProfileService.d.ts +38 -0
  46. package/dist/store/callTimer.d.ts +33 -0
  47. package/dist/store/chatClient.d.ts +5335 -0
  48. package/dist/store/globalCall.d.ts +34 -0
  49. package/dist/store/index.d.ts +1 -0
  50. package/dist/store/rtcChannel.d.ts +42 -0
  51. package/dist/store/types.d.ts +50 -0
  52. package/dist/types/callstate.types.d.ts +61 -0
  53. package/dist/types/signal.types.d.ts +187 -0
  54. package/dist/types.d.ts +103 -0
  55. package/dist/utils/callUtils.d.ts +15 -0
  56. package/dist/utils/imSdkAdapter.d.ts +29 -0
  57. package/dist/utils/index.d.ts +2 -0
  58. package/dist/utils/logger.d.ts +122 -0
  59. package/dist/utils/loggerDb.d.ts +41 -0
  60. package/dist/utils/ringtone.d.ts +20 -0
  61. package/dist/vite-env.d.ts +12 -0
  62. package/package.json +60 -0
@@ -0,0 +1,187 @@
1
+ import { IAgoraRTCClient, IAgoraRTCRemoteUser, ICameraVideoTrack, IMicrophoneAudioTrack, IRemoteAudioTrack, IRemoteVideoTrack, VideoEncoderConfigurationPreset } from 'agora-rtc-sdk-ng';
2
+ export interface RtcServiceConfig {
3
+ appId: string;
4
+ client?: IAgoraRTCClient;
5
+ encoderConfig?: VideoEncoderConfigurationPreset;
6
+ onNetworkQualityChange?: (quality: any) => void;
7
+ onUserJoined?: (userId: string) => void;
8
+ onUserLeft?: (userId: string) => void;
9
+ onUserPublished?: (user: IAgoraRTCRemoteUser, mediaType: 'audio' | 'video') => void;
10
+ onUserUnpublished?: (user: IAgoraRTCRemoteUser, mediaType: 'audio' | 'video') => void;
11
+ onVolumeIndicator?: (volumes: any[]) => void;
12
+ chatClient?: any;
13
+ onAudioEnabledChange?: (enabled: boolean) => void;
14
+ onVideoEnabledChange?: (enabled: boolean) => void;
15
+ onLocalStreamChange?: (stream: MediaStream | null) => void;
16
+ }
17
+ export declare class RtcService {
18
+ private client;
19
+ private appId;
20
+ private agoraUid;
21
+ private localVideoTrack;
22
+ private localAudioTrack;
23
+ private remoteVideoTracks;
24
+ private remoteAudioTracks;
25
+ private localVideoStream;
26
+ private currentCameraDeviceId;
27
+ private encoderConfig;
28
+ private isAudioEnabled;
29
+ private isVideoEnabled;
30
+ private chatClient;
31
+ private autoSubscribe;
32
+ private isActive;
33
+ private uidToUserIdMap;
34
+ private joinedRtcUsers;
35
+ private leftUsers;
36
+ private pendingUserIds;
37
+ private onNetworkQualityChange?;
38
+ private onUserJoined?;
39
+ private onUserLeft?;
40
+ private onUserPublished?;
41
+ private onUserUnpublished?;
42
+ private onVolumeIndicator?;
43
+ private onAudioEnabledChange?;
44
+ private onVideoEnabledChange?;
45
+ private onLocalStreamChange?;
46
+ constructor(config: RtcServiceConfig);
47
+ /**
48
+ * 初始化RTC客户端
49
+ */
50
+ initialize(): Promise<void>;
51
+ /**
52
+ * 更新 appId(支持动态更新)
53
+ */
54
+ setAppId(appId: string): void;
55
+ /**
56
+ * 设置是否自动订阅远程用户
57
+ */
58
+ setAutoSubscribe(enabled: boolean): void;
59
+ /**
60
+ * 加入频道
61
+ */
62
+ joinChannel(channelName: string, token: string | null, uid: number | string, appId?: string): Promise<number | string>;
63
+ /**
64
+ * 离开频道
65
+ */
66
+ leaveChannel(): Promise<void>;
67
+ /**
68
+ * 创建本地音频轨道
69
+ */
70
+ createAudioTrack(): Promise<IMicrophoneAudioTrack>;
71
+ /**
72
+ * 创建本地视频轨道
73
+ */
74
+ createVideoTrack(): Promise<ICameraVideoTrack>;
75
+ /**
76
+ * 发布本地轨道
77
+ */
78
+ publishTracks(tracks: any[]): Promise<void>;
79
+ /**
80
+ * 切换音频状态
81
+ */
82
+ toggleAudio(enabled: boolean): Promise<boolean>;
83
+ /**
84
+ * 切换视频状态
85
+ */
86
+ toggleVideo(enabled: boolean): Promise<boolean>;
87
+ /**
88
+ * 切换摄像头设备
89
+ */
90
+ switchCamera(deviceId: string): Promise<boolean>;
91
+ /**
92
+ * 切换麦克风设备
93
+ */
94
+ switchMicrophone(deviceId: string): Promise<boolean>;
95
+ /**
96
+ * 订阅远程用户
97
+ * 支持传入 IAgoraRTCRemoteUser 对象或 uid(number/string)
98
+ * 当传入 uid 时,SDK 内部会通过 remoteUsers 查找对应的 RemoteUser 实例,
99
+ * 避免事件回调中的 user 对象与 SDK 内部实例引用不一致导致 INVALID_REMOTE_USER
100
+ */
101
+ subscribeRemoteUser(userOrUid: IAgoraRTCRemoteUser | number | string, mediaType: 'audio' | 'video'): Promise<void>;
102
+ /**
103
+ * 获取本地视频流
104
+ */
105
+ getLocalVideoStream(): MediaStream | null;
106
+ /**
107
+ * 获取远程视频轨道(通过userId)
108
+ */
109
+ getRemoteVideoTrack(userId: string): IRemoteVideoTrack | null;
110
+ /**
111
+ * 获取远程音频轨道(通过userId)
112
+ */
113
+ getRemoteAudioTrack(userId: string): IRemoteAudioTrack | null;
114
+ /**
115
+ * 获取本地视频轨道
116
+ */
117
+ getLocalVideoTrack(): ICameraVideoTrack | null;
118
+ getLocalAudioTrack(): IMicrophoneAudioTrack | null;
119
+ /**
120
+ * 检查音频是否静音
121
+ */
122
+ isMuted(): boolean;
123
+ /**
124
+ * 检查摄像头是否开启
125
+ */
126
+ isCameraEnabled(): boolean;
127
+ /**
128
+ * 获取RTC客户端
129
+ */
130
+ getClient(): IAgoraRTCClient | null;
131
+ /**
132
+ * 关闭本地轨道
133
+ */
134
+ private closeLocalTracks;
135
+ /**
136
+ * 添加事件监听
137
+ */
138
+ private addEventListeners;
139
+ /**
140
+ * 取消发布本地轨道
141
+ */
142
+ unpublishTracks(tracks: any[]): Promise<void>;
143
+ /**
144
+ * 取消订阅远程用户
145
+ */
146
+ unsubscribeRemoteUser(userOrUid: IAgoraRTCRemoteUser | number | string, mediaType: 'audio' | 'video'): Promise<void>;
147
+ /**
148
+ * 添加 UID 到 userId 的映射
149
+ */
150
+ setUidToUserIdMapping(uid: string, userId: string): void;
151
+ /**
152
+ * 根据 UID 获取 userId
153
+ */
154
+ getUserIdByUid(uid: string): string | null;
155
+ /**
156
+ * 标记用户已加入 RTC 频道
157
+ */
158
+ markUserJoinedRtc(userId: string): void;
159
+ /**
160
+ * 标记用户离开 RTC 频道
161
+ */
162
+ markUserLeftRtc(userId: string): void;
163
+ /**
164
+ * 检查用户是否已加入 RTC 频道
165
+ */
166
+ isUserInRtc(userId: string): boolean;
167
+ /**
168
+ * 检查用户是否已明确离开
169
+ */
170
+ hasUserLeft(userId: string): boolean;
171
+ /**
172
+ * 添加待加入 RTC 的 userId
173
+ */
174
+ addPendingUserId(userId: string): void;
175
+ /**
176
+ * 获取第一个待加入的 userId 并移除
177
+ */
178
+ popPendingUserId(): string | null;
179
+ /**
180
+ * 重置所有用户状态
181
+ */
182
+ resetUserState(): void;
183
+ /**
184
+ * 销毁RTC服务
185
+ */
186
+ destroy(): Promise<void>;
187
+ }
@@ -0,0 +1,38 @@
1
+ export interface UserProfile {
2
+ userId: string;
3
+ nickname?: string;
4
+ avatarUrl?: string;
5
+ }
6
+ export interface GroupProfile {
7
+ groupId: string;
8
+ groupName?: string;
9
+ groupAvatar?: string;
10
+ }
11
+ export type UserInfoProvider = (userIds: string[]) => Promise<UserProfile[]>;
12
+ export type GroupInfoProvider = (groupIds: string[]) => Promise<GroupProfile[]>;
13
+ /**
14
+ * 注册用户信息查询 Provider
15
+ * 由 EasemobChatCallKitProvider.vue 在初始化时调用
16
+ */
17
+ export declare function registerUserInfoProvider(provider: UserInfoProvider | undefined): void;
18
+ export declare function getUserInfoProvider(): UserInfoProvider | undefined;
19
+ /**
20
+ * 注册群组信息查询 Provider
21
+ */
22
+ export declare function registerGroupInfoProvider(provider: GroupInfoProvider | undefined): void;
23
+ export declare function getGroupInfoProvider(): GroupInfoProvider | undefined;
24
+ /**
25
+ * 通过 Provider 批量解析用户信息
26
+ * 优先读取 GlobalCallStore 缓存,未命中部分调用 Provider,获取后写入缓存
27
+ * @returns 解析后的用户信息,失败时返回 userId 兜底
28
+ */
29
+ export declare function resolveUserProfiles(userIds: string[]): Promise<UserProfile[]>;
30
+ /**
31
+ * 通过 Provider 批量解析群组信息
32
+ * @returns 解析后的群组信息,失败时返回 groupId 兜底
33
+ */
34
+ export declare function resolveGroupProfiles(groupIds: string[]): Promise<GroupProfile[]>;
35
+ /**
36
+ * 清理已注册的 Provider(Provider 卸载时调用)
37
+ */
38
+ export declare function clearProfileProviders(): void;
@@ -0,0 +1,33 @@
1
+ export interface CallTimerState {
2
+ callDuration: number;
3
+ callStartTime: number;
4
+ _timer: any;
5
+ }
6
+ /**
7
+ * CallTimerStore
8
+ * 通话计时器状态(单聊域)
9
+ * 职责:管理一对一通话的时长计时
10
+ */
11
+ export declare const useCallTimerStore: import('pinia').StoreDefinition<"callTimer", CallTimerState, {
12
+ /**
13
+ * 获取格式化的通话时长
14
+ */
15
+ formattedCallDuration(): string;
16
+ }, {
17
+ /**
18
+ * 开始通话计时
19
+ */
20
+ startCallTimer(): void;
21
+ /**
22
+ * 更新通话时长(内部调用)
23
+ */
24
+ updateCallDuration(): void;
25
+ /**
26
+ * 停止通话计时
27
+ */
28
+ stopCallTimer(): void;
29
+ /**
30
+ * 重置计时器状态
31
+ */
32
+ reset(): void;
33
+ }>;