quickvo-sdk-js 1.5.17 → 1.6.0

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 (45) hide show
  1. package/README.md +32 -32
  2. package/dist/QuickVO.d.ts +64 -24
  3. package/dist/action/ActionBase.d.ts +9 -0
  4. package/dist/action/ActionP2P.d.ts +12 -0
  5. package/dist/action/ActionSFU.d.ts +125 -0
  6. package/dist/base/Base.d.ts +54 -0
  7. package/dist/base/modules/Config.d.ts +126 -0
  8. package/dist/base/modules/LocalMedias.d.ts +85 -0
  9. package/dist/base/modules/Notifys.d.ts +41 -0
  10. package/dist/base/modules/Peer.d.ts +55 -0
  11. package/dist/base/modules/Traffic.d.ts +21 -0
  12. package/dist/base/modules/cws/CallsWebSocket.d.ts +57 -0
  13. package/dist/base/modules/cws/CallsWebSocketEvent.d.ts +38 -0
  14. package/dist/{room → base/modules/cws}/PrResolves.d.ts +4 -5
  15. package/dist/base/modules/users/Users.d.ts +146 -0
  16. package/dist/base/modules/users/modules/LocalTrackAnalysis.d.ts +18 -0
  17. package/dist/base/modules/users/modules/LocalUser.d.ts +32 -0
  18. package/dist/base/modules/users/modules/RemotePeerTrackAnalysis.d.ts +18 -0
  19. package/dist/base/modules/users/modules/RemoteUser.d.ts +75 -0
  20. package/dist/base/modules/users/modules/RemoteUserP2P.d.ts +84 -0
  21. package/dist/base/modules/users/modules/UserBase.d.ts +178 -0
  22. package/dist/enums/eventName.d.ts +15 -18
  23. package/dist/enums/mediaType.d.ts +4 -4
  24. package/dist/enums/notifyName.d.ts +5 -20
  25. package/dist/enums/roomState.d.ts +1 -3
  26. package/dist/index.js +23200 -22917
  27. package/dist/index.umd.cjs +3 -3
  28. package/dist/protos/compiled.d.ts +7175 -6921
  29. package/dist/protos/protoEvent.d.ts +194 -4
  30. package/dist/tools.d.ts +0 -2
  31. package/dist/types.d.ts +65 -155
  32. package/package.json +7 -7
  33. package/dist/enums/iceState.d.ts +0 -16
  34. package/dist/pr-analysis-for-webrtc/PrPeerAnalysis.d.ts +0 -49
  35. package/dist/pr-analysis-for-webrtc/PrPeerAnalysisItem.d.ts +0 -55
  36. package/dist/room/CallsWebSocket.d.ts +0 -63
  37. package/dist/room/P2P.d.ts +0 -111
  38. package/dist/room/Room.d.ts +0 -5
  39. package/dist/room/RoomBase.d.ts +0 -154
  40. package/dist/room/RoomCalls.d.ts +0 -176
  41. package/dist/room/RoomMedias.d.ts +0 -136
  42. package/dist/room/RoomPeer.d.ts +0 -111
  43. package/dist/room/RoomUsers.d.ts +0 -214
  44. package/dist/room/VideoMediaContext.d.ts +0 -23
  45. /package/dist/{room → base/modules}/StreamRecorder.d.ts +0 -0
package/README.md CHANGED
@@ -30,10 +30,10 @@
30
30
 
31
31
  ```ts
32
32
  type T_mediaType = {
33
- readonly microphoneCamera_audio: '麦克风-默认轨道'
34
- readonly microphoneCamera_video: '摄像头-默认轨道'
35
- readonly screenSharing_video: '屏幕共享-视频轨道'
36
- readonly screenSharing_audio: '屏幕共享-音频轨道'
33
+ readonly mc_audio: '麦克风-默认轨道'
34
+ readonly mc_video: '摄像头-默认轨道'
35
+ readonly ss_video: '屏幕共享-视频轨道'
36
+ readonly ss_audio: '屏幕共享-音频轨道'
37
37
  }
38
38
  type K_mediaType = keyof T_mediaType
39
39
  ```
@@ -216,11 +216,11 @@ export const quickvo = new QuickVO({ appid: 'A6B499768801DJT8ACA11E5F842DB6DF' }
216
216
 
217
217
  ```vue
218
218
  <template>
219
- <video ref="microphoneCamera_audio_ref"></video>
219
+ <video ref="mc_audio_ref"></video>
220
220
  </template>
221
221
 
222
222
  <script setup lang="ts">
223
- const microphoneCamera_audio_ref = ref<HTMLVideoElement>()
223
+ const mc_audio_ref = ref<HTMLVideoElement>()
224
224
  </script>
225
225
  ```
226
226
 
@@ -239,9 +239,9 @@ quickvo.addNotify({
239
239
  const { id, updateStreams } = user
240
240
 
241
241
  // 需要更新 麦克风
242
- if (updateStreams['microphoneCamera_audio']) {
243
- const stream = await quickvo.getUserStream(id, 'microphoneCamera_audio')
244
- const dom = microphoneCamera_audio_ref.value // 当然 如果你使用原生js,那么这里也只需要拿到对应的dom
242
+ if (updateStreams['mc_audio']) {
243
+ const stream = await quickvo.getUserStream(id, 'mc_audio')
244
+ const dom = mc_audio_ref.value // 当然 如果你使用原生js,那么这里也只需要拿到对应的dom
245
245
  dom.srcObject = stream
246
246
 
247
247
  // 下面的几行代码是非必须的 但是还是建议这样做 先暂停再播放 防止重复赋值播放带来的警告或异常错误
@@ -252,13 +252,13 @@ quickvo.addNotify({
252
252
  }
253
253
  }
254
254
 
255
- if (updateStreams['microphoneCamera_video']) {
255
+ if (updateStreams['mc_video']) {
256
256
  // ...
257
257
  }
258
- if (updateStreams['screenSharing_audio']) {
258
+ if (updateStreams['ss_audio']) {
259
259
  // ...
260
260
  }
261
- if (updateStreams['screenSharing_video']) {
261
+ if (updateStreams['ss_video']) {
262
262
  // ...
263
263
  }
264
264
  }
@@ -269,22 +269,22 @@ quickvo.addNotify({
269
269
 
270
270
  - 通常如果应用层需要实现本地预览麦克风、摄像头等待发布的媒体流时,你可以尝试调用该 api,目前支持开启以下四种类型:
271
271
 
272
- 1. 麦克风 microphoneCamera_audio
273
- 2. 摄像头 microphoneCamera_video
274
- 3. 屏幕音频 screenSharing_audio (由于浏览器内部机制,不能单独选择该媒体,因此在选择屏幕音频时,直接设置共享屏幕音视频)
275
- 4. 屏幕视频 screenSharing_video (如果你需要单独共享屏幕画面 而不共享屏幕音频才考虑选择该类型,更多的建议直接开启 screenSharing_audio 然后主动控制流媒体的发布、暂停)
272
+ 1. 麦克风 mc_audio
273
+ 2. 摄像头 mc_video
274
+ 3. 屏幕音频 ss_audio (由于浏览器内部机制,不能单独选择该媒体,因此在选择屏幕音频时,直接设置共享屏幕音视频)
275
+ 4. 屏幕视频 ss_video (如果你需要单独共享屏幕画面 而不共享屏幕音频才考虑选择该类型,更多的建议直接开启 ss_audio 然后主动控制流媒体的发布、暂停)
276
276
 
277
277
  ```ts
278
278
  /**
279
279
  * 设置本地流
280
280
  * @param mediaType MediaType
281
281
  * @param active 激活状态
282
- * @example quickvo.setLocalStream(['microphoneCamera_audio'], false)
282
+ * @example quickvo.setLocalStream(['mc_audio'], false)
283
283
  * @returns Promise<Streams>
284
284
  */
285
- quickvo.setLocalStream(['microphoneCamera_audio'], true).then((streams) => {
285
+ quickvo.setLocalStream(['mc_audio'], true).then((streams) => {
286
286
  // 因考虑到易用性(与 onLocalStream 保持一致) 这里会返回所有本地流对象
287
- const stream = streams['microphoneCamera_audio']
287
+ const stream = streams['mc_audio']
288
288
  // 拿到所需要的 stream 然后进行渲染 (这里以原生js使用方式作为参考)
289
289
  document.querySelector<HTMLVideoElement>('#my-dom-view')?.srcObject = stream
290
290
  })
@@ -314,15 +314,15 @@ quickvo.joinRoom(options)
314
314
  * 发布流
315
315
  * @param mediaTypes MediaType[]
316
316
  * @param count 发布失败重试次数
317
- * @example quickvo.publish(['microphoneCamera_audio', 'microphoneCamera_video'], 3)
317
+ * @example quickvo.publish(['mc_audio', 'mc_video'], 3)
318
318
  * @returns Promise<RoomUser>
319
319
  */
320
- quickvo.publish(['microphoneCamera_audio', 'microphoneCamera_video'], 3).then((user) => {
320
+ quickvo.publish(['mc_audio', 'mc_video'], 3).then((user) => {
321
321
  const { id, updateStreams } = user
322
322
  // 需要更新 麦克风
323
- if (updateStreams['microphoneCamera_audio']) {
324
- const stream = await quickvo.getUserStream(id, 'microphoneCamera_audio')
325
- const dom = microphoneCamera_audio_ref.value // 当然 如果你使用原生js,那么这里也只需要拿到对应的dom
323
+ if (updateStreams['mc_audio']) {
324
+ const stream = await quickvo.getUserStream(id, 'mc_audio')
325
+ const dom = mc_audio_ref.value // 当然 如果你使用原生js,那么这里也只需要拿到对应的dom
326
326
  dom.srcObject = stream
327
327
  }
328
328
  })
@@ -344,9 +344,9 @@ quickvo.subscribe(['123']).then((users) => {
344
344
  for (const user of users) {
345
345
  const { id, updateStreams } = user
346
346
  // 需要更新 麦克风
347
- if (updateStreams['microphoneCamera_audio']) {
348
- const stream = await quickvo.getUserStream(id, 'microphoneCamera_audio')
349
- const dom = microphoneCamera_audio_ref.value // 当然 如果你使用原生js,那么这里也只需要拿到对应的dom
347
+ if (updateStreams['mc_audio']) {
348
+ const stream = await quickvo.getUserStream(id, 'mc_audio')
349
+ const dom = mc_audio_ref.value // 当然 如果你使用原生js,那么这里也只需要拿到对应的dom
350
350
  dom.srcObject = stream
351
351
  }
352
352
  }
@@ -421,8 +421,8 @@ quickvo.quitRoom()
421
421
 
422
422
  以下是升级指南:
423
423
  在任何调用 inactiveTracks 的地方 全部修改为 pauseTracks。( 注意:第二个参数 boolean 相反 前者描述的是启用什么轨道 后者描述的是暂停什么轨道 )
424
- 如 quickvo.inactiveTracks(['microphoneCamera_video'], false) // 冻结视频轨道
425
- 修改为 quickvo.pauseTracks。(['microphoneCamera_video'], true) // 暂停视频轨道
424
+ 如 quickvo.inactiveTracks(['mc_video'], false) // 冻结视频轨道
425
+ 修改为 quickvo.pauseTracks。(['mc_video'], true) // 暂停视频轨道
426
426
 
427
427
 
428
428
  ```
@@ -440,18 +440,18 @@ quickvo.quitRoom()
440
440
  由原来的
441
441
  quickvo.subscribe(['trackName1','trackName2'])
442
442
  调整为
443
- quickvo.subscribe([{ userId: '123', mediaTypes: ['microphoneCamera_audio', 'microphoneCamera_video'] }])
443
+ quickvo.subscribe([{ userId: '123', mediaTypes: ['mc_audio', 'mc_video'] }])
444
444
 
445
445
  由原来的
446
446
  quickvo.stopSubscribe(['trackName1','trackName2'])
447
447
  调整为
448
- quickvo.stopSubscribe([{ userId: '123', mediaTypes: ['microphoneCamera_audio', 'microphoneCamera_video'] }])
448
+ quickvo.stopSubscribe([{ userId: '123', mediaTypes: ['mc_audio', 'mc_video'] }])
449
449
 
450
450
  SDK内部提供了方便开发者升级的api:
451
451
  /**
452
452
  * getUsersMediaTypeBytrackNames
453
453
  * @param trackNames string[]
454
- * @returns [{ userId: '123', mediaTypes: ['mediaTypes', 'microphoneCamera_video'] }]
454
+ * @returns [{ userId: '123', mediaTypes: ['mediaTypes', 'mc_video'] }]
455
455
  */
456
456
 
457
457
  const usersMediaType = quickvo.getUsersMediaTypeBytrackNames(['trackName1','trackName2'])
package/dist/QuickVO.d.ts CHANGED
@@ -1,28 +1,68 @@
1
- import { Room } from './room/Room';
2
- import { Notify, QuickOptions } from './types';
3
- export declare class QuickVO extends Room {
4
- #private;
1
+ import { QuickOptions } from './types';
2
+ export declare class QuickVO {
3
+ private _base;
4
+ private _ACTION_BASE;
5
+ private _ACTION_SFU;
6
+ private _ACTION_P2P;
5
7
  constructor(options: QuickOptions);
6
- /**
7
- * addNotify
8
- * @param notify Notify
9
- * @returns sn
10
- */
11
- addNotify: (notify: Notify) => string;
12
- /**
13
- * add FrameRequestCallback
14
- * @param key string
15
- * @param func FrameRequestCallback
16
- */
8
+ recorder: import('./base/modules/StreamRecorder').StreamRecorder;
17
9
  addRequestAnimationFrame: (key: string, func: FrameRequestCallback) => Promise<void>;
18
- /**
19
- * clear FrameRequestCallback
20
- * @param keys string[] = []
21
- */
22
10
  clearRequestAnimationFrame: (keys?: string[]) => Promise<number[]>;
23
- /**
24
- * destroy
25
- * @example quickvo.destroy()
26
- */
27
- destroy: () => Promise<void>;
11
+ addNotify: (notify: {
12
+ sn?: string;
13
+ event: "onJoinRoom" | "onQuitRoom" | "onBeforeTokenExpire" | "onTokenExpired" | "onDestroyRoom" | "onCDNPlayUrlAdd" | "onRoomUserSpeech" | "onRoomUsers" | "onRoomNetwork" | "onPeerState" | "onRoomState";
14
+ callback?: (e: any) => void;
15
+ }) => string;
16
+ setOptions: (options: QuickOptions) => void;
17
+ getLocalStream: (mediaType: import('./enums/mediaType').K_mediaType) => MediaStream;
18
+ getLocalStreams: () => {
19
+ mc_audio: MediaStream;
20
+ mc_video: MediaStream;
21
+ ss_video: MediaStream;
22
+ ss_audio: MediaStream;
23
+ };
24
+ setActiveNoise: (mediaType: import('./enums/mediaType').K_mediaType, state: boolean) => void;
25
+ getUserContent: (userId?: string) => import('./base/modules/users/modules/LocalUser').LocalUser | import('./base/modules/users/modules/RemoteUser').RemoteUser | undefined;
26
+ getUserStream: (userId: string, mediaType: import('./enums/mediaType').K_mediaType) => MediaStream | undefined;
27
+ getVolume: (userId: string, mediaType: import('./enums/mediaType').K_mediaType) => number | undefined;
28
+ getMaxVolumeUser: () => {
29
+ id: string;
30
+ volume: number;
31
+ } | undefined;
32
+ setInputVolume: (userId: string, mediaType: import('./enums/mediaType').K_mediaType, gain: number) => void;
33
+ setEnhanceGain: (userId: string, mediaType: import('./enums/mediaType').K_mediaType, gain: number) => Promise<void>;
34
+ setSpeakerVolume: (userId: string, mediaType: import('./enums/mediaType').K_mediaType, gain: number) => void;
35
+ getUserAudioMediaStreamContext: (userId: string, mediaType: import('./enums/mediaType').K_mediaType) => import('pr-audio-stream').PrAudioStream | undefined;
36
+ getEnumerateDevices: (mediaDeviceKind: MediaDeviceKind) => Promise<MediaDeviceInfo[]>;
37
+ getMediaDevicesErrInfo: () => Promise<{
38
+ mc_audio: string;
39
+ mc_video: string;
40
+ }>;
41
+ setCallStrategy: (callStrategy: import('./enums/callStrategy').K_callStrategy, mediaTypes?: import('./enums/mediaType').K_mediaType[]) => Promise<void>;
42
+ getReportsByMid: () => never[];
43
+ setLocalStream: (mediaTypes: import('./enums/mediaType').K_mediaType[], active: boolean) => Promise<unknown>;
44
+ setMediaDeviceKind: (mediaDeviceKind: MediaDeviceKind, deviceId: string | undefined) => Promise<unknown>;
45
+ setMediaTrackConstraints: (mediaType: import('./enums/mediaType').K_mediaType, constraints: MediaTrackConstraints) => Promise<void>;
46
+ earlyConnect: (mediaTypes?: import('./enums/mediaType').K_mediaType[]) => Promise<unknown>;
47
+ joinRoom: (roomOptions: import('./types').RoomOptions) => Promise<unknown>;
48
+ publish: (mediaTypes: import('./enums/mediaType').K_mediaType[]) => Promise<boolean>;
49
+ stopPublish: (mediaTypes: import('./enums/mediaType').K_mediaType[]) => Promise<boolean>;
50
+ pauseTracks: (mediaTypes: import('./enums/mediaType').K_mediaType[], pause: boolean) => Promise<boolean>;
51
+ subscribe: (usersMediaTypes?: import('./types').UserMediaTypes[]) => Promise<unknown>;
52
+ stopSubscribe: (usersMediaTypes?: import('./types').UserMediaTypes[]) => Promise<boolean>;
53
+ toggleRoomSpeechLang: (data: {
54
+ input: string;
55
+ output: string;
56
+ translateEnable?: boolean;
57
+ }) => void;
58
+ updateToken: (sdkToken: string) => void;
59
+ quitRoom: () => Promise<boolean>;
60
+ quitRoomEx: () => Promise<boolean>;
61
+ destroy: () => void;
62
+ getLocalUserTrackReports: (mediaType: import('./enums/mediaType').K_mediaType) => import('./types').TrackReport;
63
+ getRemoteUserTrackReports: (userId: string, origin: "sfu" | "p2p", direction: "sends" | "recvs", mediaType: import('./enums/mediaType').K_mediaType) => import('./types').TrackReport | undefined;
64
+ _openP2P: (remoteUserId: string, mediaTypes: import('./enums/mediaType').K_mediaType[], isRemotePush: boolean) => Promise<unknown>;
65
+ _restoreRoom: () => Promise<void>;
66
+ _debugger: () => Promise<void>;
67
+ _ai: () => Promise<void>;
28
68
  }
@@ -0,0 +1,9 @@
1
+ import { Base } from '../base/Base';
2
+ export declare class ActionBase {
3
+ base: Base;
4
+ constructor({ base }: {
5
+ base: Base;
6
+ });
7
+ _debugger: () => Promise<void>;
8
+ _ai: () => Promise<void>;
9
+ }
@@ -0,0 +1,12 @@
1
+ import { K_mediaType } from '../enums/mediaType';
2
+ import { Base } from '../base/Base';
3
+ export declare class ActionP2P {
4
+ base: Base;
5
+ constructor({ base }: {
6
+ base: Base;
7
+ });
8
+ _openP2P: (remoteUserId: string, mediaTypes: K_mediaType[], isRemotePush: boolean) => Promise<unknown>;
9
+ private _onOffer;
10
+ private _onCandidate;
11
+ private _getRemoteUserP2PContent;
12
+ }
@@ -0,0 +1,125 @@
1
+ import { K_mediaType } from '../enums/mediaType';
2
+ import { RoomOptions, UserMediaTypes } from '../types';
3
+ import { Base } from '../base/Base';
4
+ export declare class ActionSFU {
5
+ base: Base;
6
+ constructor({ base }: {
7
+ base: Base;
8
+ });
9
+ /**
10
+ * setLocalStream
11
+ * @param mediaTypes K_mediaType[]
12
+ * @param active boolean
13
+ */
14
+ setLocalStream: (mediaTypes: K_mediaType[], active: boolean) => Promise<unknown>;
15
+ /**
16
+ * setMediaDeviceKind
17
+ * @param mediaDeviceKind "audioinput" | "audiooutput" | "videoinput"
18
+ * @param deviceId string | undefined
19
+ */
20
+ setMediaDeviceKind: (mediaDeviceKind: MediaDeviceKind, deviceId: string | undefined) => Promise<unknown>;
21
+ /**
22
+ * setMediaTrackConstraints
23
+ * @param mediaType K_mediaType
24
+ * @param constraints MediaTrackConstraints
25
+ */
26
+ setMediaTrackConstraints: (mediaType: K_mediaType, constraints: MediaTrackConstraints) => Promise<void>;
27
+ /**
28
+ * earlyConnect
29
+ * @param mediaTypes ("mc_audio" | "mc_video" | "ss_video" | "ss_audio")[]
30
+ */
31
+ earlyConnect: (mediaTypes?: K_mediaType[]) => Promise<unknown>;
32
+ /**
33
+ * joinRoom
34
+ * @param roomOptions RoomOptions
35
+ * @example quickvo.joinRoom({ userId: '', roomId: '', sdkToken: '', callType: '1' , newPublishAutoSubscribe: true })
36
+ * @returns Promise<boolean>
37
+ */
38
+ joinRoom: (roomOptions: RoomOptions) => Promise<unknown>;
39
+ /**
40
+ * publish
41
+ * @param mediaTypes MediaType[]
42
+ * @example quickvo.publish(['mc_audio', 'mc_video'])
43
+ */
44
+ publish: (mediaTypes: K_mediaType[]) => Promise<boolean>;
45
+ /**
46
+ * stopPublish
47
+ * @param trackNames string[] = []
48
+ * @example quickvo.stopPublish(['mc_audio'])
49
+ */
50
+ stopPublish: (mediaTypes: K_mediaType[]) => Promise<boolean>;
51
+ /**
52
+ * pauseTracks
53
+ * @param mediaTypes MediaType[]
54
+ * @param pause boolean
55
+ * @example quickvo.pauseTracks(['mc_audio'], true)
56
+ */
57
+ pauseTracks: (mediaTypes: K_mediaType[], pause: boolean) => Promise<boolean>;
58
+ /**
59
+ * subscribe
60
+ * @param usersMediaTypes: UserMediaTypes[] = [] 不传入订阅所有
61
+ * @example quickvo.subscribe([{ userId: '123', mediaTypes: ['mc_audio', 'mc_video'] }])
62
+ */
63
+ subscribe: (usersMediaTypes?: UserMediaTypes[]) => Promise<unknown>;
64
+ /**
65
+ * stopSubscribe
66
+ * @param usersMediaTypes: UserMediaTypes[] = [] 不传入取消订阅所有
67
+ * @example quickvo.stopSubscribe([{ userId: '123', mediaTypes: ['mc_audio', 'mc_video'] }])
68
+ * @returns Promise<boolean>
69
+ */
70
+ stopSubscribe: (usersMediaTypes?: UserMediaTypes[]) => Promise<boolean>;
71
+ /**
72
+ * quitRoom
73
+ * @example quickvo.quitRoom()
74
+ * @returns Promise<boolean>
75
+ */
76
+ quitRoom: () => Promise<boolean>;
77
+ /**
78
+ * quitRoom and continuously open the connection
79
+ * @example quickvo.quitRoomEx()
80
+ * @returns Promise<boolean>
81
+ */
82
+ quitRoomEx: () => Promise<boolean>;
83
+ /**
84
+ * setBanBehaviors
85
+ * @param usersBehaviors Array<{ id: string; banBehaviors: { [key in K_mediaType]?: boolean } }>
86
+ */
87
+ setBanBehaviors: (usersBehaviors: Array<{
88
+ id: string;
89
+ banBehaviors: { [key in K_mediaType]?: boolean; };
90
+ }>) => Promise<unknown>;
91
+ /**
92
+ * toggleRoomSpeechLang
93
+ * @param data { input: string; output: string; translateEnable?: boolean }
94
+ */
95
+ toggleRoomSpeechLang: (data: {
96
+ input: string;
97
+ output: string;
98
+ translateEnable?: boolean;
99
+ }) => void;
100
+ /**
101
+ * updateToken
102
+ * @param sdkToken string
103
+ */
104
+ updateToken: (sdkToken: string) => void;
105
+ /**
106
+ * destroy
107
+ */
108
+ destroy: () => void;
109
+ private _connectCws;
110
+ private _initHeartbeat;
111
+ private _connectCF;
112
+ private _createTrack;
113
+ private _closeTrack;
114
+ private _pubNotify;
115
+ private _renegotiate;
116
+ private _ackMsg;
117
+ private _notifySelfCallAction;
118
+ private _calculateNetwork;
119
+ private _checkAndSelectUserStreamOrigin;
120
+ private _reportNetwork;
121
+ private _hasAsyncTask;
122
+ private _syncRoomInfo;
123
+ private _restorePeer;
124
+ _restoreRoom: () => Promise<void>;
125
+ }
@@ -0,0 +1,54 @@
1
+ import { Config } from './modules/Config';
2
+ import { Traffic } from './modules/Traffic';
3
+ import { Notifys } from './modules/Notifys';
4
+ import { Users } from './modules/users/Users';
5
+ import { PrIntervalQueue } from 'pr-interval-queue';
6
+ import { LocalMedias } from './modules/LocalMedias';
7
+ import { Peer } from './modules/Peer';
8
+ import { CallsWebSocket } from './modules/cws/CallsWebSocket';
9
+ import { StreamRecorder } from './modules/StreamRecorder';
10
+ import { PrAsyncQueue } from 'pr-async-queue';
11
+ import { K_roomState } from '../enums/roomState';
12
+ import { K_mediaType } from '../enums/mediaType';
13
+ type Report_Log_Type = 'ws_c_timeout' | 'webrtc_c_timeout' | 'join_room_error' | 'publish_error' | 'subscribe_error' | 'close_track_error' | 'heartbeat_e_timeout' | 'heartbeat_i_timeout' | 'quit_room_error';
14
+ export declare class Base {
15
+ config: Config;
16
+ notifys: Notifys;
17
+ localMedias: LocalMedias;
18
+ intervalQueue: PrIntervalQueue;
19
+ asyncQueue: PrAsyncQueue;
20
+ traffic: Traffic;
21
+ recorder: StreamRecorder;
22
+ users: Users;
23
+ cws: CallsWebSocket;
24
+ peer: Peer;
25
+ private _requestAnimationFrameMap;
26
+ constructor();
27
+ setRoomState: (state: K_roomState) => void;
28
+ setPeerState: (state: RTCPeerConnectionState) => void;
29
+ /**
30
+ * add FrameRequestCallback
31
+ * @param key string
32
+ * @param func FrameRequestCallback
33
+ */
34
+ addRequestAnimationFrame: (key: string, func: FrameRequestCallback) => Promise<void>;
35
+ /**
36
+ * clear FrameRequestCallback
37
+ * @param keys string[] = []
38
+ */
39
+ clearRequestAnimationFrame: (keys?: string[]) => Promise<number[]>;
40
+ _checkUserStreamOrigin: ({ p2pAverageQuality, sfuAverageQuality }: {
41
+ p2pAverageQuality: number;
42
+ sfuAverageQuality: number;
43
+ }) => "sfu" | "p2p";
44
+ _reportP2PConnect: (state: "success" | "fail" | "ignore" | "disconnect" | "poor_network", data: {
45
+ action?: 0 | 1 | 2 | 3;
46
+ pullId: string;
47
+ pushId: string;
48
+ mediaTypes: K_mediaType[];
49
+ desc?: string;
50
+ connectedTime?: string;
51
+ }) => Promise<Pick<import('../protos/protoEvent').MessageRsp<"reportP2PConnectEx">, "sn" | "event" | "data" | "code" | "desc">>;
52
+ _reportLog: (_type: Report_Log_Type, describe?: string) => void;
53
+ }
54
+ export {};
@@ -0,0 +1,126 @@
1
+ import { QuickOptions, RoomOptions } from '../../types';
2
+ import { K_roomState } from '../../enums/roomState';
3
+ export declare class Config {
4
+ /**
5
+ * 信令服务地址
6
+ */
7
+ url: string;
8
+ /**
9
+ * 应用ID
10
+ */
11
+ appid: string;
12
+ /**
13
+ * 是否开启调试模式
14
+ */
15
+ debug: boolean;
16
+ /**
17
+ * 是否上报错误信息
18
+ */
19
+ reportErr: boolean;
20
+ /**
21
+ * 日志上报地址
22
+ */
23
+ logUrl: string;
24
+ /**
25
+ * SDK凭证
26
+ */
27
+ sdkToken: string;
28
+ /**
29
+ * 房间ID
30
+ */
31
+ roomId: string;
32
+ /**
33
+ * 用户ID
34
+ */
35
+ userId: string;
36
+ /**
37
+ * 通讯类型
38
+ */
39
+ callType: number;
40
+ /**
41
+ * 是否开启语音翻译
42
+ */
43
+ stt: boolean;
44
+ /**
45
+ * 语音翻译 语言选择
46
+ */
47
+ lang: {
48
+ input: string;
49
+ output: string;
50
+ translateEnable: boolean;
51
+ };
52
+ /**
53
+ * 是否开启P2P
54
+ */
55
+ useP2P: boolean;
56
+ /**
57
+ * 新媒体流是否自动订阅
58
+ */
59
+ newPublishAutoSubscribe: boolean;
60
+ /**
61
+ * 房间状态
62
+ */
63
+ roomState: K_roomState;
64
+ /**
65
+ * 会话状态
66
+ */
67
+ peerState: RTCPeerConnectionState;
68
+ /**
69
+ * sdk服务版本
70
+ */
71
+ sdk_service_version: string;
72
+ /**
73
+ * sdk 凭证
74
+ */
75
+ sdk_session: string;
76
+ /**
77
+ * 是否开启预连接
78
+ */
79
+ isEarly: boolean;
80
+ /**
81
+ * 预连接ID
82
+ */
83
+ earlyId: string;
84
+ /**
85
+ * 是否在房间内
86
+ */
87
+ isInRoom: boolean;
88
+ /**
89
+ * sfu 优先级 如果p2p的网络质量 大于sfu网络质量+ sfuPriority 才切换至p2p 否则切换至sfu
90
+ */
91
+ sfuPriority: number;
92
+ /**
93
+ * 总网络质量
94
+ */
95
+ network: {
96
+ sfu: {
97
+ inboundBytes: number;
98
+ outboundBytes: number;
99
+ lostRate: number;
100
+ roundTripTime: number;
101
+ jitter: number;
102
+ quality: number;
103
+ averageQuality: number;
104
+ velocityPush: number;
105
+ velocityPull: number;
106
+ };
107
+ p2p: {
108
+ inboundBytes: number;
109
+ outboundBytes: number;
110
+ lostRate: number;
111
+ roundTripTime: number;
112
+ jitter: number;
113
+ quality: number;
114
+ averageQuality: number;
115
+ velocityPush: number;
116
+ velocityPull: number;
117
+ };
118
+ };
119
+ constructor();
120
+ /**
121
+ * setOptions
122
+ */
123
+ setOptions: (options: QuickOptions) => void;
124
+ setRoomOptions: (options: RoomOptions) => void;
125
+ createWsUrl: () => string;
126
+ }
@@ -0,0 +1,85 @@
1
+ import { K_mediaType } from '../../enums/mediaType';
2
+ export declare class LocalMedias {
3
+ audioContext: AudioContext;
4
+ private phoneyStreamTracks;
5
+ private mediaDevices;
6
+ private useMediaDevices;
7
+ /**
8
+ * 媒体轨道参数管理
9
+ */
10
+ private mediaTrackConstraints;
11
+ private localStreamTracks;
12
+ constructor();
13
+ /**
14
+ *
15
+ * @param kind 'audio' | 'video
16
+ * @returns MediaStreamTrack
17
+ */
18
+ getPhoneyStreamTrack: (mediaType: K_mediaType) => MediaStreamTrack;
19
+ /**
20
+ * initLocalStreamTrack
21
+ */
22
+ initLocalStreamTrack: (mediaType: K_mediaType | "mc" | "ss") => Promise<void>;
23
+ getLocalStreamTrack: (mediaType: K_mediaType) => MediaStreamTrack | undefined;
24
+ /**
25
+ * checkLocalStreamTracks
26
+ */
27
+ checkLocalStreamTracks: (mediaTypes: K_mediaType[]) => {
28
+ valid_mediaTypes: ("mc_audio" | "mc_video" | "ss_video" | "ss_audio")[];
29
+ invalid_mediaTypes: ("mc_audio" | "mc_video" | "ss_video" | "ss_audio")[];
30
+ };
31
+ /**
32
+ * 停止本地流轨道
33
+ * @param mediaType
34
+ */
35
+ stopLocalStreamTrack: (mediaType: K_mediaType) => void;
36
+ /**
37
+ * 是否已开启媒体设备
38
+ * @param mediaType
39
+ * @returns boolean
40
+ */
41
+ isOpenMediaDevice: (mediaType: K_mediaType) => boolean;
42
+ /**
43
+ * setMediaTrackConstraints
44
+ * @param mediaType K_mediaType
45
+ * @param constraints MediaTrackConstraints
46
+ */
47
+ setMediaTrackConstraints: (mediaType: K_mediaType, constraints: MediaTrackConstraints) => Promise<void>;
48
+ /**
49
+ * getMediaDeviceKind
50
+ * @param mediaDeviceKind "audioinput" | "audiooutput" | "videoinput"
51
+ * @returns deviceId string
52
+ */
53
+ getMediaDeviceKind: (mediaDeviceKind: MediaDeviceKind) => string | undefined;
54
+ setMediaDeviceKind: (mediaDeviceKind: MediaDeviceKind, deviceId: string | undefined) => void;
55
+ /**
56
+ * changeAudiooutput
57
+ */
58
+ changeAudiooutput: () => Promise<void>;
59
+ getMediaDevicesErrInfo: () => Promise<{
60
+ mc_audio: string;
61
+ mc_video: string;
62
+ }>;
63
+ /**
64
+ * getEnumerateDevices
65
+ * @param mediaDeviceKind "audioinput" | "audiooutput" | "videoinput"
66
+ * @returns MediaDeviceInfo[]
67
+ */
68
+ getEnumerateDevices: (mediaDeviceKind: MediaDeviceKind) => Promise<MediaDeviceInfo[]>;
69
+ /**
70
+ * getEnumerateAudioinputDevices
71
+ * @returns MediaDeviceInfo[]
72
+ */
73
+ getEnumerateAudioinputDevices: () => Promise<MediaDeviceInfo[]>;
74
+ /**
75
+ * getEnumerateAudioOutputDevices
76
+ * @returns MediaDeviceInfo[]
77
+ */
78
+ getEnumerateAudioOutputDevices: () => Promise<MediaDeviceInfo[]>;
79
+ /**
80
+ * getEnumerateVideoinputDevices
81
+ * @returns MediaDeviceInfo[]
82
+ */
83
+ getEnumerateVideoinputDevices: () => Promise<MediaDeviceInfo[]>;
84
+ private getAllEnumerateDevices;
85
+ }