@tcic/core-sdk-v1 1.0.5

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.
@@ -0,0 +1,138 @@
1
+ /**
2
+ * IM消息模块
3
+ */
4
+ import { TCIC } from '../tcic';
5
+ import * as _tim from '@tencentcloud/chat';
6
+ import { TIM_MSG } from '../business.d';
7
+ import { Report } from './report';
8
+ export interface MsgContent {
9
+ Text: string;
10
+ }
11
+ export interface MsgBody {
12
+ MsgType: string;
13
+ MsgContent: MsgContent;
14
+ }
15
+ export interface MsgData {
16
+ GroupId: string;
17
+ CallbackCommand: string;
18
+ From_Account: string;
19
+ Operator_Account: string;
20
+ NickName: string;
21
+ Type: string;
22
+ MsgTime: number;
23
+ MsgSeq: number;
24
+ MsgBody: MsgBody[];
25
+ }
26
+ /**
27
+ *
28
+ * 消息模块
29
+ * @alpha
30
+ */
31
+ export declare class TCIC_IM {
32
+ private authObj;
33
+ tim: _tim.ChatSDK;
34
+ private _ready;
35
+ readonly EVENT: any;
36
+ readonly TYPES: any;
37
+ reportInstance: Report;
38
+ get isReady(): boolean;
39
+ set isReady(val: boolean);
40
+ private _msgHandler;
41
+ /***
42
+ * 传入TCIC实例
43
+ */
44
+ constructor(mainItem: TCIC);
45
+ private msgHanlder;
46
+ /**
47
+ * 切换登陆用户
48
+ * @param tcic - TCIC实例,以切换用户
49
+ */
50
+ changeUser(tcic: TCIC): Promise<any>;
51
+ /**
52
+ * 监听新的消息
53
+ */
54
+ on(eventName: TIM_MSG.MsgType, cb: any): void;
55
+ /**
56
+ * 取消监听,不传callback则取消所有监听
57
+ * @param eventName - 事件名
58
+ * @param cb - 回调
59
+ */
60
+ off(eventName: TIM_MSG.MsgType, cb?: any): void;
61
+ /**
62
+ * 消费掉所有准备的事件函数
63
+ * @param eventName - 事件名
64
+ * @param cb - 回调
65
+ */
66
+ consume(eventName: TIM_MSG.MsgType, param: any): void;
67
+ /**
68
+ * 准备事件,用户进入房间后会触发
69
+ * @param cb - 回调
70
+ */
71
+ whenReady(cb: (arg: TCIC_IM) => void): void;
72
+ login(): Promise<any>;
73
+ destroy(): void;
74
+ sendMsg(payload: any, opts: {
75
+ userId?: string;
76
+ customData?: any;
77
+ isImage?: boolean;
78
+ isCustomMsg?: boolean;
79
+ isRoom?: boolean;
80
+ params?: any;
81
+ }): void;
82
+ /**
83
+ * 业务上暂时只支持文字图片二选一
84
+ * 调试用,客户统一调用后台以指定角色身份发言接口进行发言
85
+ * 如果后面支持,可以补充参数到opts上
86
+ */
87
+ sendRoomMsg(text: string, opts?: {
88
+ customData: any;
89
+ params: any;
90
+ }): void;
91
+ /**
92
+ * 发送图片消息
93
+ * @param file - fileInput对象
94
+ * @param opts - 可选参数
95
+ */
96
+ sendRoomImgMsg(file: File, opts?: {
97
+ customData: any;
98
+ params: any;
99
+ }): void;
100
+ /**
101
+ * 发送自定义消息
102
+ * @param payload - msgPayload
103
+ * @param opts - 可选参数
104
+ */
105
+ sendRoomCustomMsg(payload: {
106
+ data: any;
107
+ extension: string;
108
+ }): void;
109
+ /**
110
+ * 业务上暂时只支持文字图片二选一
111
+ * 如果后面支持,可以补充参数到opts上
112
+ * @param text - 文字
113
+ * @param opts - 可选参数,指定用户一对一发言,或者发送自定义消息
114
+ */
115
+ sendMsgToUser(text: string, opts: {
116
+ userId: string;
117
+ customData: any;
118
+ }): void;
119
+ /**
120
+ * 业务上暂时只支持文字图片二选一
121
+ * 如果后面支持,补充参数到sendMsgToUser即可
122
+ * @param file - 图片
123
+ * @param opts - 可选参数,指定用户一对一发言,或者发送自定义消息
124
+ */
125
+ sendImgToUser(file: File, opts: {
126
+ userId: string;
127
+ customData: any;
128
+ }): void;
129
+ /**
130
+ * 获取历史消息
131
+ * @returns
132
+ */
133
+ getHistoryList(): Promise<MsgData[] | null>;
134
+ /**
135
+ * updateMyProfile
136
+ */
137
+ updateMyProfile(option: Parameters<_tim.ChatSDK['updateMyProfile']>[0]): void;
138
+ }
@@ -0,0 +1,18 @@
1
+ import { ActionModule } from "./actionModule";
2
+ import { ActionName } from "./actionName";
3
+ export declare class Report {
4
+ private static instance;
5
+ private readonly reportUrl;
6
+ private logCache;
7
+ private datanotComplete;
8
+ private logTimer;
9
+ private logInterval;
10
+ private showConsole;
11
+ private constructor();
12
+ setShowConsole(showConsole: boolean): void;
13
+ private getRandomStr;
14
+ static getInstance(): Report;
15
+ log(actionName: ActionName, actionParam: string, actionModule: ActionModule): void;
16
+ serializeReportContent(contents: string[]): string;
17
+ report(): void;
18
+ }
@@ -0,0 +1,9 @@
1
+ import { TCIC } from '../tcic';
2
+ import { Report } from './report';
3
+ export declare class TCIC_TIW {
4
+ tcic: TCIC;
5
+ reportInstance: Report;
6
+ instance: any;
7
+ constructor(tcic: TCIC, domId: string);
8
+ private setUp;
9
+ }
@@ -0,0 +1,237 @@
1
+ import { TCIC } from '../tcic';
2
+ import TRTC from 'trtc-sdk-v5';
3
+ import { Report } from './report';
4
+ import './tcplayer.v4.9.1.min.css';
5
+ import './player.css';
6
+ export type RemoteVideoConfig = Parameters<typeof TRTC.prototype.startRemoteVideo>[0] & {
7
+ useTcPlayer?: boolean;
8
+ _failed?: boolean;
9
+ };
10
+ export type StopRemoteConfig = Parameters<typeof TRTC.prototype.stopRemoteVideo>[0];
11
+ export type TRTCSupportResult = {
12
+ result: boolean;
13
+ detail: {
14
+ isBrowserSupported: boolean;
15
+ isWebRTCSupported: boolean;
16
+ isWebCodecsSupported: boolean;
17
+ isMediaDevicesSupported: boolean;
18
+ isScreenShareSupported: boolean;
19
+ isSmallStreamSupported: boolean;
20
+ isH264EncodeSupported: boolean;
21
+ isVp8EncodeSupported: boolean;
22
+ isH264DecodeSupported: boolean;
23
+ isVp8DecodeSupported: boolean;
24
+ };
25
+ };
26
+ export type Av = 'audio' | 'video';
27
+ export interface ITRTC {
28
+ enterRoom(): Promise<void>;
29
+ stopRemote(opts: StopRemoteConfig): Promise<void>;
30
+ /**
31
+ * 查看远端画面,声音
32
+ * @param opts - 传入希望查看的用户ID
33
+ */
34
+ startRemote(opts: RemoteVideoConfig): Promise<boolean>;
35
+ /**
36
+ * 开始播放本地音视频,默认不自动发布
37
+ */
38
+ localPreview(opts: {
39
+ view: string | HTMLDivElement;
40
+ publish?: boolean;
41
+ frameRate?: number;
42
+ portrait?: boolean | string;
43
+ option?: {
44
+ cameraId?: string;
45
+ useFrontCamera?: boolean;
46
+ fillMode?: 'contain' | 'cover' | 'fill';
47
+ mirror?: boolean | string;
48
+ };
49
+ }): any;
50
+ /**
51
+ * 停止本地预览
52
+ */
53
+ stopLocalPreview(opts?: {
54
+ audio?: boolean;
55
+ video?: boolean;
56
+ }): void;
57
+ /**
58
+ * 取消发布本地流
59
+ */
60
+ unPublish(): void;
61
+ /**
62
+ * 恢复发布内容
63
+ */
64
+ resumePublish(opts: {
65
+ target: Av[];
66
+ }): void;
67
+ /**
68
+ * 关闭音视频
69
+ */
70
+ mute(opts: {
71
+ target: Av[];
72
+ }): void;
73
+ /**
74
+ * 开启音视频
75
+ */
76
+ unmute(opts: {
77
+ target: Av[];
78
+ }): void;
79
+ leaveRoom(): void;
80
+ /**
81
+ * 快直播部分播放功能
82
+ * todo:待完善
83
+ */
84
+ destroy(): void;
85
+ switchCamera(option: {
86
+ cameraId?: string;
87
+ useFrontCamera?: boolean;
88
+ mirror?: string | boolean | undefined;
89
+ }): void;
90
+ switchMic(option: {
91
+ micId: string;
92
+ }): void;
93
+ }
94
+ export declare class TCIC_TRTC implements ITRTC {
95
+ tcic: TCIC;
96
+ ready: Promise<boolean>;
97
+ reportInstance: Report;
98
+ /***
99
+ * 传入TCIC实例
100
+ */
101
+ private client;
102
+ remoteStarts: Map<string, {
103
+ opts: RemoteVideoConfig;
104
+ }>;
105
+ constructor(mainItem: TCIC);
106
+ init(): Promise<boolean>;
107
+ getTrtcInstance(): TRTC;
108
+ enterRoom(): Promise<void>;
109
+ private _rtcInfoInterval;
110
+ private _tcPlayerInsMap;
111
+ private _remoteReady;
112
+ private _rtcPlayState;
113
+ private _rtcRemoteVideoReady;
114
+ private _playMode;
115
+ private _hasEnterTrtcRoom;
116
+ private _lastTRTCRemoteConfig;
117
+ private _tcplayerTempContainerId;
118
+ /**
119
+ * 似乎是监控当前RTC流的状况
120
+ */
121
+ /**
122
+ * 希望看到某个用户的画面
123
+ */
124
+ private _isSupportedResult;
125
+ isSupported(): Promise<TRTCSupportResult | null>;
126
+ updateRemote(opts: RemoteVideoConfig): Promise<void>;
127
+ stopRemote(opts: StopRemoteConfig): Promise<void>;
128
+ /**
129
+ * 销毁tcplayer实例
130
+ * @param id
131
+ */
132
+ destroyTcPlayer(id: string): void;
133
+ /**
134
+ * 获取player实例
135
+ * @param userId
136
+ * @param streamType
137
+ */
138
+ getTcPlayerInstance({ userId, streamType, }: {
139
+ userId: string;
140
+ streamType: string;
141
+ }): any;
142
+ /**
143
+ * 判断配置是否一致
144
+ * @param conf1
145
+ * @param conf2
146
+ */
147
+ isSameConfig(conf1: any, conf2: any): boolean;
148
+ /**
149
+ * 远端流是否ok
150
+ */
151
+ checkRemoteReady(userId: string): Promise<unknown>;
152
+ createTempTcplayerCont(): HTMLElement;
153
+ /**
154
+ * 启用旧的tcplayer实例
155
+ */
156
+ reuseTcPlayer(streamId: string, dom: any): void;
157
+ /**
158
+ * 把tcplayer实例暂时弃用
159
+ */
160
+ unuseTcPlayer(streamId: string): void;
161
+ getTcPlayerContId(streamId: string): string;
162
+ isInWeixinEnv(): boolean;
163
+ doWeixinFirstPlay(tcPlayerIns: any): void;
164
+ /**
165
+ * 查看远端画面,声音
166
+ * @param opts - 传入希望查看的用户ID
167
+ */
168
+ startRemote(opts: RemoteVideoConfig): Promise<boolean>;
169
+ /**
170
+ * 开始播放本地音视频,默认不自动发布
171
+ */
172
+ localPreview(opts: {
173
+ view: string | HTMLDivElement;
174
+ publish?: boolean;
175
+ frameRate?: number;
176
+ portrait?: boolean | string;
177
+ option?: {
178
+ cameraId?: string;
179
+ useFrontCamera?: boolean;
180
+ fillMode?: 'contain' | 'cover' | 'fill';
181
+ mirror?: boolean | string;
182
+ };
183
+ }): Promise<void>;
184
+ /**
185
+ * 停止本地预览
186
+ */
187
+ stopLocalPreview(opts?: {
188
+ audio?: boolean;
189
+ video?: boolean;
190
+ }): Promise<void>;
191
+ /**
192
+ * 发布本地流
193
+ */
194
+ /**
195
+ * 取消发布本地流
196
+ */
197
+ unPublish(): Promise<void>;
198
+ /**
199
+ * 暂停发布内容,不会退出房间
200
+ */
201
+ /**
202
+ * 恢复发布内容
203
+ */
204
+ resumePublish(opts: {
205
+ target: Av[];
206
+ }): Promise<void>;
207
+ /**
208
+ * 关闭音视频
209
+ */
210
+ mute(opts: {
211
+ target: Av[];
212
+ }): Promise<void>;
213
+ /**
214
+ * 开启音视频
215
+ */
216
+ unmute(opts: {
217
+ target: Av[];
218
+ }): Promise<void>;
219
+ leaveRoom(): Promise<void>;
220
+ /**
221
+ * 快直播部分播放功能
222
+ * todo:待完善
223
+ */
224
+ destroy(): Promise<void>;
225
+ getCameraList(): Promise<MediaDeviceInfo[]>;
226
+ switchCamera(option: {
227
+ cameraId?: string;
228
+ useFrontCamera?: boolean;
229
+ mirror?: string | boolean | undefined;
230
+ }): Promise<void>;
231
+ getMicList(): Promise<MediaDeviceInfo[]>;
232
+ switchMic(option: {
233
+ micId: string;
234
+ }): Promise<void>;
235
+ getSpeakerList(): Promise<MediaDeviceInfo[]>;
236
+ setCurrentSpeaker(speakerId: string): Promise<void>;
237
+ }